正在显示
3 个修改的文件
包含
42 行增加
和
0 行删除
| @@ -318,6 +318,25 @@ class KeywordController extends BaseController | @@ -318,6 +318,25 @@ class KeywordController extends BaseController | ||
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | /** | 320 | /** |
| 321 | + * @remark :添加评论 | ||
| 322 | + * @name :saveComment | ||
| 323 | + * @author :lyh | ||
| 324 | + * @method :post | ||
| 325 | + * @time :2025/6/9 14:27 | ||
| 326 | + */ | ||
| 327 | + public function saveComment(KeywordLogic $logic){ | ||
| 328 | + $this->request->validate([ | ||
| 329 | + 'text'=>'required', | ||
| 330 | + 'nickname'=>'required', | ||
| 331 | + ],[ | ||
| 332 | + 'text.required' => '评论内容不能为空', | ||
| 333 | + 'nickname.required'=>'昵称不能为空', | ||
| 334 | + ]); | ||
| 335 | + $data = $logic->saveComment(); | ||
| 336 | + $this->response('success',Code::SUCCESS,$data); | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + /** | ||
| 321 | * @remark :生成评论 | 340 | * @remark :生成评论 |
| 322 | * @name :sendComment | 341 | * @name :sendComment |
| 323 | * @author :lyh | 342 | * @author :lyh |
| @@ -349,6 +349,28 @@ class KeywordLogic extends BaseLogic | @@ -349,6 +349,28 @@ class KeywordLogic extends BaseLogic | ||
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | /** | 351 | /** |
| 352 | + * @remark :手动添加评论 | ||
| 353 | + * @name :saveComment | ||
| 354 | + * @author :lyh | ||
| 355 | + * @method :post | ||
| 356 | + * @time :2025/6/9 14:29 | ||
| 357 | + */ | ||
| 358 | + public function saveComment(){ | ||
| 359 | + $param = [ | ||
| 360 | + 'nickname' => $this->param['nickname'], | ||
| 361 | + 'text' => $this->param['text'], | ||
| 362 | + 'project_id' => $this->user['project_id'], | ||
| 363 | + 'type' => 1, | ||
| 364 | + 'uid' => 0, | ||
| 365 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 366 | + 'updated_at' => date('Y-m-d H:i:s') | ||
| 367 | + ]; | ||
| 368 | + $keywordCommonModel = new AggregateKeywordComment(); | ||
| 369 | + $id = $keywordCommonModel->addReturnId($param); | ||
| 370 | + return $this->success(['id'=>$id]); | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + /** | ||
| 352 | * @remark :保存数据 | 374 | * @remark :保存数据 |
| 353 | * @name :sendComment | 375 | * @name :sendComment |
| 354 | * @author :lyh | 376 | * @author :lyh |
| @@ -330,6 +330,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -330,6 +330,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 330 | Route::any('keyword/sendComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'sendComment'])->name('product_keyword_sendComment'); | 330 | Route::any('keyword/sendComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'sendComment'])->name('product_keyword_sendComment'); |
| 331 | Route::any('keyword/getComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'getComment'])->name('product_keyword_getComment'); | 331 | Route::any('keyword/getComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'getComment'])->name('product_keyword_getComment'); |
| 332 | Route::any('keyword/delComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delComment'])->name('product_keyword_delComment'); | 332 | Route::any('keyword/delComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delComment'])->name('product_keyword_delComment'); |
| 333 | + Route::any('keyword/saveComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'saveComment'])->name('product_keyword_saveComment'); | ||
| 333 | //产品参数 | 334 | //产品参数 |
| 334 | Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr'); | 335 | Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr'); |
| 335 | Route::get('attr/info', [\App\Http\Controllers\Bside\Product\AttrController::class, 'info'])->name('product_attr_info'); | 336 | Route::get('attr/info', [\App\Http\Controllers\Bside\Product\AttrController::class, 'info'])->name('product_attr_info'); |
-
请 注册 或 登录 后发表评论