Reply.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\wechat;
  12. use app\service\admin\wechat\WechatReplyService;
  13. use core\base\BaseAdminController;
  14. use think\Response;
  15. /**
  16. * 微信公众号管理回复
  17. */
  18. class Reply extends BaseAdminController
  19. {
  20. /**
  21. * 关键词回复
  22. * @return Response
  23. */
  24. public function keyword($id)
  25. {
  26. $wechat_reply_service = new WechatReplyService();
  27. return success($wechat_reply_service->getKeywordInfo($id));
  28. }
  29. public function getKeywordLists()
  30. {
  31. $data = $this->request->params([
  32. ['keyword', ''],
  33. ['name', '']
  34. ]);
  35. $wechat_reply_service = new WechatReplyService();
  36. return success($wechat_reply_service->getKeywordPage($data));
  37. }
  38. /**
  39. * 新增关键词回复
  40. * @return Response
  41. */
  42. public function addKeyword()
  43. {
  44. $wechat_reply_service = new WechatReplyService();
  45. $data = $this->request->params([
  46. ['name', ''],
  47. ['keyword', ''],
  48. ['matching_type', '', false],
  49. ['reply_method', ''],
  50. ['content', ''],
  51. ['sort', ''],
  52. ]);
  53. $wechat_reply_service->addKeyword($data);
  54. return success('ADD_SUCCESS');
  55. }
  56. /**
  57. * 更新关键词回复
  58. * @return Response
  59. */
  60. public function editKeyword($id)
  61. {
  62. $wechat_reply_service = new WechatReplyService();
  63. $data = $this->request->params([
  64. ['name', ''],
  65. ['keyword', ''],
  66. ['matching_type', '', false],
  67. ['reply_method', ''],
  68. ['content', ''],
  69. ['sort', ''],
  70. ]);
  71. $wechat_reply_service->editKeyword($id, $data);
  72. return success('EDIT_SUCCESS');
  73. }
  74. /**
  75. * 删除关键字回复
  76. * @return Response
  77. */
  78. public function delKeyword($id)
  79. {
  80. $wechat_reply_service = new WechatReplyService();
  81. $wechat_reply_service->delKeyword($id);
  82. return success('DELETE_FAIL');
  83. }
  84. /**
  85. * 获取默认回复
  86. * @return Response
  87. */
  88. public function default()
  89. {
  90. $wechat_reply_service = new WechatReplyService();
  91. return success($wechat_reply_service->getDefault());
  92. }
  93. /**
  94. * 更新默认回复
  95. * @return Response
  96. */
  97. public function editDefault()
  98. {
  99. $data = $this->request->params([
  100. ['content', ''],
  101. ]);
  102. $wechat_reply_service = new WechatReplyService();
  103. $wechat_reply_service->editDefault($data);
  104. return success('SET_SUCCESS');
  105. }
  106. /**
  107. * 获取关注回复
  108. * @return Response
  109. */
  110. public function subscribe()
  111. {
  112. $wechat_reply_service = new WechatReplyService();
  113. return success($wechat_reply_service->getSubscribe());
  114. }
  115. /**
  116. * 更新关注回复
  117. * @return Response
  118. */
  119. public function editSubscribe()
  120. {
  121. $data = $this->request->params([
  122. ['content', ''],
  123. ]);
  124. $wechat_reply_service = new WechatReplyService();
  125. $wechat_reply_service->editSubscribe($data);
  126. return success('SET_SUCCESS');
  127. }
  128. }