Merge remote-tracking branch 'origin/master' into akun
正在显示
6 个修改的文件
包含
26 行增加
和
14 行删除
| @@ -85,7 +85,7 @@ class TemplateLog extends Command | @@ -85,7 +85,7 @@ class TemplateLog extends Command | ||
| 85 | * @time :2024/11/13 16:19 | 85 | * @time :2024/11/13 16:19 |
| 86 | */ | 86 | */ |
| 87 | public function deleteUserLog(){ | 87 | public function deleteUserLog(){ |
| 88 | - $date = date('Y-m-d H:i:s', strtotime('-60 days')); | 88 | + $date = date('Y-m-d H:i:s', strtotime('-90 days')); |
| 89 | $userLogModel = new UserLog(); | 89 | $userLogModel = new UserLog(); |
| 90 | return $userLogModel->del(['created_at'=>['<=',$date]]); | 90 | return $userLogModel->del(['created_at'=>['<=',$date]]); |
| 91 | } | 91 | } |
| @@ -42,7 +42,7 @@ class PrivateController extends BaseController | @@ -42,7 +42,7 @@ class PrivateController extends BaseController | ||
| 42 | public function optimizeProjectList(Request $request) | 42 | public function optimizeProjectList(Request $request) |
| 43 | { | 43 | { |
| 44 | $page_size = $request->input('page_size', 20); | 44 | $page_size = $request->input('page_size', 20); |
| 45 | - $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain']; | 45 | + $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special']; |
| 46 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') | 46 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') |
| 47 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') | 47 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') |
| 48 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') | 48 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') |
| @@ -208,6 +208,7 @@ class CNoticeController extends BaseController | @@ -208,6 +208,7 @@ class CNoticeController extends BaseController | ||
| 208 | * 更新通知C端 | 208 | * 更新通知C端 |
| 209 | * @param Request $request | 209 | * @param Request $request |
| 210 | * @return \Illuminate\Http\JsonResponse | 210 | * @return \Illuminate\Http\JsonResponse |
| 211 | + * @param : type : 1->主站更新 4->聚合页更新 | ||
| 211 | */ | 212 | */ |
| 212 | public function sendNotify(Request $request) | 213 | public function sendNotify(Request $request) |
| 213 | { | 214 | { |
| @@ -217,6 +218,13 @@ class CNoticeController extends BaseController | @@ -217,6 +218,13 @@ class CNoticeController extends BaseController | ||
| 217 | $url = $request->input('url', []); | 218 | $url = $request->input('url', []); |
| 218 | $language = $request->input('language', []); | 219 | $language = $request->input('language', []); |
| 219 | $is_sitemap = intval($request->input('is_sitemap', 0)); | 220 | $is_sitemap = intval($request->input('is_sitemap', 0)); |
| 221 | + if($type == 4){//代表聚合页更新 | ||
| 222 | + $keywordModel = new Keyword(); | ||
| 223 | + $keywordInfo = $keywordModel->whereNull('seo_title')->orWhereNull('seo_keywords')->orWhereNull('seo_description')->first(); | ||
| 224 | + if(!empty($keywordInfo)){ | ||
| 225 | + $this->fail('TDK不全,禁止提交。'); | ||
| 226 | + } | ||
| 227 | + } | ||
| 220 | //获取项目所在服务器 | 228 | //获取项目所在服务器 |
| 221 | $project_model = new Project(); | 229 | $project_model = new Project(); |
| 222 | $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']); | 230 | $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']); |
| @@ -239,7 +247,6 @@ class CNoticeController extends BaseController | @@ -239,7 +247,6 @@ class CNoticeController extends BaseController | ||
| 239 | $this->fail('当前升级项目还有页面正在采集,请采集完成之后再更新静态页面'); | 247 | $this->fail('当前升级项目还有页面正在采集,请采集完成之后再更新静态页面'); |
| 240 | } | 248 | } |
| 241 | } | 249 | } |
| 242 | - | ||
| 243 | if($servers_id == ServerConfig::SELF_SITE_ID){ | 250 | if($servers_id == ServerConfig::SELF_SITE_ID){ |
| 244 | //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库 | 251 | //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库 |
| 245 | $domain_model = new DomainInfo(); | 252 | $domain_model = new DomainInfo(); |
| @@ -159,8 +159,11 @@ class FileController | @@ -159,8 +159,11 @@ class FileController | ||
| 159 | $nameArr = explode('.',$name); | 159 | $nameArr = explode('.',$name); |
| 160 | $suffix = array_pop($nameArr) ?? 'jpg'; | 160 | $suffix = array_pop($nameArr) ?? 'jpg'; |
| 161 | $nameStr = implode('-', $nameArr); | 161 | $nameStr = implode('-', $nameArr); |
| 162 | - $enName = generateRoute(Translate::tran($nameStr, 'en')); | ||
| 163 | - if(substr($enName, 0, 1) === '-'){ | 162 | + //为空时,重试三次 |
| 163 | + $enName = retry(3, function () use ($nameStr) { | ||
| 164 | + return generateRoute(Translate::tran($nameStr, 'en')); | ||
| 165 | + }, 100); // 100 毫秒后重试 | ||
| 166 | + if(empty($enName)){ | ||
| 164 | $enName = md5(uniqid().$project_id.rand(1,1000)); | 167 | $enName = md5(uniqid().$project_id.rand(1,1000)); |
| 165 | } | 168 | } |
| 166 | $fileName = $enName; | 169 | $fileName = $enName; |
| @@ -53,7 +53,7 @@ class SyncSubmitTaskService | @@ -53,7 +53,7 @@ class SyncSubmitTaskService | ||
| 53 | 53 | ||
| 54 | //特殊处理 | 54 | //特殊处理 |
| 55 | if($project['id'] == 455 && !empty($data['email']) && $data['email'] == 'alb@marketingtu.org'){ | 55 | if($project['id'] == 455 && !empty($data['email']) && $data['email'] == 'alb@marketingtu.org'){ |
| 56 | - return false; | 56 | + throw new InquiryFilterException( '黑名单邮箱'); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | //过滤url参数 清除全部参数 | 59 | //过滤url参数 清除全部参数 |
| @@ -69,8 +69,9 @@ class SyncSubmitTaskService | @@ -69,8 +69,9 @@ class SyncSubmitTaskService | ||
| 69 | if ($data['country'] == '约旦' && empty($data['data']['referrer_url'])) { | 69 | if ($data['country'] == '约旦' && empty($data['data']['referrer_url'])) { |
| 70 | $url_array = parse_url($data['data']['url']); | 70 | $url_array = parse_url($data['data']['url']); |
| 71 | $path_array = explode('/', $url_array['path']); | 71 | $path_array = explode('/', $url_array['path']); |
| 72 | - if (FALSE == empty($path_array[1]) && strlen($path_array[1]) <= 3) | ||
| 73 | - return false; | 72 | + if (FALSE == empty($path_array[1]) && strlen($path_array[1]) <= 3){ |
| 73 | + throw new InquiryFilterException( '过滤被刷访问'); | ||
| 74 | + } | ||
| 74 | } | 75 | } |
| 75 | } | 76 | } |
| 76 | 77 | ||
| @@ -79,18 +80,18 @@ class SyncSubmitTaskService | @@ -79,18 +80,18 @@ class SyncSubmitTaskService | ||
| 79 | if(!empty($domain_info['not_allow_country'])){ | 80 | if(!empty($domain_info['not_allow_country'])){ |
| 80 | $not_allow_countries = CountryCode::whereIn('id', $domain_info['not_allow_country'])->pluck('c_name')->toArray(); | 81 | $not_allow_countries = CountryCode::whereIn('id', $domain_info['not_allow_country'])->pluck('c_name')->toArray(); |
| 81 | if(in_array($data['country'], $not_allow_countries)){ | 82 | if(in_array($data['country'], $not_allow_countries)){ |
| 82 | - return false; | 83 | + throw new InquiryFilterException( '过滤国家'); |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| 85 | if(!empty($domain_info['not_allow_ip'])){ | 86 | if(!empty($domain_info['not_allow_ip'])){ |
| 86 | if(in_array($data['ip'], $domain_info['not_allow_ip'])){ | 87 | if(in_array($data['ip'], $domain_info['not_allow_ip'])){ |
| 87 | - return false; | 88 | + throw new InquiryFilterException( '过滤ip'); |
| 88 | } | 89 | } |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | $time = time(); | 92 | $time = time(); |
| 92 | if(!ProjectServer::useProject($project['id'])){ | 93 | if(!ProjectServer::useProject($project['id'])){ |
| 93 | - return false; | 94 | + throw new InquiryFilterException( '项目不存在或数据库配置异常'); |
| 94 | } | 95 | } |
| 95 | echo date('Y-m-d H:i:s') . ' | useProject time:' . (time() - $time) . PHP_EOL; | 96 | echo date('Y-m-d H:i:s') . ' | useProject time:' . (time() - $time) . PHP_EOL; |
| 96 | 97 | ||
| @@ -108,7 +109,7 @@ class SyncSubmitTaskService | @@ -108,7 +109,7 @@ class SyncSubmitTaskService | ||
| 108 | } | 109 | } |
| 109 | $filed == 'email' && $action = 'subscribe'; | 110 | $filed == 'email' && $action = 'subscribe'; |
| 110 | } | 111 | } |
| 111 | - | 112 | + |
| 112 | $handler = new self(); | 113 | $handler = new self(); |
| 113 | return $handler->$action($data, $date, $task['id'], $task['traffic']); | 114 | return $handler->$action($data, $date, $task['id'], $task['traffic']); |
| 114 | } | 115 | } |
| @@ -204,7 +205,7 @@ class SyncSubmitTaskService | @@ -204,7 +205,7 @@ class SyncSubmitTaskService | ||
| 204 | } | 205 | } |
| 205 | if(Cache::get($ip_lock_cache_key)){ | 206 | if(Cache::get($ip_lock_cache_key)){ |
| 206 | Log::channel('inquiry')->info($task_id . '询盘ip重复锁定', [$data]); | 207 | Log::channel('inquiry')->info($task_id . '询盘ip重复锁定', [$data]); |
| 207 | - return true; | 208 | + throw new InquiryFilterException( 'ip半小时内重复询盘'); |
| 208 | } | 209 | } |
| 209 | 210 | ||
| 210 | //数组key转为小写 | 211 | //数组key转为小写 |
-
请 注册 或 登录 后发表评论