From 1372177ff5e80d67013e3e1d16f49afce38f5189 Mon Sep 17 00:00:00 2001 From: weizong song Date: Thu, 1 Jul 2021 13:46:58 +0800 Subject: [PATCH] up --- .../Admin/StatisticsController.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 1d1ac09..d911fc2 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -149,21 +149,10 @@ class StatisticsController extends CommonController public function syncOrderItems(Request $request) { -// if (!$request->month) { -// dd("月份不正确"); -// return $this->error("月份不正确"); -// } -// if (strtotime($request->month) < strtotime(date("Y-m", strtotime("-1 month")))) { -// dd("上月份之前的数据不支持此操作"); -// return $this->error("上月份之前的数据不支持此操作"); -// } -// -// $month = $request->month; -// $model = OrderItems::whereRaw("DATE_FORMAT(`service_date`,'%Y-%m') = '{$month}'"); - - //采用指定订单号 + //采用指定时间段订单号 $orders = ["20201102000008", "20201201000006", "20201105000008"]; - $order_ids = Orders::whereIn("serial",$orders)->pluck("id")->toArray(); + $order_ids = Orders::where("serial",">","20210601000000")->pluck("id")->toArray(); + dd($order_ids); $model = OrderItems::whereIn("order_id", $order_ids); //采用指定订单号结束 @@ -178,6 +167,8 @@ class StatisticsController extends CommonController DB::beginTransaction(); try { + + foreach ($orderItems as $orderItem) { $factors = json_decode($orderItem->factors); foreach ($factors as $factor) {