diff --git a/app/adminapi/controller/CompanyController.php b/app/adminapi/controller/CompanyController.php index 1c83cc8e5..d69f9219d 100644 --- a/app/adminapi/controller/CompanyController.php +++ b/app/adminapi/controller/CompanyController.php @@ -23,6 +23,7 @@ use app\adminapi\validate\CompanyValidate; use app\api\controller\JunziqianController; use app\common\model\auth\Admin; use app\common\model\Company; +use think\cache\driver\Redis; use think\facade\Db; use app\common\logic\contract\ContractLogic; use app\common\model\contract\Contract; @@ -209,7 +210,7 @@ class CompanyController extends BaseAdminController // 修改法人邮箱 Db::name('company')->where('id', $params['id'])->update(['master_email' => $email]); // 加入缓存中,is_callback用于判断是否获取到异步通知 - $redis = new \Redis(['host'=>'redis']); + $redis = new Redis(['host'=>'redis']); $redis->set('authentication_company_id_'.$company['id'], json_encode(['company_id'=>$company['id'],'is_callback'=>0, 'timing'=>time()])); // return $this->success('认证成功',[],1, 1); return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1); diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 1dc9ad41b..d5dc7d216 100755 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -18,6 +18,7 @@ use app\common\model\Company; use app\common\model\company\CompanyProperty; use app\common\model\contract\VehicleContract; use app\common\model\vehicle\VehicleRent; +use think\cache\driver\Redis; use think\facade\Db; use think\facade\Log; use think\response\Json; @@ -430,7 +431,7 @@ class IndexController extends BaseApiController if ($parmas) { $data=json_decode($parmas['data'],true); // 成功回调标记 - $redis = new \Redis(); + $redis = new Redis(['host'=>'redis']); $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 5b1237f03..d9e831a30 100644 --- a/app/task/TaskCompanyAuthNotifyCron.php +++ b/app/task/TaskCompanyAuthNotifyCron.php @@ -4,6 +4,7 @@ namespace app\task; use app\common\model\Company; use app\common\model\task\Task as TaskTask; +use think\cache\driver\Redis; use think\facade\Log; use yunwuxin\cron\Task; @@ -20,7 +21,7 @@ class TaskCompanyAuthNotifyCron extends Task */ protected function execute() { - $redis = new \Redis(); + $redis = new Redis(['host'=>'redis']); //...具体的任务执行 $companyIdList = $redis->keys('authentication_company_id_*'); foreach ($companyIdList as $key) {