StoreServiceAutoReply.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. /**
  12. * @author: 吴汐
  13. * @email: 442384644@qq.com
  14. * @date: 2023/8/3
  15. */
  16. namespace app\adminapi\controller\v1\kefu;
  17. use app\adminapi\controller\AuthController;
  18. use app\services\wechat\WechatReplyServices;
  19. class StoreServiceAutoReply extends AuthController
  20. {
  21. /**
  22. * @return \think\Response
  23. * @author: 吴汐
  24. * @email: 442384644@qq.com
  25. * @date: 2023/8/3
  26. */
  27. public function autoReplyList()
  28. {
  29. $where = $this->request->getMore([
  30. ['key', ''],
  31. ['type', ''],
  32. ]);
  33. $where['key_type'] = 1;
  34. $list = app()->make(WechatReplyServices::class)->getKeyAll($where);
  35. return app('json')->success($list);
  36. }
  37. /**
  38. * 获取自动回复表单
  39. * @param int $id
  40. * @return \think\Response
  41. * @throws \FormBuilder\Exception\FormBuilderException
  42. * @throws \think\db\exception\DataNotFoundException
  43. * @throws \think\db\exception\DbException
  44. * @throws \think\db\exception\ModelNotFoundException
  45. * @author: 吴汐
  46. * @email: 442384644@qq.com
  47. * @date: 2023/8/3
  48. */
  49. public function autoReplyForm($id = 0)
  50. {
  51. return app('json')->success(app()->make(WechatReplyServices::class)->autoReplyForm($id));
  52. }
  53. /**
  54. * 保存自动回复
  55. * @param int $id
  56. * @return \think\Response
  57. * @author: 吴汐
  58. * @email: 442384644@qq.com
  59. * @date: 2023/8/3
  60. */
  61. public function autoReplySave($id = 0)
  62. {
  63. $data = $this->request->postMore([
  64. ['keys', ''],
  65. ['type', ''],
  66. ['data', ''],
  67. ['status', 1],
  68. ]);
  69. app()->make(WechatReplyServices::class)->autoReplySave($id, $data);
  70. return app('json')->success('保存成功');
  71. }
  72. /**
  73. * 删除自动回复
  74. * @param $id
  75. * @return \think\Response
  76. * @author: 吴汐
  77. * @email: 442384644@qq.com
  78. * @date: 2023/8/3
  79. */
  80. public function autoReplyDel($id)
  81. {
  82. app()->make(WechatReplyServices::class)->autoReplyDel($id);
  83. return app('json')->success('删除成功');
  84. }
  85. }