GoodsCommentLogic.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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\adminapi\logic\goods;
  20. use app\common\logic\BaseLogic;
  21. use app\common\model\GoodsComment;
  22. class GoodsCommentLogic extends BaseLogic
  23. {
  24. /**
  25. * @notes 商家回复
  26. * @param $params
  27. * @return bool
  28. * @throws \think\db\exception\DataNotFoundException
  29. * @throws \think\db\exception\DbException
  30. * @throws \think\db\exception\ModelNotFoundException
  31. * @author ljj
  32. * @date 2021/8/12 5:26 下午
  33. */
  34. public function reply($params)
  35. {
  36. $data = [];
  37. foreach ($params['id'] as $id) {
  38. $data[] = [
  39. 'id' => $id,
  40. 'reply' => $params['reply'],
  41. ];
  42. }
  43. $goods_comment = new GoodsComment;
  44. $goods_comment->saveAll($data);
  45. return true;
  46. }
  47. /**
  48. * @notes 删除评价
  49. * @param $params
  50. * @return bool
  51. * @author ljj
  52. * @date 2021/9/9 11:20 上午
  53. */
  54. public function del($params)
  55. {
  56. return GoodsComment::destroy($params['id']);
  57. }
  58. /**
  59. * @notes 修改评价审核状态
  60. * @param $params
  61. * @return bool
  62. * @throws \think\db\exception\DataNotFoundException
  63. * @throws \think\db\exception\DbException
  64. * @throws \think\db\exception\ModelNotFoundException
  65. * @author ljj
  66. * @date 2021/9/9 2:41 下午
  67. */
  68. public function status($params)
  69. {
  70. $data = [];
  71. foreach ($params['id'] as $id) {
  72. $data[] = [
  73. 'id' => $id,
  74. 'status' => $params['status'],
  75. ];
  76. }
  77. $goods_comment = new GoodsComment;
  78. $goods_comment->saveAll($data);
  79. return true;
  80. }
  81. }