正在显示
3 个修改的文件
包含
34 行增加
和
1 行删除
| @@ -65,4 +65,17 @@ class AiBlogController extends BaseController | @@ -65,4 +65,17 @@ class AiBlogController extends BaseController | ||
| 65 | $result = $aiBlogLogic->sendTask(); | 65 | $result = $aiBlogLogic->sendTask(); |
| 66 | $this->response('success',Code::SUCCESS,$result); | 66 | $this->response('success',Code::SUCCESS,$result); |
| 67 | } | 67 | } |
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * @remark :创建作者 | ||
| 71 | + * @name :createAuthor | ||
| 72 | + * @author :lyh | ||
| 73 | + * @method :post | ||
| 74 | + * @time :2025/2/20 10:45 | ||
| 75 | + */ | ||
| 76 | + public function createAuthor(AiBlogLogic $aiBlogLogic){ | ||
| 77 | + //获取当前项目的ai_blog设置 | ||
| 78 | + $result = $aiBlogLogic->createAuthor(); | ||
| 79 | + $this->response('success',Code::SUCCESS,$result); | ||
| 80 | + } | ||
| 68 | } | 81 | } |
| @@ -56,7 +56,6 @@ class AiBlogLogic extends BaseLogic | @@ -56,7 +56,6 @@ class AiBlogLogic extends BaseLogic | ||
| 56 | $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | 56 | $aiBlogService->mch_id = $aiSettingInfo['mch_id']; |
| 57 | $aiBlogService->key = $aiSettingInfo['key']; | 57 | $aiBlogService->key = $aiSettingInfo['key']; |
| 58 | $aiBlogService->route = generateRoute(Translate::tran($this->param['route'], 'en')); | 58 | $aiBlogService->route = generateRoute(Translate::tran($this->param['route'], 'en')); |
| 59 | - $aiBlogService->createAuthor(); | ||
| 60 | $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); | 59 | $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); |
| 61 | if($result['status'] == 200){ | 60 | if($result['status'] == 200){ |
| 62 | $aiBlogTaskModel = new AiBlogTask(); | 61 | $aiBlogTaskModel = new AiBlogTask(); |
| @@ -69,4 +68,24 @@ class AiBlogLogic extends BaseLogic | @@ -69,4 +68,24 @@ class AiBlogLogic extends BaseLogic | ||
| 69 | } | 68 | } |
| 70 | return $this->success(); | 69 | return $this->success(); |
| 71 | } | 70 | } |
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @remark :创建作者 | ||
| 74 | + * @name :createAuthor | ||
| 75 | + * @author :lyh | ||
| 76 | + * @method :post | ||
| 77 | + * @time :2025/2/20 10:46 | ||
| 78 | + */ | ||
| 79 | + public function createAuthor(){ | ||
| 80 | + $projectAiSettingModel = new ProjectAiSetting(); | ||
| 81 | + $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 82 | + if($aiSettingInfo === false){ | ||
| 83 | + $this->fail('请先联系管理员开启Ai博客'); | ||
| 84 | + } | ||
| 85 | + $aiBlogService = new AiBlogService(); | ||
| 86 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 87 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 88 | + $result = $aiBlogService->createAuthor(); | ||
| 89 | + return $this->success($result); | ||
| 90 | + } | ||
| 72 | } | 91 | } |
| @@ -156,6 +156,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -156,6 +156,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 156 | Route::any('/blog/getAiBlog', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'getAiBlog'])->name('ai_blog_getAiBlog'); | 156 | Route::any('/blog/getAiBlog', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'getAiBlog'])->name('ai_blog_getAiBlog'); |
| 157 | Route::any('/blog/save', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'save'])->name('ai_blog_save'); | 157 | Route::any('/blog/save', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'save'])->name('ai_blog_save'); |
| 158 | Route::any('/blog/sendTask', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'sendTask'])->name('ai_blog_sendTask'); | 158 | Route::any('/blog/sendTask', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'sendTask'])->name('ai_blog_sendTask'); |
| 159 | + Route::any('/blog/createAuthor', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'createAuthor'])->name('ai_blog_createAuthor'); | ||
| 159 | Route::any('/product/', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'save'])->name('ai_product_save'); | 160 | Route::any('/product/', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'save'])->name('ai_product_save'); |
| 160 | Route::any('/product/productList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productList'])->name('ai_product_productList'); | 161 | Route::any('/product/productList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productList'])->name('ai_product_productList'); |
| 161 | Route::any('/product/productCateList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productCateList'])->name('ai_product_productCateList'); | 162 | Route::any('/product/productCateList', [\App\Http\Controllers\Bside\Ai\AiProductController::class, 'productCateList'])->name('ai_product_productCateList'); |
-
请 注册 或 登录 后发表评论