quanwei
2025-11-03 ef5d748e3e3331bd20d4065c33e7867c2637d1db
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
<?php
 
namespace app\supplier\controller\product;
 
use app\supplier\controller\Controller;
use app\supplier\model\product\Comment as CommentModel;
 
/**
 * 商品评价控制器
 */
class Comment extends Controller
{
    /**
     * 评价列表
     */
    public function index()
    {
        $model = new CommentModel;
        //列表
        $list = $model->getList(array_merge(['shop_supplier_id' => $this->getSupplierId()], $this->postData()));
        //重要数据
        $num = $model->getStatusNum(['shop_supplier_id' => $this->getSupplierId(), 'status' => 0]);
        return $this->renderSuccess('', compact('list','num'));
    }
 
    /**
     * 评价详情
     */
    public function detail($comment_id)
    {
        // 评价详情
        $model = new CommentModel();
        $data = $model->detail($comment_id);
        return $this->renderSuccess('', compact('data'));
    }
 
    /**
     * 更新商品评论
     */
    public function edit()
    {
        $model = new CommentModel();
        // 更新记录
        if ($model->edit($this->postData())) {
            return $this->renderSuccess('修改成功');
        }
    }
 
    /**
     * 删除评价
     */
    public function delete($comment_id)
    {
        $model = new CommentModel();
        if (!$model->setDelete($comment_id)) {
            return $this->renderError('删除失败');
        }
        return $this->renderSuccess('删除成功');
    }
 
}