feat : check
This commit is contained in:
@@ -342,4 +342,38 @@ trait PrintTrait
|
||||
|
||||
return CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($this->stopMealOrderKey, (string)$siteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $skuId
|
||||
* @param int $cycleId
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function closeMealSku(int $skuId, int $cycleId): void
|
||||
{
|
||||
$key = AdminRedisKey::mealIsCateringBySkuId($cycleId);
|
||||
|
||||
$hashKey = (string)$skuId;
|
||||
|
||||
if (CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($key, $hashKey)) return;
|
||||
|
||||
$this->redis->hSet($key, $hashKey, CateringCode::REDIS_FINISH_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $skuId
|
||||
* @param int $cycleId
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function checkSkuMeal(int $skuId, int $cycleId): bool
|
||||
{
|
||||
$key = AdminRedisKey::mealIsCateringBySkuId($cycleId);
|
||||
|
||||
$hashKey = (string)$skuId;
|
||||
|
||||
return CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($key, $hashKey);
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,8 @@ trait OrderTrait
|
||||
if ($this->orderType != OrderCode::ORDER_TYPE_MEAL) return;
|
||||
|
||||
if ($this->isMealCateringByCache($this->siteId, $key, $this->cycleId)) throw new ErrException('该点位的套餐'.$this->skuArr[$key]['title'].'已配餐截单,请选择其他套餐');
|
||||
|
||||
if ($this->checkSkuMeal($key, $this->cycleId)) throw new ErrException('该套餐'.$this->skuArr[$key]['title'].'已配餐截单,请选择其他套餐');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user