CustomController.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. namespace app\wechat\controller;
  3. use app\wechat\IndexController;
  4. use app\wechat\service\CustomService;
  5. use app\wechat\validate\CustomValidate;
  6. use support\Request;
  7. class CustomController extends IndexController
  8. {
  9. public function __construct()
  10. {
  11. $this->validateClass = new CustomValidate();
  12. }
  13. /**
  14. * Notes: 选项配置
  15. * User: yb
  16. * Date: 2024/8/8
  17. * Time: 15:08
  18. * @return \support\Response
  19. */
  20. public function options()
  21. {
  22. return json_success('请求成功', CustomService::config());
  23. }
  24. /**
  25. * Notes:新增客户
  26. * User: yb
  27. * Date: 2024/8/8
  28. * Time: 15:08
  29. */
  30. public function addCustom(Request $request)
  31. {
  32. $params = $request->post();
  33. if (!$this->validateClass->scene('add')->check($params)) {
  34. return json_fail($this->validateClass->getError());
  35. }
  36. return CustomService::add($params);
  37. }
  38. /**
  39. * Notes: 客户列表
  40. * User: yb
  41. * Date: 2024/8/12
  42. * Time: 10:57
  43. */
  44. public function customList(Request $request)
  45. {
  46. $params = $request->post();
  47. return CustomService::index($params);
  48. }
  49. /**
  50. * Notes: 编辑客户
  51. * User: yb
  52. * Date: 2024/8/12
  53. * Time: 10:36
  54. * @param Request $request
  55. */
  56. public function editCustom(Request $request)
  57. {
  58. $params = $request->post();
  59. if (!$this->validateClass->scene('update')->check($params)) {
  60. return json_fail($this->validateClass->getError());
  61. }
  62. return CustomService::edit($params);
  63. }
  64. /**
  65. * Notes: 客户详情
  66. * User: yb
  67. * Date: 2024/8/8
  68. * Time: 15:48
  69. */
  70. public function customInfo(Request $request)
  71. {
  72. $params = $request->post();
  73. if (empty($params['id'])) {
  74. return json_fail('客户id不能为空');
  75. }
  76. return CustomService::info($params['id']);
  77. }
  78. /**
  79. * Notes: 选择客户
  80. * User: yb
  81. * Date: 2024/8/13
  82. * Time: 15:20
  83. * @param Request $request
  84. */
  85. public function selectList(Request $request)
  86. {
  87. $params = $request->post();
  88. return CustomService::myCustomList($params);
  89. }
  90. /**
  91. * Notes: 更新客户状态
  92. * User: yb
  93. * Date: 2024/8/14
  94. * Time: 13:21
  95. * @param Request $request
  96. */
  97. public function updateStatus(Request $request)
  98. {
  99. $params = $request->post();
  100. if (!$this->validateClass->scene('status')->check($params)) {
  101. return json_fail($this->validateClass->getError());
  102. }
  103. return CustomService::updateStatus($params);
  104. }
  105. /**
  106. * Notes: 移交客户
  107. * User: yb
  108. * Date: 2024/8/15
  109. * Time: 14:36
  110. * @param Request $request
  111. */
  112. public function moveCustom(Request $request)
  113. {
  114. $params = $request->post();
  115. if (empty($params['consultant_id'])) {
  116. return json_fail('请选择目标顾问');
  117. }
  118. if (empty($params['move_market_customer_id']) && empty($params['move_consultant_id'])) {
  119. return json_fail('请选择需要转移的客户或顾问');
  120. }
  121. return CustomService::moveCustom($params);
  122. }
  123. /**
  124. * Notes: 移交记录
  125. * User: yb
  126. * Date: 2024/8/15
  127. * Time: 14:36
  128. * @param Request $request
  129. */
  130. public function moveLogs(Request $request)
  131. {
  132. $params = $request->post();
  133. if (empty($params['custom_id'])) {
  134. return json_fail('客户id不能为空');
  135. }
  136. return CustomService::moveLogs($params);
  137. }
  138. /**
  139. * Notes: 审核客户
  140. * User: yb
  141. * Date: 2024/8/16
  142. * Time: 11:38
  143. */
  144. public function checkCustom(Request $request)
  145. {
  146. $params = $request->post();
  147. if (!$this->validateClass->scene('check')->check($params)) {
  148. return json_fail($this->validateClass->getError());
  149. }
  150. return CustomService::checkCustom($params);
  151. }
  152. /**
  153. * Notes: 校验客户是否已经登记
  154. * User: yb
  155. * Date: 2024/8/21
  156. * Time: 9:37
  157. * @param Request $request
  158. */
  159. public function checkMobile(Request $request)
  160. {
  161. $params = $request->post();
  162. return CustomService::checkPhone($params);
  163. }
  164. /**
  165. * Notes: 指定顾问
  166. * User: yb
  167. * Date: 2024/9/5
  168. * Time: 12:51
  169. */
  170. public function appointConsultant(Request $request)
  171. {
  172. $params = $request->post();
  173. return CustomService::appoint($params);
  174. }
  175. }