소스 검색

[智价云] 店铺搜索查询更新

tangyuanwang 1 개월 전
부모
커밋
6dbb5486a9
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      app/Http/Controllers/Manager/Statistics/BasicPanel.php

+ 6 - 1
app/Http/Controllers/Manager/Statistics/BasicPanel.php

@@ -57,9 +57,11 @@ class BasicPanel extends Controller
         if ($is_admin != 1 && $company_id != 0) {
             $lowPriceGoodsModel = $lowPriceGoodsModel->where('company_id', $company_id);
             $violationProductModel = $violationProductModel->where('company_id', $company_id);
+            $violationStoreModel = $violationStoreModel->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);
         }
 
         // 低价挂网商品数量查询
@@ -74,8 +76,11 @@ class BasicPanel extends Controller
             ->groupBy('product_name')
             ->count(DB::raw('DISTINCT product_name'));
 
+        $store_map = [];
+        if ($start_time) $store_map[] = ['insert_time', '>=', $start_time];
+        if ($end_time) $store_map[]   = ['insert_time', '<=', $end_time];
         // 违规店铺数量查询
-        $violationStoreCount = $violationStoreModel->where($map)
+        $violationStoreCount = $violationStoreModel->where($store_map)
             ->where('status', 0)
             ->groupBy('company_name')
             ->count(DB::raw('DISTINCT company_name'));