作者 李宇航

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

Lyh server



查看合并请求 !2086
@@ -43,7 +43,8 @@ class RemainDay extends Command @@ -43,7 +43,8 @@ class RemainDay extends Command
43 1893, 43 1893,
44 2066, 44 2066,
45 2250, 45 2250,
46 - 2193 46 + 2193,
  47 + 2399
47 ];//需要单独处理的项目 48 ];//需要单独处理的项目
48 /** 49 /**
49 * The console command description. 50 * The console command description.
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :InitKeywordComment.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/6/3 15:38
  8 + */
  9 +
  10 +namespace App\Console\Commands\Project;
  11 +
  12 +use App\Helper\Common;
  13 +use App\Helper\Gpt;
  14 +use App\Models\Ai\AiCommand;
  15 +use App\Models\Com\NoticeLog;
  16 +use App\Models\Project\AggregateKeywordComment;
  17 +use App\Models\Project\Project;
  18 +use Illuminate\Console\Command;
  19 +
  20 +class InitKeywordComment extends Command
  21 +{
  22 + /**
  23 + * The name and signature of the console command.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $signature = 'init_keyword_comment';
  28 +
  29 + /**
  30 + * The console command description.
  31 + *
  32 + * @var string
  33 + */
  34 + protected $description = '初始化关键字评论';
  35 +
  36 + public $number = 100;
  37 +
  38 + public function handle(){
  39 + return $this->_action(467);
  40 + while (true){
  41 + $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
  42 + if(empty($list)){
  43 + sleep(200);
  44 + continue;
  45 + }
  46 + foreach ($list as $item){
  47 + echo date('Y-m-d H:i:s').'start:' . $item['id'] . PHP_EOL;
  48 + $project_id = $item['data']['project_id'];
  49 + echo date('Y-m-d H:i:s').'执行的项目id:' . $project_id . PHP_EOL;
  50 + try {
  51 + $this->_action($project_id);
  52 + $count = $keywordCommonModel->counts(['project_id'=>$project_id]);
  53 + if($count > 100){
  54 + $item->status = NoticeLog::STATUS_SUCCESS;
  55 + $item->save();
  56 + }
  57 + }catch (\Exception $e){
  58 + echo date('Y-m-d H:i:s').'错误信息:'.$e->getMessage().PHP_EOL;
  59 + continue;
  60 + }
  61 + echo date('Y-m-d H:i:s').'end:' . $item['id'] . PHP_EOL;
  62 + }
  63 + }
  64 + return true;
  65 + }
  66 +
  67 + /**
  68 + * @remark :执行的方法
  69 + * @name :_action
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2025/6/3 15:42
  73 + */
  74 + public function _action($project_id){
  75 + $aiCommonModel = new AiCommand();
  76 + $info = $aiCommonModel->read(['key'=>'tag_comment']);
  77 + $text = Gpt::instance()->openai_chat_qqs($info['ai']);
  78 + $text = Common::deal_keywords($text);
  79 + preg_match_all('/\{[^{}]*\}/', $text, $matches);
  80 + if(!empty($text)){
  81 + $data = [];
  82 + foreach ($matches[0] as $item){
  83 + $item = str_replace("'", '"', $item);
  84 + // 解码成 PHP 关联数组
  85 + $item = json_decode($item, true);
  86 + if(!isset($item['name']) || !isset($item['comment'])){
  87 + continue;
  88 + }
  89 + $data[] = [
  90 + 'nickname'=>$item['name'],
  91 + 'text'=>$item['comment'],
  92 + 'project_id'=>$project_id,
  93 + 'type'=>1,
  94 + 'uid'=>0,
  95 + 'created_at'=>date('Y-m-d H:i:s'),
  96 + 'updated_at'=>date('Y-m-d H:i:s')
  97 + ];
  98 + }
  99 + $keywordCommonModel = new AggregateKeywordComment();
  100 + $keywordCommonModel->insertAll($data);
  101 + }
  102 + return true;
  103 + }
  104 +}
