feat : catering

This commit is contained in:
2025-03-10 18:00:55 +08:00
parent 11b0782568
commit e3ecd93b2d
7 changed files with 62 additions and 16 deletions

View File

@@ -44,17 +44,6 @@ trait GoodOrderTrait
#[Inject]
protected OrderGood $orderGoodModel;
/**
* @var OrderOptionCateringLog
*/
#[Inject]
protected OrderOptionCateringLog $orderOptionCateringLogModel;
/**
* @var OrderMealCateringLog
*/
#[Inject]
protected OrderMealCateringLog $orderMealCateringLogModel;
/**
* @return void

View File

@@ -5,12 +5,23 @@ namespace App\Service\ServiceTrait;
use App\Constants\Common\OrderCode;
use App\Model\OrderMealCateringLog;
use App\Model\OrderOptionCateringLog;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
trait CateringTrait
{
/**
* @var OrderOptionCateringLog
*/
#[Inject]
protected OrderOptionCateringLog $orderOptionCateringLogModel;
/**
* @var OrderMealCateringLog
*/
#[Inject]
protected OrderMealCateringLog $orderMealCateringLogModel;
/**
* @return bool 添加失败需要退款
@@ -49,6 +60,7 @@ trait CateringTrait
// todo 减少可以不减少根据订单 cycle_id 获取加一碗米饭 的数量 减少查询压力
// $addStapleFoodNum = 0;
//todo 需要绑定一个 kitchen_id
$logInfo = $this->orderOptionCateringLogModel->getInfoBySiteIdAndCycleId($this->orderInfo->site_id, $this->orderInfo->cycle_id);
if (empty($logInfo)) {
@@ -108,6 +120,7 @@ trait CateringTrait
//todo 根据订单 cycle_id 获取加一碗米饭 的数量
$addStapleFoodNum = 0;
//todo 需要绑定一个 kitchen_id
$logInfo = $this->orderOptionCateringLogModel->getInfoBySiteIdAndCycleId($this->orderInfo->site_id, $this->orderInfo->cycle_id);
if (empty($logInfo)) {