|
|
|
|
@ -150,28 +150,14 @@ class StatisticsController extends CommonController
|
|
|
|
|
public function syncOrderItems(Request $request)
|
|
|
|
|
{
|
|
|
|
|
//采用指定时间段订单号
|
|
|
|
|
$orders = Orders::where("serial",">","20210601000000")->get();
|
|
|
|
|
foreach ($orders as $order) {
|
|
|
|
|
$factors = json_decode($order->factors);
|
|
|
|
|
foreach ($factors as $factor) {
|
|
|
|
|
$current_factor = FactorItems::find($factor->factor_item_id);
|
|
|
|
|
$factor->fee = $current_factor->fee;
|
|
|
|
|
$factor->fee_percent = $current_factor->fee_percent;
|
|
|
|
|
$factor->factor_name = $current_factor->name;
|
|
|
|
|
}
|
|
|
|
|
$order->update([
|
|
|
|
|
"factors" => json_encode($factors)
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
dd("订单处理完毕");
|
|
|
|
|
|
|
|
|
|
$model = OrderItems::whereIn("order_id",$orders->pluck("id")->toArray());
|
|
|
|
|
$model = OrderItems::where(DB::raw("UNIX_TIMESTAMP(`service_date`) >= ".strtotime("2021-06-01")));
|
|
|
|
|
//采用指定订单号结束
|
|
|
|
|
|
|
|
|
|
if ($request->last_id) {
|
|
|
|
|
$model = $model->where("id", ">", $request->last_id);
|
|
|
|
|
}
|
|
|
|
|
$orderItems = $model->with("order")->limit(20)->get();
|
|
|
|
|
dd($orderItems->toArray());
|
|
|
|
|
|
|
|
|
|
if (!$orderItems->count()) {
|
|
|
|
|
dd("已处理完毕");
|
|
|
|
|
|