作者 lyh

gx

@@ -41,18 +41,48 @@ class lyhDemo extends Command @@ -41,18 +41,48 @@ class lyhDemo extends Command
41 protected $description = '更新路由'; 41 protected $description = '更新路由';
42 42
43 public function handle(){ 43 public function handle(){
  44 + return $this->aggregate_keyword_affix();
44 //获取 45 //获取
45 - $keywordPrefixModel = new KeywordPrefix();  
46 - $lists = $keywordPrefixModel->list(['project_id'=>0,'id'=>['<',29]]);  
47 - $whiteModel = new ProjectWhiteHatAffix();  
48 - foreach ($lists as $val) {  
49 - echo date('Y-m-d H:i:s') . '开始--项目的id:' . $val['id'] . PHP_EOL;  
50 - $data = [  
51 - 'project_id'=>0,  
52 - 'name'=>$val['keyword'],  
53 - 'type'=>$val['type'],  
54 - ];  
55 - $whiteModel->add($data); 46 +// $keywordPrefixModel = new KeywordPrefix();
  47 +// $lists = $keywordPrefixModel->list(['project_id'=>0,'id'=>['<',29]]);
  48 +// $whiteModel = new ProjectWhiteHatAffix();
  49 +// foreach ($lists as $val) {
  50 +// echo date('Y-m-d H:i:s') . '开始--项目的id:' . $val['id'] . PHP_EOL;
  51 +// $data = [
  52 +// 'project_id'=>0,
  53 +// 'name'=>$val['keyword'],
  54 +// 'type'=>$val['type'],
  55 +// ];
  56 +// $whiteModel->add($data);
  57 +// }
  58 + return true;
  59 + }
  60 +
  61 + /**
  62 + * @remark :获取数据
  63 + * @name :aggregate_keyword_affix
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2025/6/26 17:58
  67 + */
  68 + public function aggregate_keyword_affix(){
  69 + $projectModel = new Project();
  70 + $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,4]]], 'id', ['id']);
  71 + $keywordAffixModel = new AggregateKeywordAffix();
  72 + foreach ($lists as $val){
  73 + $info = $keywordAffixModel->read(['project_id'=>$val['id']]);
  74 + $prefix = "How To find"."\n"."Why Choose"."\n"."China Top"."\n"."Best Way To Choose"."\n"."Methods To Choose";
  75 + $suffix = "Manufacturer"."\n"."Supplier"."\n"."Products"."\n"."Factory";
  76 + if($info === false){
  77 + echo '执行的项目id:'.$val['id'].PHP_EOL;
  78 + $data = [
  79 + 'project_id'=>$val['id'],
  80 + 'prefix'=>$prefix,
  81 + 'suffix'=>$suffix,
  82 + ];
  83 + $keywordAffixModel->addReturnId($data);
  84 + }
  85 +
56 } 86 }
57 return true; 87 return true;
58 } 88 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 namespace App\Services; 9 namespace App\Services;
10 10
11 use App\Models\CustomModule\CustomModule; 11 use App\Models\CustomModule\CustomModule;
  12 +use App\Models\Project\AggregateKeywordAffix;
12 use App\Models\Project\Project; 13 use App\Models\Project\Project;
13 use App\Models\RouteMap\RouteMap; 14 use App\Models\RouteMap\RouteMap;
14 use App\Models\Template\BCustomTemplate; 15 use App\Models\Template\BCustomTemplate;
@@ -140,6 +141,8 @@ class ProjectServer @@ -140,6 +141,8 @@ class ProjectServer
140 self::initColumn(); 141 self::initColumn();
141 //初始化search页面 142 //初始化search页面
142 // self::initSearchPage($project_id); 143 // self::initSearchPage($project_id);
  144 + //聚合页关键词前后缀
  145 + self::initAggregateKeywordAffix($project_id);
143 DB::disconnect('custom_mysql'); 146 DB::disconnect('custom_mysql');
144 return true; 147 return true;
145 } 148 }
@@ -280,4 +283,30 @@ class ProjectServer @@ -280,4 +283,30 @@ class ProjectServer
280 } 283 }
281 } 284 }
282 } 285 }
  286 +
  287 + /**
  288 + * @remark :gl_aggregate_keyword_affix处理聚合页关键词前后缀
  289 + * @name :initAffix
  290 + * @author :lyh
  291 + * @method :post
  292 + * @time :2025/6/26 17:48
  293 + */
  294 + public static function initAggregateKeywordAffix($project_id){
  295 + $time = date('Y-m-d H:i:s');
  296 + $prefix = "How To find"."\n"."Why Choose"."\n"."China Top"."\n"."Best Way To Choose"."\n"."Methods To Choose";
  297 + $suffix = "Manufacturer"."\n"."Supplier"."\n"."Products"."\n"."Factory";
  298 + $aggregateKeywordAffixModel = new AggregateKeywordAffix();
  299 + $info = DB::connection('custom_mysql')->table('gl_aggregate_keyword_affix')->first();
  300 + if(empty($info)){
  301 + $data = [
  302 + 'project_id'=>$project_id,
  303 + 'prefix'=>$prefix,
  304 + 'suffix'=>$suffix,
  305 + 'created_at' => $time,
  306 + 'updated_at' => $time
  307 + ];
  308 + DB::connection('custom_mysql')->table('gl_aggregate_keyword_affix')->insert($data);
  309 + }
  310 + return true;
  311 + }
283 } 312 }