作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -68,12 +68,29 @@ class UpdateRoute extends Command @@ -68,12 +68,29 @@ class UpdateRoute extends Command
68 */ 68 */
69 public function handle() 69 public function handle()
70 { 70 {
71 - ProjectServer::useProject(1181);  
72 - return $this->setProductKeyword(); 71 + ProjectServer::useProject(4132);
  72 + return $this->product_action(4132);
73 DB::disconnect('custom_mysql'); 73 DB::disconnect('custom_mysql');
74 } 74 }
75 75
76 /** 76 /**
  77 + * @remark :执行所有产品的路由
  78 + * @name :product_action
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2025/6/21 17:29
  82 + */
  83 + public function product_action($project_id){
  84 + $productModel = new Product();
  85 + $lists = $productModel->list([],'id',['id','title','route']);
  86 + foreach ($lists as $item){
  87 + $route = RouteMap::setRoute($item['title'],RouteMap::SOURCE_PRODUCT,$item['id'],$project_id);
  88 + $productModel->edit(['route'=>$route],['id'=>$item['id']]);
  89 + }
  90 + return true;
  91 + }
  92 +
  93 + /**
77 * @remark :查询 路由为空的关键词项目id 94 * @remark :查询 路由为空的关键词项目id
78 * @name :getNullRoute 95 * @name :getNullRoute
79 * @author :lyh 96 * @author :lyh
@@ -170,32 +187,6 @@ class UpdateRoute extends Command @@ -170,32 +187,6 @@ class UpdateRoute extends Command
170 return true; 187 return true;
171 } 188 }
172 189
173 -// $this->updateProjectOp();  
174 -// $projectModel = new Project();  
175 -// $lists = $projectModel->list(['delete_status'=>0],'id',['id']);  
176 -// foreach ($lists as $v){  
177 -// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
178 -// ProjectServer::useProject($v['id']);  
179 -// $webSettingModel = new WebSetting();  
180 -// $settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);  
181 -// if($settingInfo === false){  
182 -// echo date('Y-m-d H:i:s') . '当前项目的设置数据不存在:'.$v['id'] . PHP_EOL;  
183 -// //新增一条数据  
184 -// $data = [  
185 -// 'anchor_setting'=>'["3","4","5"]',  
186 -// 'anchor_is_enable'=>1,  
187 -// 'anchor_page_num'=>1,  
188 -// 'anchor_num'=>2,  
189 -// 'anchor_keyword_is_enable'=>1,  
190 -// 'project_id'=>$v['id']  
191 -// ];  
192 -// $webSettingModel->add($data);  
193 -// }  
194 -// DB::disconnect('custom_mysql');  
195 -// }  
196 -// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;  
197 -// }  
198 -  
199 /** 190 /**
200 * @remark :更新产品 191 * @remark :更新产品
201 * @name :updateProduct 192 * @name :updateProduct
@@ -36,7 +36,14 @@ class InitKeywordComment extends Command @@ -36,7 +36,14 @@ class InitKeywordComment extends Command
36 public $number = 100; 36 public $number = 100;
37 37
38 public function handle(){ 38 public function handle(){
39 - return $this->_action(467); 39 + $projectModel = new Project();
  40 + $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
  41 + foreach ($lists as $val) {
  42 + echo date('Y-m-d H:i:s') . '开始--项目的id:' . $val['id'] . PHP_EOL;
  43 + $this->_action($val['id']);
  44 + }
  45 + return true;
  46 + $keywordCommonModel = new AggregateKeywordComment();
40 while (true){ 47 while (true){
41 $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get(); 48 $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
42 if(empty($list)){ 49 if(empty($list)){
@@ -86,12 +93,16 @@ class InitKeywordComment extends Command @@ -86,12 +93,16 @@ class InitKeywordComment extends Command
86 if(!isset($item['name']) || !isset($item['comment'])){ 93 if(!isset($item['name']) || !isset($item['comment'])){
87 continue; 94 continue;
88 } 95 }
  96 + $twoMonthsAgo = strtotime('-2 months');
  97 + $randomTimestamp = rand($twoMonthsAgo, time());
  98 + $randomDateTime = date('Y-m-d H:i:s', $randomTimestamp);
89 $data[] = [ 99 $data[] = [
90 'nickname'=>$item['name'], 100 'nickname'=>$item['name'],
91 'text'=>$item['comment'], 101 'text'=>$item['comment'],
92 'project_id'=>$project_id, 102 'project_id'=>$project_id,
93 'type'=>1, 103 'type'=>1,
94 'uid'=>0, 104 'uid'=>0,
  105 + 'start_time'=>$randomDateTime,
95 'created_at'=>date('Y-m-d H:i:s'), 106 'created_at'=>date('Y-m-d H:i:s'),
96 'updated_at'=>date('Y-m-d H:i:s') 107 'updated_at'=>date('Y-m-d H:i:s')
97 ]; 108 ];
@@ -396,7 +396,6 @@ class KeywordLogic extends BaseLogic @@ -396,7 +396,6 @@ class KeywordLogic extends BaseLogic
396 preg_match_all('/\{[^{}]*\}/', $text, $matches); 396 preg_match_all('/\{[^{}]*\}/', $text, $matches);
397 $data = []; 397 $data = [];
398 $twoMonthsAgo = strtotime('-2 months'); 398 $twoMonthsAgo = strtotime('-2 months');
399 -  
400 if (!empty($text)) { 399 if (!empty($text)) {
401 foreach ($matches[0] as $item) { 400 foreach ($matches[0] as $item) {
402 $item = str_replace("'", '"', $item); 401 $item = str_replace("'", '"', $item);