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