OfficialAccountReplyController.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\channel;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\channel\OfficialAccountReplyLists;
  17. use app\adminapi\logic\channel\OfficialAccountReplyLogic;
  18. use app\adminapi\validate\channel\OfficialAccountReplyValidate;
  19. /**
  20. * 微信公众号回复控制器
  21. * Class OfficialAccountReplyController
  22. * @package app\adminapi\controller\channel
  23. */
  24. class OfficialAccountReplyController extends BaseAdminController
  25. {
  26. public array $notNeedLogin = ['index'];
  27. /**
  28. * @notes 查看回复列表(关注/关键词/默认)
  29. * @return \think\response\Json
  30. * @author 段誉
  31. * @date 2022/3/29 10:58
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new OfficialAccountReplyLists());
  36. }
  37. /**
  38. * @notes 添加回复(关注/关键词/默认)
  39. * @return \think\response\Json
  40. * @author 段誉
  41. * @date 2022/3/29 10:58
  42. */
  43. public function add()
  44. {
  45. $params = (new OfficialAccountReplyValidate())->post()->goCheck('add');
  46. $result = OfficialAccountReplyLogic::add($params);
  47. if ($result) {
  48. return $this->success('操作成功', [], 1, 1);
  49. }
  50. return $this->fail(OfficialAccountReplyLogic::getError());
  51. }
  52. /**
  53. * @notes 查看回复详情
  54. * @return \think\response\Json
  55. * @author 段誉
  56. * @date 2022/3/29 10:58
  57. */
  58. public function detail()
  59. {
  60. $params = (new OfficialAccountReplyValidate())->goCheck('detail');
  61. $result = OfficialAccountReplyLogic::detail($params);
  62. return $this->data($result);
  63. }
  64. /**
  65. * @notes 编辑回复(关注/关键词/默认)
  66. * @return \think\response\Json
  67. * @author 段誉
  68. * @date 2022/3/29 10:58
  69. */
  70. public function edit()
  71. {
  72. $params = (new OfficialAccountReplyValidate())->post()->goCheck('edit');
  73. $result = OfficialAccountReplyLogic::edit($params);
  74. if ($result) {
  75. return $this->success('操作成功', [], 1, 1);
  76. }
  77. return $this->fail(OfficialAccountReplyLogic::getError());
  78. }
  79. /**
  80. * @notes 删除回复(关注/关键词/默认)
  81. * @return \think\response\Json
  82. * @author 段誉
  83. * @date 2022/3/29 10:59
  84. */
  85. public function delete()
  86. {
  87. $params = (new OfficialAccountReplyValidate())->post()->goCheck('delete');
  88. OfficialAccountReplyLogic::delete($params);
  89. return $this->success('操作成功', [], 1, 1);
  90. }
  91. /**
  92. * @notes 更新排序
  93. * @return \think\response\Json
  94. * @author 段誉
  95. * @date 2022/3/29 10:59
  96. */
  97. public function sort()
  98. {
  99. $params = (new OfficialAccountReplyValidate())->post()->goCheck('sort');
  100. OfficialAccountReplyLogic::sort($params);
  101. return $this->success('操作成功', [], 1, 1);
  102. }
  103. /**
  104. * @notes 更新状态
  105. * @return \think\response\Json
  106. * @author 段誉
  107. * @date 2022/3/29 10:59
  108. */
  109. public function status()
  110. {
  111. $params = (new OfficialAccountReplyValidate())->post()->goCheck('status');
  112. OfficialAccountReplyLogic::status($params);
  113. return $this->success('操作成功', [], 1, 1);
  114. }
  115. /**
  116. * @notes 微信公众号回调
  117. * @throws \ReflectionException
  118. * @author 段誉
  119. * @date 2022/3/29 10:59
  120. */
  121. public function index()
  122. {
  123. $result = OfficialAccountReplyLogic::index();
  124. return response($result->getBody())->header([
  125. 'Content-Type' => 'text/plain;charset=utf-8'
  126. ]);
  127. }
  128. }