KefuController.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\kefu;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\kefu\KefuLists;
  22. use app\adminapi\logic\kefu\KefuLogic;
  23. use app\adminapi\validate\kefu\KefuValidate;
  24. use app\adminapi\validate\kefu\LoginValidate;
  25. /**
  26. * 客服控制器
  27. * Class KefuController
  28. * @package app\adminapi\controller\kefu
  29. */
  30. class KefuController extends BaseAdminController
  31. {
  32. /**
  33. * @notes 获取客服列表
  34. * @return \think\response\Json
  35. * @author 段誉
  36. * @date 2022/3/8 18:52
  37. */
  38. public function lists()
  39. {
  40. return $this->dataLists(new KefuLists());
  41. }
  42. /**
  43. * @notes 添加客服
  44. * @return \think\response\Json
  45. * @author 段誉
  46. * @date 2022/3/8 18:53
  47. */
  48. public function add()
  49. {
  50. $params = (new KefuValidate())->post()->goCheck('add');
  51. (new KefuLogic())->add($params);
  52. return $this->success('添加成功',[],1,1);
  53. }
  54. /**
  55. * @notes 编辑客服
  56. * @return \think\response\Json
  57. * @author 段誉
  58. * @date 2022/3/8 18:53
  59. */
  60. public function edit()
  61. {
  62. $params = (new KefuValidate())->post()->goCheck('edit');
  63. KefuLogic::edit($params);
  64. return $this->success('编辑成功', [], 1, 1);
  65. }
  66. /**
  67. * @notes 删除客服
  68. * @return \think\response\Json
  69. * @author 段誉
  70. * @date 2022/3/8 18:53
  71. */
  72. public function del()
  73. {
  74. $params = (new KefuValidate())->post()->goCheck('del');
  75. KefuLogic::del($params['id']);
  76. return $this->success('删除成功', [], 1, 1);
  77. }
  78. /**
  79. * @notes 获取客服详情
  80. * @return \think\response\Json
  81. * @author 段誉
  82. * @date 2022/3/8 18:55
  83. */
  84. public function detail()
  85. {
  86. $params = (new KefuValidate())->goCheck('detail');
  87. $result = KefuLogic::detail($params['id']);
  88. return $this->success('获取成功', $result);
  89. }
  90. /**
  91. * @notes 设置状态
  92. * @return \think\response\Json
  93. * @author 段誉
  94. * @date 2022/3/8 18:53
  95. */
  96. public function status()
  97. {
  98. $params = (new KefuValidate())->post()->goCheck('status');
  99. KefuLogic::setStatus($params);
  100. return $this->success('设置成功', [], 1, 1);
  101. }
  102. /**
  103. * @notes 登录工作台
  104. * @return \think\response\Json|void
  105. * @author 段誉
  106. * @date 2022/3/18 16:31
  107. */
  108. public function login()
  109. {
  110. $params = (new LoginValidate())->post()->goCheck();
  111. $res = KefuLogic::login($params['id']);
  112. if (false === $res) {
  113. return $this->fail(KefuLogic::getError() ?: '系统错误');
  114. }
  115. return $this->success('', ['url' => $res]);
  116. }
  117. }