From dae9d1a38a4056cefd85ef851a5cfb79ff599980 Mon Sep 17 00:00:00 2001 From: ctexthuang Date: Tue, 1 Apr 2025 15:37:26 +0800 Subject: [PATCH] feat : check --- app/Service/Admin/Catering/Meal/CheckService.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Service/Admin/Catering/Meal/CheckService.php b/app/Service/Admin/Catering/Meal/CheckService.php index 837457b..734fee2 100644 --- a/app/Service/Admin/Catering/Meal/CheckService.php +++ b/app/Service/Admin/Catering/Meal/CheckService.php @@ -61,6 +61,14 @@ class CheckService extends CateringBaseService if (!empty($this->logInfo)) $this->tips(); + $todayLog = $this->orderMealCateringLog + ->where('cycle_id',$this->cycleId) + ->where('status',CateringCode::CATERING_STATUS_UNDERWAY) + ->where('quantity','>',0) + ->first(); + + if (!empty($todayLog)) return $this->return->success(); + $orderIds = $this->orderModel ->where('cycle_id', $this->cycleId) ->where('type',OrderCode::ORDER_TYPE_MEAL) @@ -72,7 +80,9 @@ class CheckService extends CateringBaseService // $this->orderModel->whereIn('id', $orderIds)->update(['status' => OrderCode::PLAN]); Db::transaction(function () use ($orderIds) { - if (!$this->orderModel->isCateringByOrderIds($orderIds) || !$this->orderGoodModel->isCateringByOrderIds($orderIds)) throw new Exception('修改订单数据状态失败'); + foreach (array_chunk($orderIds, 100) as $chunk) { + if (!$this->orderModel->isCateringByOrderIds($chunk) || !$this->orderGoodModel->isCateringByOrderIds($chunk)) throw new Exception('修改订单数据状态失败'); + } }); return $this->return->success();