StoreProductReply.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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\store\product;
  12. use app\controller\store\AuthController;
  13. use app\services\product\product\StoreProductReplyServices;
  14. use think\facade\App;
  15. /**
  16. * 评论管理 控制器
  17. * Class StoreProductReply
  18. * @package app\controller\store\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'] = 1;
  42. $where['relation_id'] = $this->storeId;
  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. $store_id = $this->storeId;
  67. $this->services->setReply((int)$id, $content, 1, (int)$store_id);
  68. return $this->success('回复成功!');
  69. }
  70. }