Bladeren bron

调整客户统计检索和显示项

yb 1 maand geleden
bovenliggende
commit
b85eace537
2 gewijzigde bestanden met toevoegingen van 15 en 0 verwijderingen
  1. 8 0
      app/admin/service/consultant/CustomService.php
  2. 7 0
      app/model/MarketCustomer.php

+ 8 - 0
app/admin/service/consultant/CustomService.php

@@ -123,6 +123,14 @@ class CustomService
                 $query->whereBetween('created_at', $createdDate);
             }];
         }
+        if (!empty($params['check_date'])) {
+            $checkDate = $params['check_date'];
+            $checkDate[0] = strtotime($checkDate[0].' 00:00:00');
+            $checkDate[1] = strtotime($checkDate[1].' 23:59:59');
+            $where[] = [function($query) use ($checkDate) {
+                $query->whereBetween('check_time', $checkDate)->where('current_status', '>', 1);
+            }];
+        }
 
         if (!empty($params['current_status'])) {
             $currentStatus = $params['current_status'];

+ 7 - 0
app/model/MarketCustomer.php

@@ -28,6 +28,13 @@ class MarketCustomer extends Model
         });
     }
 
+    protected function checkTime():Attribute
+    {
+        return Attribute::get(function ($value) {
+            return date('Y-m-d H:i:s', $value);
+        });
+    }
+
     public static function config()
     {
         $config = [