TaskSystem/app/task/TaskCompanyAuthNotifyCron.php

41 lines
1.1 KiB
PHP

<?php
namespace app\task;
use app\common\model\Company;
use app\common\model\task\Task as TaskTask;
use think\facade\Log;
use yunwuxin\cron\Task;
class TaskCompanyAuthNotifyCron extends Task
{
public function configure()
{
$this->everyMinute();
// $this->everyMinute();
}
/**
* 监听企业认证回调 is_callback=1 表示回调成功
*/
protected function execute()
{
$redis = new \Redis();
//...具体的任务执行
$companyIdList = $redis->keys('authentication_company_id_*');
foreach ($companyIdList as $key) {
$data = $redis->get($key);
if (!empty($data)) {
$data = json_decode($data, true);
if ($data['is_callback'] == 1) {
$redis->del($key);
} else {
if (time() - $data['timing'] > 300) {
$companyInfo = Company::find(['id' => $data['company_id']]);
Log::info($companyInfo['company_name'].'企业认证回调超时');
}
}
}
}
}
}