feat: redis
This commit is contained in:
@@ -13,6 +13,7 @@ namespace App\Cron\Good;
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\Common\CycleCache;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Extend\DateUtil;
|
||||
use App\Lib\Log;
|
||||
use App\Model\Cycle;
|
||||
@@ -72,7 +73,7 @@ class CycleCreateTask
|
||||
$noDataInsertArr = [];
|
||||
$noDataArr = [];
|
||||
foreach ($nextCycleRange as $date) {
|
||||
$one = $this->redis->zScore($key,$date,'system');
|
||||
$one = $this->redis->zScore($key,$date,RedisCode::SYSTEM_DB);
|
||||
|
||||
if ($one) continue;
|
||||
|
||||
@@ -93,7 +94,7 @@ class CycleCreateTask
|
||||
$res = $res->toArray();
|
||||
|
||||
foreach ($res as $one) {
|
||||
$this->redis->zAdd($key,$one['id'],$one['dates'],'system');
|
||||
$this->redis->zAdd($key,$one['id'],$one['dates'],RedisCode::SYSTEM_DB);
|
||||
}
|
||||
|
||||
$this->log->notice('添加周期成功,添加的周期为'.json_encode($noDataArr,JSON_UNESCAPED_UNICODE));
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace App\Cron\Oss;
|
||||
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Extend\DateUtil;
|
||||
use App\Lib\Log;
|
||||
use App\Model\OssObject;
|
||||
@@ -58,7 +59,7 @@ class OssDelByDisableTask
|
||||
|
||||
|
||||
foreach ($list->toArray() as $item) {
|
||||
$this->redis->lPush(CommonRedisKey::getDeleteOssImgListByOssId(), (string)$item,'system');
|
||||
$this->redis->lPush(CommonRedisKey::getDeleteOssImgListByOssId(), (string)$item,RedisCode::SYSTEM_DB);
|
||||
}
|
||||
|
||||
$this->log->notice(__CLASS__.'异步删除昨日无效图片');
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace App\Cron\Oss;
|
||||
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Lib\Log;
|
||||
use App\Model\OssObject;
|
||||
use Hyperf\Crontab\Annotation\Crontab;
|
||||
@@ -48,7 +49,7 @@ class OssDelByOssIdTask
|
||||
|
||||
$ossIds = [];
|
||||
for ($i = 1; $i < 50; $i++) {
|
||||
$one = $this->redis->rPop($key,'system');
|
||||
$one = $this->redis->rPop($key,RedisCode::SYSTEM_DB);
|
||||
if (empty($one)){
|
||||
continue;
|
||||
}
|
||||
@@ -87,7 +88,7 @@ class OssDelByOssIdTask
|
||||
//把图片地址丢到删除redis队列
|
||||
foreach ($urlList as $item) {
|
||||
$url = substr(parse_url($item)['path'],1);
|
||||
$this->redis->lPush(CommonRedisKey::getDeleteOssImgListByUrl(), $url,'system');
|
||||
$this->redis->lPush(CommonRedisKey::getDeleteOssImgListByUrl(), $url,RedisCode::SYSTEM_DB);
|
||||
}
|
||||
|
||||
$this->log->notice(__CLASS__.':success:删除oss文件个数:' . count($ossIds));
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace App\Cron\Oss;
|
||||
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Lib\Log;
|
||||
use Hyperf\Crontab\Annotation\Crontab;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
@@ -62,7 +63,7 @@ class OssDelByUrlTask
|
||||
|
||||
$delNum = 0;
|
||||
for ($i = 1; $i < 50; $i++) {
|
||||
$url = $this->redis->rPop($key,'system');
|
||||
$url = $this->redis->rPop($key,RedisCode::SYSTEM_DB);
|
||||
|
||||
if (!empty($url)) {
|
||||
$delNum++;
|
||||
|
||||
Reference in New Issue
Block a user