|
|
|
|
@ -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) {
|
|
|
|
|
|