作者 lyh

gx导入项目脚本

... ... @@ -318,6 +318,25 @@ class KeywordController extends BaseController
}
/**
* @remark :添加评论
* @name :saveComment
* @author :lyh
* @method :post
* @time :2025/6/9 14:27
*/
public function saveComment(KeywordLogic $logic){
$this->request->validate([
'text'=>'required',
'nickname'=>'required',
],[
'text.required' => '评论内容不能为空',
'nickname.required'=>'昵称不能为空',
]);
$data = $logic->saveComment();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :生成评论
* @name :sendComment
* @author :lyh
... ...
... ... @@ -349,6 +349,28 @@ class KeywordLogic extends BaseLogic
}
/**
* @remark :手动添加评论
* @name :saveComment
* @author :lyh
* @method :post
* @time :2025/6/9 14:29
*/
public function saveComment(){
$param = [
'nickname' => $this->param['nickname'],
'text' => $this->param['text'],
'project_id' => $this->user['project_id'],
'type' => 1,
'uid' => 0,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
$keywordCommonModel = new AggregateKeywordComment();
$id = $keywordCommonModel->addReturnId($param);
return $this->success(['id'=>$id]);
}
/**
* @remark :保存数据
* @name :sendComment
* @author :lyh
... ...
... ... @@ -330,6 +330,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('keyword/sendComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'sendComment'])->name('product_keyword_sendComment');
Route::any('keyword/getComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'getComment'])->name('product_keyword_getComment');
Route::any('keyword/delComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delComment'])->name('product_keyword_delComment');
Route::any('keyword/saveComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'saveComment'])->name('product_keyword_saveComment');
//产品参数
Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr');
Route::get('attr/info', [\App\Http\Controllers\Bside\Product\AttrController::class, 'info'])->name('product_attr_info');
... ...