@@ -553,7 +553,7 @@ class RankDataLogic extends BaseLogic @@ -553,7 +553,7 @@ class RankDataLogic extends BaseLogic
553 $without_extension_project_ids = [658]; //是否达标只统计主词的 553 $without_extension_project_ids = [658]; //是否达标只统计主词的
554 $extension_project_ids = [354]; //扩展词也到达标的 554 $extension_project_ids = [354]; //扩展词也到达标的
555 $compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的 555 $compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的
556 - $ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193];//暂停的项目 556 + $ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193,2399];//暂停的项目
557 $uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目 557 $uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
558 //一个项目多个api_no 558 //一个项目多个api_no
559 $multiple_api_no_project_ids = [ 559 $multiple_api_no_project_ids = [
@@ -7,6 +7,7 @@ use App\Exceptions\AsideGlobalException; @@ -7,6 +7,7 @@ use App\Exceptions\AsideGlobalException;
7 use App\Exceptions\BsideGlobalException; 7 use App\Exceptions\BsideGlobalException;
8 use App\Helper\Common; 8 use App\Helper\Common;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
  10 +use App\Models\Manage\ManageHr;
10 use App\Models\Project\Project; 11 use App\Models\Project\Project;
11 use App\Models\Scoring\ScoringSystem; 12 use App\Models\Scoring\ScoringSystem;
12 use App\Models\Sms\SmsLog; 13 use App\Models\Sms\SmsLog;
@@ -293,6 +294,8 @@ class UserLoginLogic @@ -293,6 +294,8 @@ class UserLoginLogic
293 $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0; 294 $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0;
294 $info['is_ai_blog_send'] = $project['deploy_optimize']['is_ai_blog_send'] ?? 0; 295 $info['is_ai_blog_send'] = $project['deploy_optimize']['is_ai_blog_send'] ?? 0;
295 $info['tech_leader'] = $project['deploy_optimize']['tech_leader'] ?? 0; 296 $info['tech_leader'] = $project['deploy_optimize']['tech_leader'] ?? 0;
  297 + $manageModel = new ManageHr();
  298 + $info['tech_leader_name'] = $manageModel->getName($project['deploy_optimize']['tech_leader'] ?? 0);
296 $info['remain_day'] = $project['remain_day'] ?? 0; 299 $info['remain_day'] = $project['remain_day'] ?? 0;
297 $info['project_created_at'] = $project['created_at']; 300 $info['project_created_at'] = $project['created_at'];
298 $info['type'] = $project['type'] ?? 1; 301 $info['type'] = $project['type'] ?? 1;
@@ -13,6 +13,7 @@ class NoticeLog extends Base @@ -13,6 +13,7 @@ class NoticeLog extends Base
13 const TYPE_PROJECT = 'project'; 13 const TYPE_PROJECT = 'project';
14 const TYPE_RANK_DATA = 'rank_data'; 14 const TYPE_RANK_DATA = 'rank_data';
15 const TYPE_INIT_PROJECT = 'init_project'; 15 const TYPE_INIT_PROJECT = 'init_project';
  16 + const TYPE_INIT_KEYWORD_COMMON = 'init_keyword_common';//聚合页关键词评论
16 const TYPE_COPY_PROJECT = 'copy_project'; 17 const TYPE_COPY_PROJECT = 'copy_project';
17 const TYPE_INIT_KEYWORD = 'init_keyword'; 18 const TYPE_INIT_KEYWORD = 'init_keyword';
18 const DELETE_PRODUCT_CATEGORY = 'delete_product_category'; 19 const DELETE_PRODUCT_CATEGORY = 'delete_product_category';
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregateKeywordComment.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/6/3 17:42
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class AggregateKeywordComment extends Base
  15 +{
  16 + protected $table = 'gl_aggregate_keyword_comment';
  17 +}