loustwo 4 лет назад
Родитель
Сommit
17155eaa90
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      app/Services/OrderService.php

+ 5 - 3
app/Services/OrderService.php

@@ -1140,11 +1140,13 @@ SQL;
         if (!$month)$month = date("Y-m");
         $query = DB::raw(<<<sql
 SELECT COUNT(1) count,logistic_id FROM orders WHERE wms_status = '订单完成'
-AND owner_id = ?
-AND wms_edittime like ? GROUP BY logistic_id
+AND owner_id >= ?
+AND wms_edittime >= ? and wms_edittime <= ?   GROUP BY logistic_id
 sql
         );
-        $statistics = DB::select($query, [$owner, $month . "%"]);
+        $startDate = $month.'-01 00:00:00';
+        $endDate = Carbon::parse($startDate)->addMonth()->subMicrosecond()->toDateTimeString();
+        $statistics = DB::select($query, [$owner, $startDate,$endDate]);
         $toB = 0;
         $toC = 0;
         foreach ($statistics as $statistic) {