作者 lyh

gx生成评论

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :InitKeywordCommon.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\Http\Logic\Bside\Ai\AiCommandLogic;
  15 +use App\Models\Ai\AiCommand;
  16 +use App\Models\Com\NoticeLog;
  17 +use Illuminate\Console\Command;
  18 +
  19 +class InitKeywordCommon extends Command
  20 +{
  21 + /**
  22 + * The name and signature of the console command.
  23 + *
  24 + * @var string
  25 + */
  26 + protected $signature = 'init_keyword_common';
  27 +
  28 + /**
  29 + * The console command description.
  30 + *
  31 + * @var string
  32 + */
  33 + protected $description = '初始化关键字评论';
  34 +
  35 +
  36 +
  37 + public function handle(){
  38 + return $this->_action();
  39 + while (true){
  40 + $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
  41 + }
  42 +
  43 + }
  44 +
  45 + /**
  46 + * @remark :执行的方法
  47 + * @name :_action
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2025/6/3 15:42
  51 + */
  52 + public function _action(){
  53 + $aiCommonModel = new AiCommand();
  54 + $info = $aiCommonModel->read(['key'=>'tag_comment']);
  55 + $text = Gpt::instance()->openai_chat_qqs($info['ai']);
  56 + $text = Common::deal_keywords($text);
  57 + dd($text);
  58 + return Common::deal_str($text);
  59 + }
  60 +}
@@ -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';