|
|
|
1
|
+<?php
|
|
|
|
2
|
+/**
|
|
|
|
3
|
+ * @remark :
|
|
|
|
4
|
+ * @name :CommentController.php
|
|
|
|
5
|
+ * @author :lyh
|
|
|
|
6
|
+ * @method :post
|
|
|
|
7
|
+ * @time :2024/9/9 15:01
|
|
|
|
8
|
+ */
|
|
|
|
9
|
+
|
|
|
|
10
|
+namespace App\Http\Controllers\Bside\Comment;
|
|
|
|
11
|
+
|
|
|
|
12
|
+use App\Enums\Common\Code;
|
|
|
|
13
|
+use App\Http\Controllers\Bside\BaseController;
|
|
|
|
14
|
+use App\Models\Comment\Comment;
|
|
|
|
15
|
+
|
|
|
|
16
|
+class CommentController extends BaseController
|
|
|
|
17
|
+{
|
|
|
|
18
|
+ /**
|
|
|
|
19
|
+ * @remark :評論列表
|
|
|
|
20
|
+ * @name :lists
|
|
|
|
21
|
+ * @author :lyh
|
|
|
|
22
|
+ * @method :post
|
|
|
|
23
|
+ * @time :2024/9/9 15:02
|
|
|
|
24
|
+ */
|
|
|
|
25
|
+ public function lists(){
|
|
|
|
26
|
+ $commentModel = new Comment();
|
|
|
|
27
|
+ $lists = $commentModel->list();
|
|
|
|
28
|
+ $this->response('success',Code::SUCCESS,$lists);
|
|
|
|
29
|
+ }
|
|
|
|
30
|
+
|
|
|
|
31
|
+ /**
|
|
|
|
32
|
+ * @remark :获取详情
|
|
|
|
33
|
+ * @name :info
|
|
|
|
34
|
+ * @author :lyh
|
|
|
|
35
|
+ * @method :post
|
|
|
|
36
|
+ * @time :2024/9/9 17:13
|
|
|
|
37
|
+ */
|
|
|
|
38
|
+ public function info(){
|
|
|
|
39
|
+ $this->request->validate([
|
|
|
|
40
|
+ 'id' => 'required',
|
|
|
|
41
|
+ ], [
|
|
|
|
42
|
+ 'id.required' => '主鍵不能为空',
|
|
|
|
43
|
+ ]);
|
|
|
|
44
|
+ $commentModel = new Comment();
|
|
|
|
45
|
+ $info = $commentModel->read(['id'=>$this->param['id']]);
|
|
|
|
46
|
+ $this->response('success',Code::SUCCESS,$info);
|
|
|
|
47
|
+ }
|
|
|
|
48
|
+
|
|
|
|
49
|
+ /**
|
|
|
|
50
|
+ * @remark :修改審核狀態
|
|
|
|
51
|
+ * @name :status
|
|
|
|
52
|
+ * @author :lyh
|
|
|
|
53
|
+ * @method :post
|
|
|
|
54
|
+ * @time :2024/9/9 15:02
|
|
|
|
55
|
+ */
|
|
|
|
56
|
+ public function status(){
|
|
|
|
57
|
+ $this->request->validate([
|
|
|
|
58
|
+ 'id' => 'required',
|
|
|
|
59
|
+ 'status'=>'required',
|
|
|
|
60
|
+ ], [
|
|
|
|
61
|
+ 'id.required' => '主鍵不能为空',
|
|
|
|
62
|
+ 'status.required' => '审核状态不能为空',
|
|
|
|
63
|
+ ]);
|
|
|
|
64
|
+ $commentModel = new Comment();
|
|
|
|
65
|
+ $commentModel->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
|
|
|
|
66
|
+ $this->response('success');
|
|
|
|
67
|
+ }
|
|
|
|
68
|
+} |