feat : kitchen
This commit is contained in:
@@ -97,17 +97,17 @@ class SiteCache
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $siteId
|
* @param int $siteId
|
||||||
* @return array|false|\Redis|null
|
* @return array|false|\Redis
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function getSiteInfo(int $siteId): false|array|\Redis|null
|
public function getSiteInfo(int $siteId): false|array|\Redis
|
||||||
{
|
{
|
||||||
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
||||||
|
|
||||||
if (!$this->redis->exists($siteKey,RedisCode::SYSTEM_DB)) $this->setSiteInfo($siteId);
|
if (!$this->redis->exists($siteKey,RedisCode::SYSTEM_DB)) $this->setSiteInfo($siteId);
|
||||||
|
|
||||||
return $this->redis->hGetAll($siteKey,RedisCode::SYSTEM_DB) ?? null;
|
return $this->redis->hGetAll($siteKey,RedisCode::SYSTEM_DB) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ class OptionalListService extends BaseService
|
|||||||
#[Inject]
|
#[Inject]
|
||||||
protected Category $categoryModel;
|
protected Category $categoryModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认地址
|
||||||
|
* @var array|false
|
||||||
|
*/
|
||||||
|
private array|false $siteInfo = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
@@ -67,12 +73,13 @@ class OptionalListService extends BaseService
|
|||||||
if (empty($cycleId)) return $this->return->success('success', ['list' => []]);
|
if (empty($cycleId)) return $this->return->success('success', ['list' => []]);
|
||||||
|
|
||||||
$this->goodCache->cycleId = (int)$cycleId;
|
$this->goodCache->cycleId = (int)$cycleId;
|
||||||
if (!empty($this->request->input('site_id'))){
|
|
||||||
$siteInfo = $this->siteCache->getSiteInfo((int)$this->request->input('site_id'));
|
|
||||||
}
|
|
||||||
if (empty($siteInfo) || empty($siteInfo['kitchen_id'])) $siteInfo['kitchen_id'] = config('system.kitchen_id');
|
|
||||||
|
|
||||||
$this->goodCache->kitchenId = (int)$siteInfo['kitchen_id'];
|
if (!empty($this->request->input('site_id'))){
|
||||||
|
$this->siteInfo = $this->siteCache->getSiteInfo((int)$this->request->input('site_id'));
|
||||||
|
}
|
||||||
|
if (empty($this->siteInfo) || empty($this->siteInfo['kitchen_id'])) $this->siteInfo['kitchen_id'] = config('system.default_kitchen_id');
|
||||||
|
|
||||||
|
$this->goodCache->kitchenId = (int)$this->siteInfo['kitchen_id'];
|
||||||
$data = $this->goodCache->getOptionalGoodList();
|
$data = $this->goodCache->getOptionalGoodList();
|
||||||
|
|
||||||
if (empty($data)) return $this->return->success('success', ['list' => []]);
|
if (empty($data)) return $this->return->success('success', ['list' => []]);
|
||||||
|
|||||||
Reference in New Issue
Block a user