feat: redis
This commit is contained in:
21
app/Service/Api/Good/MealListService.php
Normal file
21
app/Service/Api/Good/MealListService.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Api\Good;
|
||||
|
||||
use App\Service\Api\BaseService;
|
||||
|
||||
class MealListService extends BaseService
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
//todo Write logic
|
||||
}
|
||||
}
|
||||
21
app/Service/Api/Good/OptionalListService.php
Normal file
21
app/Service/Api/Good/OptionalListService.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Api\Good;
|
||||
|
||||
use App\Service\Api\BaseService;
|
||||
|
||||
class OptionalListService extends BaseService
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
//todo Write logic
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ namespace App\Service\Common;
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\Common\OssObjectCode;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Lib\AdminReturn;
|
||||
use App\Lib\Log;
|
||||
@@ -308,7 +309,7 @@ class OssCallbackService
|
||||
private function deleteOssObject(): void
|
||||
{
|
||||
//删除旧的文件
|
||||
$this->redisCache->lPush(CommonRedisKey::getDeleteOssImgListByUrl(), $this->data['object'],'system');
|
||||
$this->redisCache->lPush(CommonRedisKey::getDeleteOssImgListByUrl(), $this->data['object'],RedisCode::SYSTEM_DB);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ namespace App\Service\ServiceTrait\Api;
|
||||
use App\Cache\Redis\Api\ApiRedisKey;
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Lib\Log;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
@@ -75,7 +76,7 @@ trait WxMiniTrait
|
||||
|
||||
if (empty($data) || empty($data['access_token']) || empty($data['expires_in'])) return '';
|
||||
|
||||
$this->redisCache->setEx($key, $data['access_token'], $data['expires_in'] - 10,'system');
|
||||
$this->redisCache->setEx($key, $data['access_token'], $data['expires_in'] - 10,RedisCode::SYSTEM_DB);
|
||||
|
||||
return $data['access_token'];
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Service\ServiceTrait\Common;
|
||||
|
||||
use App\Cache\Redis\Common\ConfigCache;
|
||||
use App\Cache\Redis\Common\CycleCache;
|
||||
use App\Constants\ConfigCode;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
trait CycleTrait
|
||||
@@ -13,10 +15,22 @@ trait CycleTrait
|
||||
#[Inject]
|
||||
protected CycleCache $cycleCache;
|
||||
|
||||
|
||||
/**
|
||||
* @var ConfigCache
|
||||
*/
|
||||
#[Inject]
|
||||
protected ConfigCache $configCache;
|
||||
|
||||
protected function initTodayCycleId()
|
||||
{
|
||||
$TodayCutOffTime = $this->configCache->getConfigValueByKey(ConfigCode::TODAY_CUT_OFF_TIME_KEY);
|
||||
|
||||
if (date('H:i:s') >= ($TodayCutOffTime)) {
|
||||
$day = date('Y-m-d',strtotime('+1 day'));
|
||||
} else {
|
||||
$day = date('Y-m-d',strtotime('today'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace App\Service\ServiceTrait\Common;
|
||||
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -36,7 +37,7 @@ trait SiteTrait
|
||||
public function setSiteCache($value, string $lng = '0', string $lat = '0'): void
|
||||
{
|
||||
$key = CommonRedisKey::getActivateSiteList();
|
||||
$this->redisCache->zRem($key,$value,'system');
|
||||
$this->redisCache->geoAdd($key,$lng,$lat,$value,'system');
|
||||
$this->redisCache->zRem($key,$value,RedisCode::SYSTEM_DB);
|
||||
$this->redisCache->geoAdd($key,$lng,$lat,$value,RedisCode::SYSTEM_DB);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user