feat : catering
This commit is contained in:
@@ -25,7 +25,7 @@ trait CouponDispenseTrait
|
||||
|
||||
$this->cycleId = $cycleInfo->id;
|
||||
|
||||
$appointValue = json_encode($this->request->input('appoint_value'));
|
||||
$appointValue = $this->request->input('appoint_value');
|
||||
// if ($this->groupType == CouponCode::DISPENSE_APPOINT_GROUP_DESIGNATED_SITES_AND_GOODS) {
|
||||
// $this->appointValue = [
|
||||
// 'site' => explode(',', $appointValue['site']),
|
||||
@@ -152,7 +152,7 @@ trait CouponDispenseTrait
|
||||
{
|
||||
$this->checkAppointValue();
|
||||
|
||||
$appointValue = json_encode($this->request->input('appoint_value'));
|
||||
$appointValue = $this->request->input('appoint_value');
|
||||
|
||||
return explode(',', $appointValue['user_ids']);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Service\ServiceTrait;
|
||||
|
||||
use App\Cache\Redis\Api\SiteCache;
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Model\OrderMealCateringLog;
|
||||
use App\Model\OrderOptionCateringLog;
|
||||
@@ -23,8 +24,16 @@ trait CateringTrait
|
||||
#[Inject]
|
||||
protected OrderMealCateringLog $orderMealCateringLogModel;
|
||||
|
||||
/**
|
||||
* @var SiteCache
|
||||
*/
|
||||
#[Inject]
|
||||
protected SiteCache $siteCache;
|
||||
|
||||
/**
|
||||
* @return bool 添加失败需要退款
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
private function manageAddCateringLog(): bool
|
||||
{
|
||||
@@ -46,8 +55,6 @@ trait CateringTrait
|
||||
OrderCode::ORDER_TYPE_MEAL => $this->manageSubMealCateringLog(),
|
||||
OrderCode::ORDER_TYPE_OPTIONAL => $this->manageSubOptionCateringLog(),
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +67,10 @@ trait CateringTrait
|
||||
// todo 减少可以不减少根据订单 cycle_id 获取加一碗米饭 的数量 减少查询压力
|
||||
// $addStapleFoodNum = 0;
|
||||
|
||||
//todo 需要绑定一个 kitchen_id
|
||||
$logInfo = $this->orderOptionCateringLogModel->getInfoBySiteIdAndCycleId($this->orderInfo->site_id, $this->orderInfo->cycle_id);
|
||||
$siteInfo = $this->siteCache->getSiteInfo($this->orderInfo->site_id);
|
||||
|
||||
//需要绑定一个 kitchen_id
|
||||
$logInfo = $this->orderOptionCateringLogModel->getInfoBySiteIdAndCycleIdAndSiteId($this->orderInfo->site_id, $this->orderInfo->cycle_id, (int)$siteInfo['kitchen_id']);
|
||||
|
||||
if (empty($logInfo)) {
|
||||
$this->log->error(__CLASS__.':Function:refundCallBackHandle:manageSubOptionCateringLog:订单套餐配餐记录不存在,订单信息:'.json_encode($this->orderInfo->toArray()));
|
||||
@@ -114,20 +123,24 @@ trait CateringTrait
|
||||
/**
|
||||
* 添加自选配餐数据
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
private function manageAddOptionCateringLog(): bool
|
||||
{
|
||||
//todo 根据订单 cycle_id 获取加一碗米饭 的数量
|
||||
$addStapleFoodNum = 0;
|
||||
|
||||
//todo 需要绑定一个 kitchen_id
|
||||
$logInfo = $this->orderOptionCateringLogModel->getInfoBySiteIdAndCycleId($this->orderInfo->site_id, $this->orderInfo->cycle_id);
|
||||
$siteInfo = $this->siteCache->getSiteInfo($this->orderInfo->site_id);
|
||||
//需要绑定一个 kitchen_id
|
||||
$logInfo = $this->orderOptionCateringLogModel->getInfoBySiteIdAndCycleIdAndSiteId($this->orderInfo->site_id, $this->orderInfo->cycle_id,(int)$siteInfo['kitchen_id']);
|
||||
|
||||
if (empty($logInfo)) {
|
||||
$logInfo = new OrderOptionCateringLog();
|
||||
|
||||
$logInfo->site_id = $this->orderInfo->site_id;
|
||||
$logInfo->cycle_id = $this->orderInfo->cycle_id;
|
||||
$logInfo->kitchen_id = (int)$siteInfo['kitchen_id'];
|
||||
$logInfo->quantity = 0;
|
||||
$logInfo->add_staple_food_num = 0;
|
||||
$logInfo->status = 1;
|
||||
|
||||
Reference in New Issue
Block a user