| xqd
@@ -195,4 +195,53 @@ class InteractionController extends Controller
|
|
|
return $this->error(ErrorCode::OPERATION_FAILED);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @api {get} /api/comment/delete 删除评论
|
|
|
+ * @apiDescription 删除评论
|
|
|
+ * @apiGroup Interaction
|
|
|
+ * @apiParam {int} id 评论ID
|
|
|
+ * @apiPermission Passport
|
|
|
+ * @apiVersion 0.1.0
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
+ * {
|
|
|
+ * "status": true,
|
|
|
+ * "status_code": 0,
|
|
|
+ * "message": "",
|
|
|
+ * "data": ""
|
|
|
+ *}
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
+ * {
|
|
|
+ * "status": false,
|
|
|
+ * "status_code": 700,
|
|
|
+ * "message": "操作失败",
|
|
|
+ * "data": null
|
|
|
+ *}
|
|
|
+ * HTTP/1.1 400 Bad Request
|
|
|
+ */
|
|
|
+ public function delete(Request $request)
|
|
|
+ {
|
|
|
+ $validator = \Validator::make($request->all(),
|
|
|
+ [
|
|
|
+ 'id' => 'required',
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'id.required' => '评论ID不存在',
|
|
|
+ ]
|
|
|
+ );
|
|
|
+
|
|
|
+ if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
|
|
|
+
|
|
|
+ $user = $this->getUser();
|
|
|
+
|
|
|
+
|
|
|
+ $ok = CommentInfoModel::where('user_id',$user->id)->where('id',$request->id);
|
|
|
+
|
|
|
+ if ($ok) {
|
|
|
+ return $this->api('');
|
|
|
+ }else{
|
|
|
+ return $this->error(ErrorCode::OPERATION_FAILED);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|