1
0

ExternalConsultationController.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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\external;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\external\ExternalConsultationLists;
  17. use app\adminapi\logic\external\ExternalConsultationLogic;
  18. use app\adminapi\validate\external\ExternalConsultationValidate;
  19. /**
  20. * ExternalConsultation控制器
  21. * Class ExternalConsultationController
  22. * @package app\adminapi\controller
  23. */
  24. class ExternalConsultationController extends BaseAdminController
  25. {
  26. public array $notNeedLogin = ['order'];
  27. /**
  28. * @notes 获取列表
  29. * @return \think\response\Json
  30. * @author likeadmin
  31. * @date 2025/04/23 17:10
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new ExternalConsultationLists());
  36. }
  37. /**
  38. * @notes 添加
  39. * @return \think\response\Json
  40. * @author likeadmin
  41. * @date 2025/04/23 17:10
  42. */
  43. public function add()
  44. {
  45. $params = (new ExternalConsultationValidate())->post()->goCheck('add');
  46. $result = ExternalConsultationLogic::add($params);
  47. if (true === $result) {
  48. return $this->success('添加成功', [], 1, 1);
  49. }
  50. return $this->fail(ExternalConsultationLogic::getError());
  51. }
  52. /**
  53. * @notes 编辑
  54. * @return \think\response\Json
  55. * @author likeadmin
  56. * @date 2025/04/23 17:10
  57. */
  58. public function edit()
  59. {
  60. $params = (new ExternalConsultationValidate())->post()->goCheck('edit');
  61. $result = ExternalConsultationLogic::edit($params);
  62. if (true === $result) {
  63. return $this->success('编辑成功', [], 1, 1);
  64. }
  65. return $this->fail(ExternalConsultationLogic::getError());
  66. }
  67. public function order()
  68. {
  69. $params = (new ExternalConsultationValidate())->post()->goCheck('edit');
  70. $result = ExternalConsultationLogic::order($params);
  71. if (false === $result) {
  72. return $this->fail(ExternalConsultationLogic::getError());
  73. }
  74. return $this->success('下单成功', [], 1, 1);
  75. }
  76. public function followLog()
  77. {
  78. $params = (new ExternalConsultationValidate())->post()->goCheck('edit');
  79. $result = ExternalConsultationLogic::followLog($params);
  80. if (true === $result) {
  81. return $this->success('添加成功', [], 1, 1);
  82. }
  83. return $this->fail(ExternalConsultationLogic::getError());
  84. }
  85. /**
  86. * @notes 删除
  87. * @return \think\response\Json
  88. * @author likeadmin
  89. * @date 2025/04/23 17:10
  90. */
  91. public function delete()
  92. {
  93. $params = (new ExternalConsultationValidate())->post()->goCheck('delete');
  94. ExternalConsultationLogic::delete($params);
  95. return $this->success('删除成功', [], 1, 1);
  96. }
  97. /**
  98. * @notes 获取详情
  99. * @return \think\response\Json
  100. * @author likeadmin
  101. * @date 2025/04/23 17:10
  102. */
  103. public function detail()
  104. {
  105. $params = (new ExternalConsultationValidate())->goCheck('detail');
  106. $result = ExternalConsultationLogic::detail($params);
  107. return $this->data($result);
  108. }
  109. public function selectConsultationNotific()
  110. {
  111. $notific_count = ExternalConsultationLogic::selectCache();
  112. return $this->success('', ['type'=>'consultation','unique_code'=> md5($notific_count),'to_router'=>'/consumer/external_consultation','notific_count' => $notific_count], 1, 1);
  113. }
  114. }