feat : coupon

This commit is contained in:
2025-03-21 16:15:28 +08:00
parent 11a36ece80
commit 8a4674b1dc
11 changed files with 190 additions and 11 deletions

View File

@@ -14,8 +14,11 @@ use App\Constants\Admin\CateringCode;
use App\Constants\Common\OrderCode;
use App\Exception\ErrException;
use App\Model\Order;
use App\Model\OrderGood;
use App\Model\OrderMealCateringLog;
use App\Service\Admin\Catering\CateringBaseService;
use Exception;
use Hyperf\DbConnection\Db;
use Hyperf\Di\Annotation\Inject;
class CheckService extends CateringBaseService
@@ -38,6 +41,12 @@ class CheckService extends CateringBaseService
#[Inject]
protected Order $orderModel;
/**
* @var OrderGood
*/
#[Inject]
protected OrderGood $orderGoodModel;
/**
* @return array
*/
@@ -61,7 +70,10 @@ class CheckService extends CateringBaseService
if (empty($orderIds)) throw new ErrException('数据错误');
$this->orderModel->whereIn('id', $orderIds)->update(['status' => OrderCode::PLAN]);
// $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('修改订单数据状态失败');
});
return $this->return->success();
}