CustomController.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. namespace app\admin\controller\consultant;
  3. use app\admin\service\consultant\CustomService;
  4. use app\admin\validate\consultant\MarketCustomerValidate;
  5. use app\controller\Curd;
  6. use app\model\MarketCustomer;
  7. use support\Request;
  8. use support\Response;
  9. class CustomController extends Curd
  10. {
  11. public function __construct()
  12. {
  13. $this->model = new MarketCustomer();
  14. $this->validate = true;
  15. $this->validateClass = new MarketCustomerValidate();
  16. }
  17. /**
  18. * Notes: 获取选项配置信息
  19. * User: yb
  20. * Date: 2024/8/5
  21. * Time: 15:35
  22. */
  23. public function getOptionConfig()
  24. {
  25. return json_success('请求成功', CustomService::config());
  26. }
  27. /**
  28. * Notes: 新增客户
  29. * User: yb
  30. * Date: 2024/8/6
  31. * Time: 11:19
  32. */
  33. public function addCustom(Request $request)
  34. {
  35. $params = $request->post();
  36. if ($this->validate && !$this->validateClass->scene('add')->check($params)) {
  37. return json_fail($this->validateClass->getError());
  38. }
  39. return CustomService::add($params);
  40. }
  41. /**
  42. * Notes: 编辑客户
  43. * User: yb
  44. * Date: 2024/8/6
  45. * Time: 16:51
  46. */
  47. public function updateCustom(Request $request)
  48. {
  49. $params = $request->post();
  50. if ($this->validate && !$this->validateClass->scene('update')->check($params)) {
  51. return json_fail($this->validateClass->getError());
  52. }
  53. return CustomService::update($params);
  54. }
  55. public function select(Request $request): Response
  56. {
  57. return CustomService::index($request);
  58. }
  59. /**
  60. * Notes: 删除客户
  61. * User: yb
  62. * Date: 2024/8/2
  63. * Time: 13:34
  64. * @param Request $request
  65. * @return Response
  66. */
  67. public function deleteCustom(Request $request)
  68. {
  69. $params = $request->post();
  70. if (empty($params['ids'])) {
  71. return json_fail('请选择要删除的数据');
  72. }
  73. return CustomService::delete($params['ids']);
  74. }
  75. /**
  76. * Notes: 跟进记录
  77. * User: yb
  78. * Date: 2024/8/7
  79. * Time: 8:59
  80. * @param Request $request
  81. */
  82. public function followList(Request $request)
  83. {
  84. return CustomService::follow($request);
  85. }
  86. /**
  87. * Notes: 删除跟进记录
  88. * User: yb
  89. * Date: 2024/8/7
  90. * Time: 11:32
  91. * @param Request $request
  92. */
  93. public function deleteFollow(Request $request)
  94. {
  95. $params = $request->post();
  96. if (empty($params['ids'])) {
  97. return json_fail('请选择要删除的数据');
  98. }
  99. return CustomService::deleteFollow($params['ids']);
  100. }
  101. /**
  102. * Notes: 转移客户
  103. * User: yb
  104. * Date: 2024/8/7
  105. * Time: 14:22
  106. * @param Request $request
  107. */
  108. public function moveCustom(Request $request)
  109. {
  110. $params = $request->post();
  111. if (empty($params['consultant_id'])) {
  112. return json_fail('请选择目标顾问');
  113. }
  114. if (empty($params['move_market_customer_id']) && empty($params['move_consultant_id'])) {
  115. return json_fail('请选择需要转移的客户或顾问');
  116. }
  117. return CustomService::moveCustom($params);
  118. }
  119. /**
  120. * Notes: 转移记录
  121. * User: yb
  122. * Date: 2024/8/7
  123. * Time: 15:34
  124. * @param Request $request
  125. * @return Response
  126. */
  127. public function moveLogs(Request $request)
  128. {
  129. return CustomService::moveLogs($request);
  130. }
  131. /**
  132. * Notes: 报备审核
  133. * User: yb
  134. * Date: 2024/8/16
  135. * Time: 15:55
  136. * @param Request $request
  137. */
  138. public function checkCustom(Request $request)
  139. {
  140. $params = $request->post();
  141. if ($this->validate && !$this->validateClass->scene('check')->check($params)) {
  142. return json_fail($this->validateClass->getError());
  143. }
  144. return CustomService::checkCustom($params);
  145. }
  146. /**
  147. * Notes: 统计分析
  148. * User: yb
  149. * Date: 2024/8/17
  150. * Time: 11:50
  151. */
  152. public function statisticsIndex(Request $request)
  153. {
  154. return CustomService::statisticsIndex($request);
  155. }
  156. /**
  157. * Notes: 导出
  158. * User: yb
  159. * Date: 2024/8/17
  160. * Time: 13:29
  161. * @param Request $request
  162. * @return Response
  163. */
  164. public function exportData(Request $request)
  165. {
  166. return CustomService::exportData($request);
  167. }
  168. /**
  169. * Notes: 按月统计
  170. * User: yb
  171. * Date: 2024/8/21
  172. * Time: 15:54
  173. */
  174. public function statisticsByMonth()
  175. {
  176. return CustomService::statisticsMonth();
  177. }
  178. }