作者 刘锟

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

... ... @@ -68,12 +68,29 @@ class UpdateRoute extends Command
*/
public function handle()
{
ProjectServer::useProject(1181);
return $this->setProductKeyword();
ProjectServer::useProject(4132);
return $this->product_action(4132);
DB::disconnect('custom_mysql');
}
/**
* @remark :执行所有产品的路由
* @name :product_action
* @author :lyh
* @method :post
* @time :2025/6/21 17:29
*/
public function product_action($project_id){
$productModel = new Product();
$lists = $productModel->list([],'id',['id','title','route']);
foreach ($lists as $item){
$route = RouteMap::setRoute($item['title'],RouteMap::SOURCE_PRODUCT,$item['id'],$project_id);
$productModel->edit(['route'=>$route],['id'=>$item['id']]);
}
return true;
}
/**
* @remark :查询 路由为空的关键词项目id
* @name :getNullRoute
* @author :lyh
... ... @@ -170,32 +187,6 @@ class UpdateRoute extends Command
return true;
}
// $this->updateProjectOp();
// $projectModel = new Project();
// $lists = $projectModel->list(['delete_status'=>0],'id',['id']);
// foreach ($lists as $v){
// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
// ProjectServer::useProject($v['id']);
// $webSettingModel = new WebSetting();
// $settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);
// if($settingInfo === false){
// echo date('Y-m-d H:i:s') . '当前项目的设置数据不存在:'.$v['id'] . PHP_EOL;
// //新增一条数据
// $data = [
// 'anchor_setting'=>'["3","4","5"]',
// 'anchor_is_enable'=>1,
// 'anchor_page_num'=>1,
// 'anchor_num'=>2,
// 'anchor_keyword_is_enable'=>1,
// 'project_id'=>$v['id']
// ];
// $webSettingModel->add($data);
// }
// DB::disconnect('custom_mysql');
// }
// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
// }
/**
* @remark :更新产品
* @name :updateProduct
... ...
... ... @@ -36,7 +36,14 @@ class InitKeywordComment extends Command
public $number = 100;
public function handle(){
return $this->_action(467);
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
foreach ($lists as $val) {
echo date('Y-m-d H:i:s') . '开始--项目的id:' . $val['id'] . PHP_EOL;
$this->_action($val['id']);
}
return true;
$keywordCommonModel = new AggregateKeywordComment();
while (true){
$list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
if(empty($list)){
... ... @@ -86,12 +93,16 @@ class InitKeywordComment extends Command
if(!isset($item['name']) || !isset($item['comment'])){
continue;
}
$twoMonthsAgo = strtotime('-2 months');
$randomTimestamp = rand($twoMonthsAgo, time());
$randomDateTime = date('Y-m-d H:i:s', $randomTimestamp);
$data[] = [
'nickname'=>$item['name'],
'text'=>$item['comment'],
'project_id'=>$project_id,
'type'=>1,
'uid'=>0,
'start_time'=>$randomDateTime,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
... ...
... ... @@ -396,7 +396,6 @@ class KeywordLogic extends BaseLogic
preg_match_all('/\{[^{}]*\}/', $text, $matches);
$data = [];
$twoMonthsAgo = strtotime('-2 months');
if (!empty($text)) {
foreach ($matches[0] as $item) {
$item = str_replace("'", '"', $item);
... ...