正在显示
3 个修改的文件
包含
14 行增加
和
2 行删除
| @@ -58,7 +58,7 @@ class SyncSubmitTask extends Command | @@ -58,7 +58,7 @@ class SyncSubmitTask extends Command | ||
| 58 | $task_info->project_id = $project->id; | 58 | $task_info->project_id = $project->id; |
| 59 | $time2 = time(); | 59 | $time2 = time(); |
| 60 | SyncSubmitTaskService::handler($task_info); | 60 | SyncSubmitTaskService::handler($task_info); |
| 61 | - $this->output('任务用时:' . (time() - $time2)); | 61 | + $this->output('处理用时:' . (time() - $time2)); |
| 62 | $task_info->status = 1; | 62 | $task_info->status = 1; |
| 63 | $task_info->save(); | 63 | $task_info->save(); |
| 64 | 64 |
| @@ -153,4 +153,16 @@ class DomainInfo extends Base | @@ -153,4 +153,16 @@ class DomainInfo extends Base | ||
| 153 | $value = Arr::s2a($value); | 153 | $value = Arr::s2a($value); |
| 154 | return $value; | 154 | return $value; |
| 155 | } | 155 | } |
| 156 | + | ||
| 157 | + public static function getCacheInfoByProjectId($project_id){ | ||
| 158 | + $cache_key = 'DOMAIN_INFO_BY_PROJECT_ID_' . $project_id; | ||
| 159 | + $data = Cache::get($cache_key); | ||
| 160 | + if(!$data){ | ||
| 161 | + $data = DomainInfo::where('project_id', $project_id)->first(); | ||
| 162 | + if($data){ | ||
| 163 | + Cache::put($cache_key, $data, 3600); | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + return $data; | ||
| 167 | + } | ||
| 156 | } | 168 | } |
| @@ -75,7 +75,7 @@ class SyncSubmitTaskService | @@ -75,7 +75,7 @@ class SyncSubmitTaskService | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | //域名 过滤国家或ip | 77 | //域名 过滤国家或ip |
| 78 | - $domain_info = DomainInfo::where('project_id', $project['id'])->first(); | 78 | + $domain_info = DomainInfo::getCacheInfoByProjectId($project['id']); |
| 79 | if(!empty($domain_info['not_allow_country'])){ | 79 | if(!empty($domain_info['not_allow_country'])){ |
| 80 | $not_allow_countries = CountryCode::whereIn('id', $domain_info['not_allow_country'])->pluck('c_name')->toArray(); | 80 | $not_allow_countries = CountryCode::whereIn('id', $domain_info['not_allow_country'])->pluck('c_name')->toArray(); |
| 81 | if(in_array($data['country'], $not_allow_countries)){ | 81 | if(in_array($data['country'], $not_allow_countries)){ |
-
请 注册 或 登录 后发表评论