OMEGA\EricYH.Huang 3 年 前
コミット
1abbd2d425
共有2 個のファイルを変更した8 個の追加9 個の削除を含む
  1. 5
    6
      app/Http/Controllers/Api/GeneralInnerServiceController.php
  2. 3
    3
      app/Http/Services/Backend/DataManagement/UrlManagementService.php

+ 5
- 6
app/Http/Controllers/Api/GeneralInnerServiceController.php ファイルの表示

173
         // 鑒權
173
         // 鑒權
174
         if ($this->oid == 0) return json_decode(json_encode(['code' => $this->apicode, 'msg' => GeneralConst::$apiMap[ $this->apicode ], 'data' => []], JSON_NUMERIC_CHECK), true);
174
         if ($this->oid == 0) return json_decode(json_encode(['code' => $this->apicode, 'msg' => GeneralConst::$apiMap[ $this->apicode ], 'data' => []], JSON_NUMERIC_CHECK), true);
175
         // 服務層
175
         // 服務層
176
-        $orlId = $request->input('orlId');
177
-        $result = $this->urlManagementSv->takeOrlPV($orlId, $this->oid);
176
+        $orlIds = $request->input('orlId');
177
+        $result = $this->urlManagementSv->takeOrlPV($orlIds, $this->oid);
178
         // 整理返回資料
178
         // 整理返回資料
179
         $data = [];
179
         $data = [];
180
         if (!empty($result)) {
180
         if (!empty($result)) {
181
-            $data = [
182
-                'id'      => $result["serno"],
183
-                'pv'    => $result["pv"],
184
-            ];
181
+            foreach($result as $dataPV){
182
+                $data[$dataPV["serno"]] = $dataPV["pv"];
183
+            }
185
         }
184
         }
186
         // 返回
185
         // 返回
187
         return json_decode(json_encode(['code' => GeneralConst::API_OK, 'msg' => GeneralConst::$apiMap[ GeneralConst::API_OK ], 'data' => $data], JSON_NUMERIC_CHECK), true);       
186
         return json_decode(json_encode(['code' => GeneralConst::API_OK, 'msg' => GeneralConst::$apiMap[ GeneralConst::API_OK ], 'data' => $data], JSON_NUMERIC_CHECK), true);       

+ 3
- 3
app/Http/Services/Backend/DataManagement/UrlManagementService.php ファイルの表示

177
         return $url;
177
         return $url;
178
     }
178
     }
179
     
179
     
180
-    public function takeOrlPV($id, $oid)
180
+    public function takeOrlPV($ids, $oid)
181
     {
181
     {
182
         // 取得參數
182
         // 取得參數
183
         // 調用資料庫(或者其他業務邏輯)
183
         // 調用資料庫(或者其他業務邏輯)
203
                 ->where('oid', '=', $oid);
203
                 ->where('oid', '=', $oid);
204
         }
204
         }
205
         $url = $url
205
         $url = $url
206
-            ->where('serno', $id)
207
-            ->first();
206
+            ->whereIn('serno', $ids)
207
+            ->get();
208
         if (is_null($url)) {
208
         if (is_null($url)) {
209
             return [];
209
             return [];
210
         }
210
         }