Quellcode durchsuchen

[智价云] 统计更新

tangyuanwang vor 20 Stunden
Ursprung
Commit
6251569d72
1 geänderte Dateien mit 32 neuen und 12 gelöschten Zeilen
  1. 32 12
      app/Http/Controllers/Manager/Statistics/BasicPanel.php

+ 32 - 12
app/Http/Controllers/Manager/Statistics/BasicPanel.php

@@ -67,14 +67,10 @@ class BasicPanel extends Controller
         // 低价挂网商品数量查询
         $lowPriceGoodsCount = $lowPriceGoodsModel->where($map)
             ->where('status', 0)
-            ->groupBy('product_name')
-            ->select('product_name')
             ->get()->count();
         // 禁止挂网商品数量查询
         $violationProductCount = $violationProductModel->where($map)
             ->where('status', 0)
-            ->groupBy('product_name')
-            ->select('product_name')
             ->get()->count();
 
         $store_map = [];
@@ -83,15 +79,22 @@ class BasicPanel extends Controller
         // 违规店铺数量查询
         $violationStoreCount = $violationStoreModel->where($store_map)
             ->where('status', 0)
-            ->groupBy('company_name')
-            ->select('company_name')
+            ->groupBy('store_name')
+            ->select('store_name')
             ->get()->count();
 
         //获取终端类型B端、C端、OTO,配置品规数量
         $productModel = new ProductModel();
         $productModel_map = [];
-        if ($start_time) $productModel_map[] = ['insert_time', '>=', $start_time];
-        if ($end_time) $productModel_map[]   = ['insert_time', '<=', $end_time];
+        $productModel_other_map = [];
+        if ($start_time){
+             $productModel_map[] = ['sampling_start_time', '>=', $start_time];
+             $productModel_other_map[] = ['sampling_start_time', '>=', $start_time];
+        }
+        if ($end_time){
+             $productModel_map[]   = ['sampling_end_time', '<=', $end_time];
+             $productModel_map[]   = ['sampling_end_time', '!=', '0'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $productModel = $productModel->where('company_id', $company_id);
         } else {
@@ -107,6 +110,7 @@ class BasicPanel extends Controller
             })
             ->where('status', 0)
             ->where($productModel_map)
+            ->whereOr($productModel_other_map)
             ->distinct('product_name')
             ->pluck('product_name');
 
@@ -121,8 +125,15 @@ class BasicPanel extends Controller
 
         $productModel = new ProductModel();
         $productModel_map = [];
-        if ($start_time) $productModel_map[] = ['insert_time', '>=', $start_time];
-        if ($end_time) $productModel_map[]   = ['insert_time', '<=', $end_time];
+        $productModel_other_map = [];
+        if ($start_time){
+             $productModel_map[] = ['sampling_start_time', '>=', $start_time];
+             $productModel_other_map[] = ['sampling_start_time', '>=', $start_time];
+        }
+        if ($end_time){
+             $productModel_map[]   = ['sampling_end_time', '<=', $end_time];
+             $productModel_map[]   = ['sampling_end_time', '!=', '0'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $productModel = $productModel->where('company_id', $company_id);
         } else {
@@ -138,6 +149,7 @@ class BasicPanel extends Controller
             })
             ->where('status', 0)
             ->where($productModel_map)
+            ->whereOr($productModel_other_map)
             ->distinct('product_name')
             ->pluck('product_name');
 
@@ -152,8 +164,15 @@ class BasicPanel extends Controller
 
         $productModel = new ProductModel();
         $productModel_map = [];
-        if ($start_time) $productModel_map[] = ['insert_time', '>=', $start_time];
-        if ($end_time) $productModel_map[]   = ['insert_time', '<=', $end_time];
+        $productModel_other_map = [];
+        if ($start_time){
+             $productModel_map[] = ['sampling_start_time', '>=', $start_time];
+             $productModel_other_map[] = ['sampling_start_time', '>=', $start_time];
+        }
+        if ($end_time){
+             $productModel_map[]   = ['sampling_end_time', '<=', $end_time];
+             $productModel_map[]   = ['sampling_end_time', '!=', '0'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $productModel = $productModel->where('company_id', $company_id);
         } else {
@@ -169,6 +188,7 @@ class BasicPanel extends Controller
             })
             ->where('status', 0)
             ->where($productModel_map)
+            ->whereOr($productModel_other_map)
             ->distinct('product_name')
             ->pluck('product_name');