feat : check

This commit is contained in:
2025-04-01 15:37:26 +08:00
parent 957e18390f
commit dae9d1a38a

View File

@@ -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();