作者 赵彬吉
... ... @@ -58,7 +58,7 @@ class AiBlogTask extends Command
continue;
}
if($result['status'] != 200){
sleep(10);
sleep(300);
continue;
}
//修改任务状态
... ...
... ... @@ -170,7 +170,7 @@ class ProjectController extends BaseController
if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){
$query->where('gl_project.type', $this->map['type']);
} elseif ($this->map['type'] == 8){
$query->where('gl_project.online_check_id', null)->where('gl_project.type',Project::TYPE_TWO);
$query->where('gl_project_online_check.id', null)->where('gl_project.type',Project::TYPE_TWO);
}else{
$query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
}
... ...
... ... @@ -65,4 +65,17 @@ class AiBlogController extends BaseController
$result = $aiBlogLogic->sendTask();
$this->response('success',Code::SUCCESS,$result);
}
/**
* @remark :创建作者
* @name :createAuthor
* @author :lyh
* @method :post
* @time :2025/2/20 10:45
*/
public function createAuthor(AiBlogLogic $aiBlogLogic){
//获取当前项目的ai_blog设置
$result = $aiBlogLogic->createAuthor();
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
... ... @@ -68,4 +68,24 @@ class AiBlogLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :创建作者
* @name :createAuthor
* @author :lyh
* @method :post
* @time :2025/2/20 10:46
*/
public function createAuthor(){
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$this->user['project_id']]);
if($aiSettingInfo === false){
$this->fail('请先联系管理员开启Ai博客');
}
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$result = $aiBlogService->createAuthor();
return $this->success($result);
}
}
... ...
... ... @@ -96,8 +96,9 @@ class AiBlogService
$request_url = $this->url.'api/author/create';
$param = [
'mch_id'=>$this->mch_id,
'sign'=>$this->sign,
];
$this->sign = $this->generateSign($param,$this->key);
$param['sign'] = $this->sign;
$result = http_post($request_url,json_encode($param,true));
return $result;
}
... ...
... ... @@ -156,6 +156,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/blog/getAiBlog', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'getAiBlog'])->name('ai_blog_getAiBlog');
Route::any('/blog/save', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'save'])->name('ai_blog_save');
Route::any('/blog/sendTask', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'sendTask'])->name('ai_blog_sendTask');
Route::any('/blog/createAuthor', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'createAuthor'])->name('ai_blog_createAuthor');
Route::any('/product/', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'save'])->name('ai_product_save');
Route::any('/product/productList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productList'])->name('ai_product_productList');
Route::any('/product/productCateList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productCateList'])->name('ai_product_productCateList');
... ...