GoodsCommentController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\shopapi\controller;
  20. use app\shopapi\lists\CommentGoodsLists;
  21. use app\shopapi\lists\GoodsCommentLists;
  22. use app\shopapi\logic\GoodsCommentLogic;
  23. use app\shopapi\validate\GoodsCommentValidate;
  24. class GoodsCommentController extends BaseShopController
  25. {
  26. /**
  27. * @notes 添加商品评价
  28. * @return \think\response\Json
  29. * @author ljj
  30. * @date 2021/8/6 8:15 下午
  31. */
  32. public function add()
  33. {
  34. $params = (new GoodsCommentValidate())->post()->goCheck('add', ['user_id' => $this->userId]);
  35. $result = (new GoodsCommentLogic())->add($params);
  36. if (false === $result) {
  37. return $this->fail(GoodsCommentLogic::getError());
  38. }
  39. return $this->success('添加成功',[],1,1);
  40. }
  41. /**
  42. * @notes 查看商品评价分类
  43. * @return \think\response\Json
  44. * @author ljj
  45. * @date 2021/8/6 9:04 下午
  46. */
  47. public function commentCategory()
  48. {
  49. $params = (new GoodsCommentValidate())->goCheck('CommentCategory');
  50. $result = (new GoodsCommentLogic())->commentCategory($params);
  51. return $this->success('',$result);
  52. }
  53. /**
  54. * @notes 查看评论列表
  55. * @return \think\response\Json
  56. * @author ljj
  57. * @date 2021/8/9 10:25 上午
  58. */
  59. public function lists()
  60. {
  61. return $this->dataLists(new GoodsCommentLists());
  62. }
  63. /**
  64. * @notes 评价商品列表
  65. * @return \think\response\Json
  66. * @author ljj
  67. * @date 2021/8/9 2:45 下午
  68. */
  69. public function commentGoodsLists()
  70. {
  71. return $this->dataLists(new CommentGoodsLists());
  72. }
  73. /**
  74. * @notes 查看评价商品信息
  75. * @return \think\response\Json
  76. * @throws \think\db\exception\DataNotFoundException
  77. * @throws \think\db\exception\DbException
  78. * @throws \think\db\exception\ModelNotFoundException
  79. * @author ljj
  80. * @date 2021/8/9 3:12 下午
  81. */
  82. public function commentGoodsInfo()
  83. {
  84. $params = (new GoodsCommentValidate())->goCheck('CommentGoodsInfo');
  85. $result = (new GoodsCommentLogic())->commentGoodsInfo($params);
  86. return $this->success('',$result);
  87. }
  88. }