|
...
|
...
|
@@ -11,6 +11,7 @@ namespace App\Console\Commands\AiBlog; |
|
|
|
|
|
|
|
use App\Models\Ai\AiBlog;
|
|
|
|
use App\Models\Ai\AiBlogAuthor;
|
|
|
|
use App\Models\Ai\AiBlogList;
|
|
|
|
use App\Models\Project\ProjectAiSetting;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Services\AiBlogService;
|
|
...
|
...
|
@@ -51,13 +52,34 @@ class AiBlogListTask extends Command |
|
|
|
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
$aiBlogService->key = $aiSettingInfo['key'];
|
|
|
|
$page = 1;
|
|
|
|
$saveData = [];
|
|
|
|
$result = $aiBlogService->getAiBlogList($page,15);
|
|
|
|
if(!isset($result['status'])){
|
|
|
|
if(!isset($result['status']) && $result['status'] != 200){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$total_page = $result['data']['total_page'];
|
|
|
|
//组装数据保存
|
|
|
|
$saveData[] = [
|
|
|
|
'route'=>$page,
|
|
|
|
'text'=>$result['section'],
|
|
|
|
];
|
|
|
|
while ($total_page > $page){
|
|
|
|
$page++;
|
|
|
|
$result = $aiBlogService->getAiBlogList($page,15);
|
|
|
|
if(isset($result['status']) && $result['status'] == 200){
|
|
|
|
$saveData[] = [
|
|
|
|
'route'=>$page,
|
|
|
|
'text'=>$result['section'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//保存当前项目ai_blog数据
|
|
|
|
ProjectServer::useProject($v['project_id']);
|
|
|
|
|
|
|
|
$aiBlogListModel = new AiBlogList();
|
|
|
|
if(!empty($saveData)){
|
|
|
|
$aiBlogListModel->truncate();
|
|
|
|
$aiBlogListModel->insertAll($saveData);
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
//修改任务状态
|
|
|
|
$aiBlogTaskModel->edit(['status'=>2],['id'=>$v['id']]);
|
...
|
...
|
|