feat : catering

This commit is contained in:
2025-03-12 17:26:11 +08:00
parent 3858bc4a5d
commit 467f44f847
12 changed files with 1114 additions and 54 deletions

View File

@@ -5,8 +5,8 @@ namespace App\Service\ServiceTrait\Admin\Catering;
use App\Cache\Redis\Admin\AdminRedisKey;
use App\Cache\Redis\RedisCache;
use App\Constants\Admin\CateringCode;
use App\Exception\ErrException;
use App\Extend\DateUtil;
use App\Extend\StringUtil;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
@@ -27,17 +27,6 @@ trait PrintTrait
protected string $pickupCodeKey;
protected string $isCateringKey;
/**
* 前缀
* @var string
*/
protected string $currentPrefix;
/**
* 分组
* @var array
*/
protected array $currentHeapSort;
/**
*
@@ -155,4 +144,49 @@ trait PrintTrait
return false;
}
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function buildPickupCodeCache(): void
{
if (CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($this->pickupCodeKey, $this->logInfo->id)) return;
$this->redis->hSet($this->pickupCodeKey, $this->logInfo->id, CateringCode::REDIS_FINISH_VALUE);
}
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function delPickUpCodeByIdCache(): void
{
$this->redis->hDel($this->pickupCodeKey, $this->logInfo->id);
}
/**
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function isCateringByCache(): bool
{
if (CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($this->isCateringKey, $this->logInfo->id)) return true;
return false;
}
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function joinCateringCache(): void
{
if (CateringCode::REDIS_FINISH_VALUE == $this->redis->hGet($this->isCateringKey, $this->logInfo->id)) return;
$this->redis->hSet($this->isCateringKey, $this->logInfo->id, CateringCode::REDIS_FINISH_VALUE);
}
}