StoreProductReply.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\supplier\product;
  12. use app\controller\supplier\AuthController;
  13. use app\services\product\product\StoreProductReplyServices;
  14. use think\facade\App;
  15. /**
  16. * 评论管理 控制器
  17. * Class StoreProductReply
  18. * @package app\controller\supplier\product
  19. */
  20. class StoreProductReply extends AuthController
  21. {
  22. public function __construct(App $app, StoreProductReplyServices $service)
  23. {
  24. parent::__construct($app);
  25. $this->services = $service;
  26. }
  27. /**
  28. * 显示资源列表
  29. *
  30. * @return \think\Response
  31. */
  32. public function index()
  33. {
  34. $where = $this->request->getMore([
  35. ['is_reply', ''],
  36. ['store_name', ''],
  37. ['account', ''],
  38. ['data', ''],
  39. ['product_id', 0]
  40. ]);
  41. $where['type'] = 2;
  42. $where['relation_id'] = $this->supplierId;
  43. $list = $this->services->sysPage($where);
  44. return $this->success($list);
  45. }
  46. /**
  47. * 删除评论
  48. * @param $id
  49. * @return mixed
  50. */
  51. public function delete($id)
  52. {
  53. $this->services->del($id);
  54. return $this->success('删除成功!');
  55. }
  56. /**
  57. * 回复评论
  58. * @param $id
  59. * @return mixed
  60. */
  61. public function set_reply($id)
  62. {
  63. [$content] = $this->request->postMore([
  64. ['content', '']
  65. ], true);
  66. $this->services->setReply((int)$id, $content, 2, (int)$this->supplierId);
  67. return $this->success('回复成功!');
  68. }
  69. }