InitKeywordCommon.php 1.3 KB
<?php
/**
 * @remark :
 * @name   :InitKeywordCommon.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 Illuminate\Console\Command;

class InitKeywordCommon extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'init_keyword_common';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '初始化关键字评论';



    public function handle(){
        return $this->_action();
        while (true){
            $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
        }

    }

    /**
     * @remark :执行的方法
     * @name   :_action
     * @author :lyh
     * @method :post
     * @time   :2025/6/3 15:42
     */
    public function _action(){
        $aiCommonModel = new AiCommand();
        $info = $aiCommonModel->read(['key'=>'tag_comment']);
        $text = Gpt::instance()->openai_chat_qqs($info['ai']);
        $text = Common::deal_keywords($text);
        dd($text);
        return Common::deal_str($text);
    }
}