StoreServiceAutoReply.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * @author: 吴汐
  4. * @email: 442384644@qq.com
  5. * @date: 2023/8/3
  6. */
  7. namespace app\adminapi\controller\v1\kefu;
  8. use app\adminapi\controller\AuthController;
  9. use app\services\wechat\WechatReplyServices;
  10. class StoreServiceAutoReply extends AuthController
  11. {
  12. /**
  13. * @return \think\Response
  14. * @author: 吴汐
  15. * @email: 442384644@qq.com
  16. * @date: 2023/8/3
  17. */
  18. public function autoReplyList()
  19. {
  20. $where = $this->request->getMore([
  21. ['key', ''],
  22. ['type', ''],
  23. ]);
  24. $where['key_type'] = 1;
  25. $list = app()->make(WechatReplyServices::class)->getKeyAll($where);
  26. return app('json')->success($list);
  27. }
  28. /**
  29. * 获取自动回复表单
  30. * @param int $id
  31. * @return \think\Response
  32. * @throws \FormBuilder\Exception\FormBuilderException
  33. * @throws \think\db\exception\DataNotFoundException
  34. * @throws \think\db\exception\DbException
  35. * @throws \think\db\exception\ModelNotFoundException
  36. * @author: 吴汐
  37. * @email: 442384644@qq.com
  38. * @date: 2023/8/3
  39. */
  40. public function autoReplyForm($id = 0)
  41. {
  42. return app('json')->success(app()->make(WechatReplyServices::class)->autoReplyForm($id));
  43. }
  44. /**
  45. * 保存自动回复
  46. * @param int $id
  47. * @return \think\Response
  48. * @author: 吴汐
  49. * @email: 442384644@qq.com
  50. * @date: 2023/8/3
  51. */
  52. public function autoReplySave($id = 0)
  53. {
  54. $data = $this->request->postMore([
  55. ['keys', ''],
  56. ['type', ''],
  57. ['data', ''],
  58. ['status', 1],
  59. ]);
  60. app()->make(WechatReplyServices::class)->autoReplySave($id, $data);
  61. return app('json')->success(100000);
  62. }
  63. /**
  64. * 删除自动回复
  65. * @param $id
  66. * @return \think\Response
  67. * @author: 吴汐
  68. * @email: 442384644@qq.com
  69. * @date: 2023/8/3
  70. */
  71. public function autoReplyDel($id)
  72. {
  73. app()->make(WechatReplyServices::class)->autoReplyDel($id);
  74. return app('json')->success(100002);
  75. }
  76. }