Pārlūkot izejas kodu

[智价云] 数据数据查询更新

tangyuanwang 1 dienu atpakaļ
vecāks
revīzija
777dcabc77
1 mainītis faili ar 15 papildinājumiem un 3 dzēšanām
  1. 15 3
      app/Http/Controllers/Manager/Statistics/BasicPanel.php

+ 15 - 3
app/Http/Controllers/Manager/Statistics/BasicPanel.php

@@ -58,12 +58,10 @@ class BasicPanel extends Controller
             $lowPriceGoodsModel = $lowPriceGoodsModel->where('company_id', $company_id);
             $violationProductModel = $violationProductModel->where('company_id', $company_id);
             $violationStoreModel = $violationStoreModel->where('company_id', $company_id);
-            $productModel = $productModel->where('company_id', $company_id);
         } else {
             $lowPriceGoodsModel = $lowPriceGoodsModel->where('company_id', $admin_company_id);
             $violationProductModel = $violationProductModel->where('company_id', $admin_company_id);
             $violationStoreModel = $violationStoreModel->where('company_id', $admin_company_id);
-            $productModel = $productModel->where('company_id', $admin_company_id);
         }
 
         // 低价挂网商品数量查询
@@ -94,6 +92,11 @@ class BasicPanel extends Controller
         $productModel_map = [];
         if ($start_time) $productModel_map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $productModel_map[]   = ['insert_time', '<=', $end_time];
+        if ($is_admin != 1 && $company_id != 0) {
+            $productModel = $productModel->where('company_id', $company_id);
+        } else {
+            $productModel = $productModel->where('company_id', $admin_company_id);
+        }
 
         $productNames = $productModel
             ->where(function ($query) {
@@ -120,6 +123,11 @@ class BasicPanel extends Controller
         $productModel_map = [];
         if ($start_time) $productModel_map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $productModel_map[]   = ['insert_time', '<=', $end_time];
+        if ($is_admin != 1 && $company_id != 0) {
+            $productModel = $productModel->where('company_id', $company_id);
+        } else {
+            $productModel = $productModel->where('company_id', $admin_company_id);
+        }
 
         $productNames = $productModel
             ->where(function ($query) {
@@ -146,7 +154,11 @@ class BasicPanel extends Controller
         $productModel_map = [];
         if ($start_time) $productModel_map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $productModel_map[]   = ['insert_time', '<=', $end_time];
-
+        if ($is_admin != 1 && $company_id != 0) {
+            $productModel = $productModel->where('company_id', $company_id);
+        } else {
+            $productModel = $productModel->where('company_id', $admin_company_id);
+        }
 
         $productNames = $productModel
             ->where(function ($query) {