Comment.php 638 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\model\Comment as CommentModel;
  4. /**
  5. * 商品评价控制器
  6. * Class Comment
  7. * @package app\api\controller
  8. */
  9. class Comment extends Controller
  10. {
  11. /**
  12. * 商品评价列表
  13. * @param $goods_id
  14. * @param int $scoreType
  15. * @return array
  16. * @throws \think\exception\DbException
  17. */
  18. public function lists($goods_id, $scoreType = -1)
  19. {
  20. $model = new CommentModel;
  21. $list = $model->getGoodsCommentList($goods_id, $scoreType);
  22. $total = $model->getTotal($goods_id);
  23. return $this->renderSuccess(compact('list', 'total'));
  24. }
  25. }