作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into lyh-server

@@ -141,29 +141,45 @@ class RerunSeoTdk extends Command @@ -141,29 +141,45 @@ class RerunSeoTdk extends Command
141 // } 141 // }
142 // } 142 // }
143 143
144 - /**  
145 - * 判断异常  
146 - * @author zbj  
147 - * @date 2025/4/12  
148 - */  
149 - public function judgeAnomalies($project_id){  
150 - //获取当前项目的所有分类  
151 - $categories = NewsCategory::pluck('alias', 'id')->toArray();  
152 - //新闻 seo_keyword 和 分类名一样的  
153 - $news_ids = [];  
154 - foreach ($categories as $category){  
155 - $ids = News::WhereRaw("FIND_IN_SET('{$category}', `seo_keywords`)")->pluck('id')->toArray();  
156 - $news_ids = array_unique(array_merge($news_ids, $ids));  
157 - } 144 +// /**
  145 +// * 判断异常
  146 +// * @author zbj
  147 +// * @date 2025/4/12
  148 +// */
  149 +// public function judgeAnomalies($project_id){
  150 +// //获取当前项目的所有分类
  151 +// $categories = NewsCategory::pluck('alias', 'id')->toArray();
  152 +// //新闻 seo_keyword 和 分类名一样的
  153 +// $news_ids = [];
  154 +// foreach ($categories as $category){
  155 +// $ids = News::WhereRaw("FIND_IN_SET('{$category}', `seo_keywords`)")->pluck('id')->toArray();
  156 +// $news_ids = array_unique(array_merge($news_ids, $ids));
  157 +// }
  158 +//
  159 +// $count = count($news_ids);
  160 +// if($count){
  161 +// echo "项目{$project_id},共{$count}条需要重跑";
  162 +// News::whereIn('id', $news_ids)->update(['seo_keywords' => '']);
  163 +// ProjectUpdateTdk::add_task($project_id);
  164 +// }
  165 +// }
158 166
159 - $count = count($news_ids);  
160 - if($count){  
161 - echo "项目{$project_id},共{$count}条需要重跑";  
162 - News::whereIn('id', $news_ids)->update(['seo_keywords' => '']);  
163 - ProjectUpdateTdk::add_task($project_id); 167 + public function judgeAnomalies($project_id)
  168 + {
  169 + $page_title = Keyword::where('keyword_title', 'like', '%qz_1%')->orWhere('keyword_title', 'like', '%qz_2%')->update(['keyword_title' => '']);
  170 + $page_content = Keyword::where('keyword_content', 'like', '%qz_1%')->orWhere('keyword_content', 'like', '%qz_2%')->update(['keyword_content' => '']);
  171 + $seo_description = Keyword::where('seo_description', 'like', '%qz_1%')->orWhere('seo_description', 'like', '%qz_2%')->update(['seo_description' => '']);
  172 +
  173 + if($page_title || $page_content || $seo_description){
  174 + echo "项目{$project_id},需要重跑";
  175 + dump($page_title);
  176 + dump($page_content);
  177 + dump($seo_description);
164 } 178 }
165 } 179 }
166 180
  181 +
  182 +
167 public function getAllPrefix($type, int $project_id = 0){ 183 public function getAllPrefix($type, int $project_id = 0){
168 $cache_key = 'AllPrefix_' . $type . '_' . $project_id; 184 $cache_key = 'AllPrefix_' . $type . '_' . $project_id;
169 $data = Cache::get($cache_key); 185 $data = Cache::get($cache_key);
@@ -173,4 +189,6 @@ class RerunSeoTdk extends Command @@ -173,4 +189,6 @@ class RerunSeoTdk extends Command
173 } 189 }
174 return $data; 190 return $data;
175 } 191 }
  192 +
  193 +
