作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2086
... ... @@ -43,7 +43,8 @@ class RemainDay extends Command
1893,
2066,
2250,
2193
2193,
2399
];//需要单独处理的项目
/**
* The console command description.
... ...
<?php
/**
* @remark :
* @name :InitKeywordComment.php
* @author :lyh
* @method :post
* @time :2025/6/3 15:38
*/
namespace App\Console\Commands\Project;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Models\Ai\AiCommand;
use App\Models\Com\NoticeLog;
use App\Models\Project\AggregateKeywordComment;
use App\Models\Project\Project;
use Illuminate\Console\Command;
class InitKeywordComment extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'init_keyword_comment';
/**
* The console command description.
*
* @var string
*/
protected $description = '初始化关键字评论';
public $number = 100;
public function handle(){
return $this->_action(467);
while (true){
$list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
if(empty($list)){
sleep(200);
continue;
}
foreach ($list as $item){
echo date('Y-m-d H:i:s').'start:' . $item['id'] . PHP_EOL;
$project_id = $item['data']['project_id'];
echo date('Y-m-d H:i:s').'执行的项目id:' . $project_id . PHP_EOL;
try {
$this->_action($project_id);
$count = $keywordCommonModel->counts(['project_id'=>$project_id]);
if($count > 100){
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}
}catch (\Exception $e){
echo date('Y-m-d H:i:s').'错误信息:'.$e->getMessage().PHP_EOL;
continue;
}
echo date('Y-m-d H:i:s').'end:' . $item['id'] . PHP_EOL;
}
}
return true;
}
/**
* @remark :执行的方法
* @name :_action
* @author :lyh
* @method :post
* @time :2025/6/3 15:42
*/
public function _action($project_id){
$aiCommonModel = new AiCommand();
$info = $aiCommonModel->read(['key'=>'tag_comment']);
$text = Gpt::instance()->openai_chat_qqs($info['ai']);
$text = Common::deal_keywords($text);
preg_match_all('/\{[^{}]*\}/', $text, $matches);
if(!empty($text)){
$data = [];
foreach ($matches[0] as $item){
$item = str_replace("'", '"', $item);
// 解码成 PHP 关联数组
$item = json_decode($item, true);
if(!isset($item['name']) || !isset($item['comment'])){
continue;
}
$data[] = [
'nickname'=>$item['name'],
'text'=>$item['comment'],
'project_id'=>$project_id,
'type'=>1,
'uid'=>0,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
$keywordCommonModel = new AggregateKeywordComment();
$keywordCommonModel->insertAll($data);
}
return true;
}
}
... ...
... ... @@ -553,7 +553,7 @@ class RankDataLogic extends BaseLogic
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193];//暂停的项目
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193,2399];//暂停的项目
$uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
//一个项目多个api_no
$multiple_api_no_project_ids = [
... ...
... ... @@ -7,6 +7,7 @@ use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Helper\Common;
use App\Models\Domain\DomainInfo;
use App\Models\Manage\ManageHr;
use App\Models\Project\Project;
use App\Models\Scoring\ScoringSystem;
use App\Models\Sms\SmsLog;
... ... @@ -293,6 +294,8 @@ class UserLoginLogic
$info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0;
$info['is_ai_blog_send'] = $project['deploy_optimize']['is_ai_blog_send'] ?? 0;
$info['tech_leader'] = $project['deploy_optimize']['tech_leader'] ?? 0;
$manageModel = new ManageHr();
$info['tech_leader_name'] = $manageModel->getName($project['deploy_optimize']['tech_leader'] ?? 0);
$info['remain_day'] = $project['remain_day'] ?? 0;
$info['project_created_at'] = $project['created_at'];
$info['type'] = $project['type'] ?? 1;
... ...
... ... @@ -13,6 +13,7 @@ class NoticeLog extends Base
const TYPE_PROJECT = 'project';
const TYPE_RANK_DATA = 'rank_data';
const TYPE_INIT_PROJECT = 'init_project';
const TYPE_INIT_KEYWORD_COMMON = 'init_keyword_common';//聚合页关键词评论
const TYPE_COPY_PROJECT = 'copy_project';
const TYPE_INIT_KEYWORD = 'init_keyword';
const DELETE_PRODUCT_CATEGORY = 'delete_product_category';
... ...
<?php
/**
* @remark :
* @name :AggregateKeywordComment.php
* @author :lyh
* @method :post
* @time :2025/6/3 17:42
*/
namespace App\Models\Project;
use App\Models\Base;
class AggregateKeywordComment extends Base
{
protected $table = 'gl_aggregate_keyword_comment';
}
... ...