From 178203bae6418c3d4018e3e67fe09755855a9ce4 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 8 Sep 2023 12:05:34 +0800 Subject: [PATCH] =?UTF-8?q?add:=E4=BD=BF=E7=94=A8=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E7=9A=84redis=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 3 ++- app/task/TaskCompanyAuthNotifyCron.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index d5dc7d216..a493102c7 100755 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -14,6 +14,7 @@ namespace app\api\controller; use app\api\logic\IndexLogic; +use app\common\logic\RedisLogic; use app\common\model\Company; use app\common\model\company\CompanyProperty; use app\common\model\contract\VehicleContract; @@ -431,7 +432,7 @@ class IndexController extends BaseApiController if ($parmas) { $data=json_decode($parmas['data'],true); // 成功回调标记 - $redis = new Redis(['host'=>'redis']); + $redis = RedisLogic::getInstance(); $cache = $redis->get('authentication_company_id_'.$parmas['id']); if (!empty($cache)) { $data = json_decode($cache, true); diff --git a/app/task/TaskCompanyAuthNotifyCron.php b/app/task/TaskCompanyAuthNotifyCron.php index d9e831a30..d3167f7dc 100644 --- a/app/task/TaskCompanyAuthNotifyCron.php +++ b/app/task/TaskCompanyAuthNotifyCron.php @@ -2,6 +2,7 @@ namespace app\task; +use app\common\logic\RedisLogic; use app\common\model\Company; use app\common\model\task\Task as TaskTask; use think\cache\driver\Redis; @@ -21,7 +22,7 @@ class TaskCompanyAuthNotifyCron extends Task */ protected function execute() { - $redis = new Redis(['host'=>'redis']); + $redis = RedisLogic::getInstance(); //...具体的任务执行 $companyIdList = $redis->keys('authentication_company_id_*'); foreach ($companyIdList as $key) {