CustomController.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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['move_type'])) {
  112. if (empty($params['consultant_id'])) {
  113. return json_fail('请选择目标顾问');
  114. }
  115. } else {
  116. if (empty($params['dept_id'])) {
  117. return json_fail('请选择目标团队');
  118. }
  119. }
  120. if (empty($params['move_market_customer_id']) && empty($params['move_consultant_id'])) {
  121. return json_fail('请选择需要转移的客户或顾问');
  122. }
  123. return CustomService::moveCustom($params);
  124. }
  125. /**
  126. * Notes: 指定顾问
  127. * User: yb
  128. * Date: 2024/9/5
  129. * Time: 12:51
  130. */
  131. public function appointConsultant(Request $request)
  132. {
  133. $params = $request->post();
  134. return CustomService::appoint($params);
  135. }
  136. /**
  137. * Notes: 转移记录
  138. * User: yb
  139. * Date: 2024/8/7
  140. * Time: 15:34
  141. * @param Request $request
  142. * @return Response
  143. */
  144. public function moveLogs(Request $request)
  145. {
  146. return CustomService::moveLogs($request);
  147. }
  148. /**
  149. * Notes: 转到访审核
  150. * User: yb
  151. * Date: 2024/8/16
  152. * Time: 15:55
  153. * @param Request $request
  154. */
  155. public function checkCustom(Request $request)
  156. {
  157. $params = $request->post();
  158. if ($this->validate && !$this->validateClass->scene('check')->check($params)) {
  159. return json_fail($this->validateClass->getError());
  160. }
  161. return CustomService::checkCustom($params);
  162. }
  163. /**
  164. * Notes: 统计分析
  165. * User: yb
  166. * Date: 2024/8/17
  167. * Time: 11:50
  168. */
  169. public function statisticsIndex(Request $request)
  170. {
  171. return CustomService::statisticsIndex($request);
  172. }
  173. /**
  174. * Notes: 导出
  175. * User: yb
  176. * Date: 2024/8/17
  177. * Time: 13:29
  178. * @param Request $request
  179. * @return Response
  180. */
  181. public function exportData(Request $request)
  182. {
  183. return CustomService::exportData($request);
  184. }
  185. /**
  186. * Notes: 按月统计
  187. * User: yb
  188. * Date: 2024/8/21
  189. * Time: 15:54
  190. */
  191. public function statisticsByMonth()
  192. {
  193. return CustomService::statisticsMonth();
  194. }
  195. /**
  196. * Notes: 导入客户
  197. * User: yb
  198. * Date: 2024/9/10
  199. * Time: 10:29
  200. */
  201. public function importCustom(Request $request)
  202. {
  203. $params = $request->post();
  204. return CustomService::import($params);
  205. }
  206. }