正在显示
1 个修改的文件
包含
14 行增加
和
2 行删除
| @@ -14,6 +14,7 @@ use App\Helper\Gpt; | @@ -14,6 +14,7 @@ use App\Helper\Gpt; | ||
| 14 | use App\Models\Ai\AiCommand; | 14 | use App\Models\Ai\AiCommand; |
| 15 | use App\Models\Com\NoticeLog; | 15 | use App\Models\Com\NoticeLog; |
| 16 | use App\Models\Project\AggregateKeywordComment; | 16 | use App\Models\Project\AggregateKeywordComment; |
| 17 | +use App\Models\Project\Project; | ||
| 17 | use Illuminate\Console\Command; | 18 | use Illuminate\Console\Command; |
| 18 | 19 | ||
| 19 | class InitKeywordComment extends Command | 20 | class InitKeywordComment extends Command |
| @@ -38,8 +39,19 @@ class InitKeywordComment extends Command | @@ -38,8 +39,19 @@ class InitKeywordComment extends Command | ||
| 38 | return $this->_action(467); | 39 | return $this->_action(467); |
| 39 | while (true){ | 40 | while (true){ |
| 40 | $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get(); | 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 | + $this->_action($project_id); | ||
| 51 | + echo date('Y-m-d H:i:s').'end:' . $item['id'] . PHP_EOL; | ||
| 52 | + } | ||
| 41 | } | 53 | } |
| 42 | - | 54 | + return true; |
| 43 | } | 55 | } |
| 44 | 56 | ||
| 45 | /** | 57 | /** |
| @@ -54,8 +66,8 @@ class InitKeywordComment extends Command | @@ -54,8 +66,8 @@ class InitKeywordComment extends Command | ||
| 54 | $info = $aiCommonModel->read(['key'=>'tag_comment']); | 66 | $info = $aiCommonModel->read(['key'=>'tag_comment']); |
| 55 | $text = Gpt::instance()->openai_chat_qqs($info['ai']); | 67 | $text = Gpt::instance()->openai_chat_qqs($info['ai']); |
| 56 | $text = Common::deal_keywords($text); | 68 | $text = Common::deal_keywords($text); |
| 57 | - dd($text); | ||
| 58 | preg_match_all('/\{[^{}]*\}/', $text, $matches); | 69 | preg_match_all('/\{[^{}]*\}/', $text, $matches); |
| 70 | + dd($matches[0]); | ||
| 59 | if(!empty($text)){ | 71 | if(!empty($text)){ |
| 60 | $data = []; | 72 | $data = []; |
| 61 | foreach ($matches[0] as $item){ | 73 | foreach ($matches[0] as $item){ |
-
请 注册 或 登录 后发表评论