176 } 194 }
@@ -507,29 +507,36 @@ class UpdateSeoTdk extends Command @@ -507,29 +507,36 @@ class UpdateSeoTdk extends Command
507 } 507 }
508 508
509 $project = Project::find($project_id); 509 $project = Project::find($project_id);
510 - #TODO 2025-05-16 发现{qz_x}{hz_x} 已经应用到其他指令里面,去掉限制  
511 - if (!in_array(8, explode(',', $project->deploy_optimize->special))) {  
512 - // 前缀关键词  
513 - if (preg_match_all("/\{qz_(\d+)\}/", $prompt, $matches)) {  
514 - foreach ($matches[0] as $key => $val) { 510 + // 前缀关键词
  511 + if (preg_match_all("/\{qz_(\d+)\}/", $prompt, $matches)) {
  512 + foreach ($matches[0] as $key => $val) {
  513 + //特殊关键词项目 不适用前后缀关键词
  514 + if(in_array(8, explode(',', $project->deploy_optimize->special))){
  515 + $keyword = '';
  516 + }else{
515 $keyword = $this->getPrefixKeyword($project_id, 'prefix', $matches[1][$key]); 517 $keyword = $this->getPrefixKeyword($project_id, 'prefix', $matches[1][$key]);
516 if (!$keyword) { 518 if (!$keyword) {
517 echo getmypid() . ' ' . '前缀关键词为空 跳过' . PHP_EOL; 519 echo getmypid() . ' ' . '前缀关键词为空 跳过' . PHP_EOL;
518 return false; 520 return false;
519 } 521 }
520 - $prompt = str_replace($val, $keyword, $prompt);  
521 } 522 }
  523 + $prompt = str_replace($val, $keyword, $prompt);
522 } 524 }
523 - // 后缀关键词  
524 - if (preg_match_all("/\{hz_(\d+)\}/", $prompt, $matches)) {  
525 - foreach ($matches[0] as $key => $val) { 525 + }
  526 + // 后缀关键词
  527 + if (preg_match_all("/\{hz_(\d+)\}/", $prompt, $matches)) {
  528 + foreach ($matches[0] as $key => $val) {
  529 + //特殊关键词项目 不适用前后缀关键词
  530 + if(in_array(8, explode(',', $project->deploy_optimize->special))){
  531 + $keyword = '';
  532 + }else {
526 $keyword = $this->getPrefixKeyword($project_id, 'suffix', $matches[1][$key]); 533 $keyword = $this->getPrefixKeyword($project_id, 'suffix', $matches[1][$key]);
527 if (!$keyword) { 534 if (!$keyword) {
528 echo getmypid() . ' ' . '前缀关键词为空 跳过' . PHP_EOL; 535 echo getmypid() . ' ' . '前缀关键词为空 跳过' . PHP_EOL;
529 return false; 536 return false;
530 } 537 }
531 - $prompt = str_replace($val, $keyword, $prompt);  
532 } 538 }
  539 + $prompt = str_replace($val, $keyword, $prompt);
533 } 540 }
534 } 541 }
535 542
@@ -1153,7 +1153,10 @@ class ProjectController extends BaseController @@ -1153,7 +1153,10 @@ class ProjectController extends BaseController
1153 1153
1154 if($this->param['site_status'] == 1){ 1154 if($this->param['site_status'] == 1){
1155 //关闭站点:通知C端 1155 //关闭站点:通知C端
1156 - curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website'); 1156 + $re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');
  1157 + if(isset($re['status']) && $re['status'] !== 200){
  1158 + $this->fail($re['message']);
  1159 + }
1157 }else{ 1160 }else{
1158 //开启站点:创建建站任务 1161 //开启站点:创建建站任务
1159 $serverIpModel = new ServersIp(); 1162 $serverIpModel = new ServersIp();
@@ -1170,24 +1173,26 @@ class ProjectController extends BaseController @@ -1170,24 +1173,26 @@ class ProjectController extends BaseController
1170 1173
1171 //创建更新站点证书任务 1174 //创建更新站点证书任务
1172 $domainCreateTaskModel = new DomainCreateTask(); 1175 $domainCreateTaskModel = new DomainCreateTask();
1173 - $task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $domainInfo['id'], 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']); 1176 + $task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
1174 if (!$task_info) { 1177 if (!$task_info) {
1175 $domainCreateTaskModel->add([ 1178 $domainCreateTaskModel->add([
1176 'server_id' => $serversIpInfo['servers_id'], 1179 'server_id' => $serversIpInfo['servers_id'],
1177 'project_id' => $this->param['id'], 1180 'project_id' => $this->param['id'],
1178 'domain_id' => $domainInfo['id'], 1181 'domain_id' => $domainInfo['id'],
1179 - 'type' => $type 1182 + 'type' => $type,
  1183 + 'is_open' => DomainCreateTask::IS_OPEN
1180 ]); 1184 ]);
1181 } 1185 }
1182 1186
1183 if($domainInfo['amp_status']){ 1187 if($domainInfo['amp_status']){
1184 - $task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']); 1188 + $task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
1185 if (!$task_info_amp) { 1189 if (!$task_info_amp) {
1186 $domainCreateTaskModel->add([ 1190 $domainCreateTaskModel->add([
1187 'server_id' => $serversIpInfo['servers_id'], 1191 'server_id' => $serversIpInfo['servers_id'],
1188 'project_id' => $this->param['id'], 1192 'project_id' => $this->param['id'],
1189 'domain_id' => $domainInfo['id'], 1193 'domain_id' => $domainInfo['id'],
1190 - 'type' => DomainCreateTask::TYPE_AMP 1194 + 'type' => DomainCreateTask::TYPE_AMP,
  1195 + 'is_open' => DomainCreateTask::IS_OPEN
1191 ]); 1196 ]);
1192 } 1197 }
1193 } 1198 }
@@ -17,4 +17,6 @@ class DomainCreateTask extends Base @@ -17,4 +17,6 @@ class DomainCreateTask extends Base
17 const TYPE_AMP = 2; 17 const TYPE_AMP = 2;
18 const TYPE_CUSTOM = 3; 18 const TYPE_CUSTOM = 3;
19 const TYPE_BLOG = 4; 19 const TYPE_BLOG = 4;
  20 +
  21 + const IS_OPEN = 1;
20 } 22 }