作者 赵彬吉

update

... ... @@ -41,9 +41,9 @@ class SyncSubmitTask extends Command
$time = time();
// DB::enableQueryLog(); //启用查询日志
// //清除之前的查询日志
// DB::flushQueryLog();
DB::enableQueryLog(); //启用查询日志
//清除之前的查询日志
DB::flushQueryLog();
$task_info = SyncSubmitTaskModel::find($task_id);
if (empty($task_info) || $task_info->status !=3) {
... ... @@ -56,9 +56,7 @@ class SyncSubmitTask extends Command
throw new \Exception('项目不存在');
}
$task_info->project_id = $project->id;
$time2 = time();
SyncSubmitTaskService::handler($task_info);
$this->output('处理用时:' . (time() - $time2));
$task_info->status = 1;
$task_info->save();
... ... @@ -87,11 +85,10 @@ class SyncSubmitTask extends Command
$use_time = time() - $time;
if($use_time > 1){
//数据库查询
$this->output('任务用时:' .$use_time);
// $this->output('任务用时:' .$use_time . ' | ' . json_encode(DB::getQueryLog(),JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
$this->output('任务用时:' .$use_time . ' | ' . json_encode(DB::getQueryLog(),JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
}
//清除之前的查询日志
// DB::flushQueryLog();
DB::flushQueryLog();
}
}
... ...
... ... @@ -88,9 +88,11 @@ class SyncSubmitTaskService
}
}
$time = time();
if(!ProjectServer::useProject($project['id'])){
return false;
}
echo date('Y-m-d H:i:s') . ' | useProject time:' . (time() - $time) . PHP_EOL;
$action = $task['type'];
... ... @@ -106,7 +108,7 @@ class SyncSubmitTaskService
}
$filed == 'email' && $action = 'subscribe';
}
$handler = new self();
return $handler->$action($data, $date, $task['id'], $task['traffic']);
}
... ... @@ -297,6 +299,7 @@ class SyncSubmitTaskService
if(!$ip){
return '';
}
$res = Http::withoutVerifying()->get('http://ip.globalso.com', ['ip' => $ip]);
if($res->status() == 200){
return $res->body();
... ... @@ -334,7 +337,9 @@ class SyncSubmitTaskService
if($ip == "127.0.0.1"){
throw new InquiryFilterException('127.0.0.1过滤');
}
$time = time();
$country = self::getCountryByIp($ip);
echo date('Y-m-d H:i:s') . ' | getCountryByIp time:' . (time() - $time) . PHP_EOL;
//访问记录过滤国内
if ($type == SyncSubmitTask::TYPE_VISIT && $country == "中国" && !$project->is_record_china_visit){
throw new InquiryFilterException('中国内地过滤');
... ...