feat : coupon
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user