UserService.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <?php
  2. namespace app\wechat\service;
  3. use app\model\Consultant;
  4. use app\model\MarketCustomer;
  5. use app\model\MarketCustomerFollow;
  6. use app\model\SysDept;
  7. use Carbon\Carbon;
  8. use support\Db;
  9. use support\exception\BusinessException;
  10. use Tinywan\Jwt\JwtToken;
  11. class UserService
  12. {
  13. /**
  14. * Notes: 获取所有顾问
  15. * User: yb
  16. * Date: 2024/8/15
  17. * Time: 11:51
  18. * @param $params
  19. */
  20. public static function getAll($params)
  21. {
  22. $ids = self::getIds(1);
  23. $where = [
  24. [function($query) use ($ids) {
  25. $query->whereIn('id', $ids);
  26. }]
  27. ];
  28. if (!empty($params['not_id'])) {
  29. $where[] = ['id', '<>', $params['not_id']];
  30. }
  31. $list = Consultant::where($where)->select(['id','name','mobile','gender','status','dept_id','created_at'])->orderBy('created_at', 'desc')->get();
  32. return json_success('请求成功', $list);
  33. }
  34. /**
  35. * Notes: 团队成员
  36. * User: yb
  37. * Date: 2024/8/14
  38. * Time: 15:34
  39. * @param $params
  40. */
  41. public static function index($params)
  42. {
  43. $page = $params['page'] ?? 1;
  44. $size = $params['size'] ?? 10;
  45. $ids = self::getIds(1);
  46. $where = [
  47. [function($query) use ($ids) {
  48. $query->whereIn('id', $ids);
  49. }]
  50. ];
  51. if (!empty($params['status'])) {
  52. $where[] = ['status', '=', $params['status']];
  53. }
  54. if (!empty($params['consultant'])) {
  55. $keywords = $params['consultant'];
  56. $where[] = [function($query) use ($keywords) {
  57. $query->orWhere('name', 'like', "%{$keywords}%")->orWhere('mobile', 'like', "%{$keywords}%");
  58. }];
  59. }
  60. if (!empty($params['dept_id'])) {
  61. $deptIds = $params['dept_id'];
  62. $deptId = end($deptIds);
  63. $where[] = ['dept_id', '=', $deptId];
  64. }
  65. if (!empty($params['created_at'])) {
  66. $datetime = $params['created_at'];
  67. $startTime = strtotime($datetime['start'].' 00:00:00');
  68. $endTime = strtotime($datetime['end'].' 23:59:59');
  69. $where[] = [function($query) use ($startTime, $endTime) {
  70. $query->whereBetween('created_at', [$startTime, $endTime]);
  71. }];
  72. }
  73. $paginator = Consultant::where($where)->orderBy('created_at', 'desc')->paginate($size, ['id','name','mobile','gender','status','dept_id','created_at'], 'page', $page);
  74. $total = $paginator->total();
  75. $items = $paginator->items();
  76. $data = [
  77. 'total' => $total,
  78. 'rows' => $items
  79. ];
  80. return json_success('success', $data);
  81. }
  82. /**
  83. * Notes: 删除成员
  84. * User: yb
  85. * Date: 2024/8/15
  86. * Time: 11:39
  87. * @param $id
  88. */
  89. public static function del($id)
  90. {
  91. if(MarketCustomer::where('consultant_id', $id)->exists()) {
  92. return json_fail('成员下存在客户,请移交客户后删除成员');
  93. }
  94. $result = Consultant::where('id', $id)->delete();
  95. if ($result) {
  96. return json_success('删除成功');
  97. } else {
  98. return json_fail('删除失败');
  99. }
  100. }
  101. /**
  102. * Notes: 成员详情
  103. * User: yb
  104. * Date: 2024/8/15
  105. * Time: 10:19
  106. * @param $id
  107. */
  108. public static function getInfoById($id)
  109. {
  110. $info = Consultant::firstWhere(['id' => $id]);
  111. if (empty($info)) {
  112. return json_fail('成员信息不存在');
  113. }
  114. return json_success('请求成功', $info);
  115. }
  116. /**
  117. * Notes: 编辑成员
  118. * User: yb
  119. * Date: 2024/8/15
  120. * Time: 10:28
  121. * @param $params
  122. */
  123. public static function updateById($params)
  124. {
  125. if (empty($params['id'])) {
  126. return json_fail('成员id不能为空');
  127. }
  128. //查找员工信息
  129. $info = Consultant::find($params['id']);
  130. $oldDeptId = $info->dept_id;
  131. if (empty($info)) {
  132. return json_fail('成员不存在');
  133. }
  134. if (!self::checkMobile($params['mobile'])) {
  135. return json_fail('请输入正确的手机号');
  136. }
  137. //查询员工是否已被注册
  138. if (Consultant::where('mobile', $params['mobile'])->where('id', '<>', $params['id'])->exists()) {
  139. return json_fail('手机号已存在,成员已被注册');
  140. }
  141. //校验密码规则
  142. if (!empty($params['password'])) {
  143. $passwordLen = strlen($params['password']);
  144. if ($passwordLen > 20 || $passwordLen < 6) {
  145. return json_fail('请输入6-20位密码');
  146. }
  147. $password = self::handlePassword($params['password']);
  148. }
  149. //查询上级团队
  150. $topDeptId = SysDept::where('dept_id', $params['dept_id'])->where('dept_category', TeamService::DEPT_CATEGORY)->value('dept_super_id');
  151. if (!is_numeric($topDeptId)) {
  152. return json_fail('团队不存在');
  153. }
  154. $updateData = [
  155. 'name' => $params['name'],
  156. 'mobile' => $params['mobile'],
  157. 'dept_id' => $params['dept_id'],
  158. 'top_dept_id' => $topDeptId,
  159. 'gender' => $params['gender'] ?? 1,
  160. 'status' => $params['status'] ?? 1,
  161. 'updated_at' => time()
  162. ];
  163. if (!empty($params['password'])) {
  164. $updateData['password'] = $password;
  165. }
  166. $result = false;
  167. Db::beginTransaction();
  168. try {
  169. $result = Consultant::where('id', $params['id'])->update($updateData);
  170. if ($updateData['dept_id'] != $oldDeptId) {
  171. //修改成员所属部门
  172. MarketCustomer::where('consultant_id', '=', $params['id'])->update(['updated_at' => time(), 'dept_id' => $updateData['dept_id']]);
  173. }
  174. Db::commit();
  175. }catch (BusinessException|\Exception $e) {
  176. Db::rollBack();
  177. return json_fail($e->getMessage());
  178. }
  179. if ($result) {
  180. return json_success('编辑成功');
  181. } else {
  182. return json_fail('编辑失败');
  183. }
  184. }
  185. /**
  186. * Notes: 添加员工
  187. * User: yb
  188. * Date: 2024/8/15
  189. * Time: 9:55
  190. * @param $params
  191. */
  192. public static function add($params)
  193. {
  194. if (!self::checkMobile($params['mobile'])) {
  195. return json_fail('请输入正确的手机号');
  196. }
  197. //查询员工是否已被注册
  198. if (Consultant::where('mobile', $params['mobile'])->exists()) {
  199. return json_fail('手机号已存在,成员已被注册');
  200. }
  201. //校验密码规则
  202. if (!empty($params['password'])) {
  203. $passwordLen = strlen($params['password']);
  204. if ($passwordLen > 20 || $passwordLen < 6) {
  205. return json_fail('请输入6-20位密码');
  206. }
  207. }
  208. //查询上级团队
  209. $topDeptId = SysDept::where('dept_id', $params['dept_id'])->where('dept_category', TeamService::DEPT_CATEGORY)->value('dept_super_id');
  210. if (!is_numeric($topDeptId)) {
  211. return json_fail('团队不存在');
  212. }
  213. if (empty($params['password'])) {
  214. $showPassword = substr($params['mobile'], 5);
  215. $password = self::handlePassword($showPassword);
  216. } else {
  217. $password = self::handlePassword($params['password']);
  218. }
  219. $insertData = [
  220. 'name' => $params['name'],
  221. 'mobile' => $params['mobile'],
  222. 'dept_id' => $params['dept_id'],
  223. 'top_dept_id' => $topDeptId,
  224. 'gender' => $params['gender'] ?? 1,
  225. 'password' => $password,
  226. 'status' => $params['status'] ?? 1,
  227. 'relation_user_id' => $params['relation_user_id'] ?? null,
  228. 'type' => 2,
  229. 'created_at' => time()
  230. ];
  231. $result = Consultant::insert($insertData);
  232. if ($result) {
  233. return json_success('新增成功');
  234. } else {
  235. return json_fail('新增失败');
  236. }
  237. }
  238. /**
  239. * Notes: 登录
  240. * User: yb
  241. * Date: 2024/8/8
  242. * Time: 9:20
  243. * @param $data
  244. */
  245. public static function login($data)
  246. {
  247. $password = $data['password'];
  248. $mobile = $data['mobile'];
  249. $userInfo = Consultant::firstWhere(['mobile' => $mobile]);
  250. if (empty($userInfo)) {
  251. return json_fail('用户不存在');
  252. }
  253. //校验密码
  254. $confoundPassword = $userInfo->password;
  255. if ($confoundPassword != md5(md5($password))) {
  256. return json_fail('密码错误');
  257. }
  258. $status = $userInfo->status;
  259. if ($status != 1) {
  260. return json_fail('用户已离职');
  261. }
  262. $extend = [
  263. 'id' => $userInfo->id,
  264. 'client' => 'wechat',
  265. 'name'=> $userInfo->name,
  266. 'user_type' => $userInfo->type
  267. ];
  268. $token = JwtToken::generateToken($extend);
  269. $token['user_type'] = $extend['user_type'];
  270. return json_success('', $token);
  271. }
  272. /**
  273. * Notes: 获取身份信息
  274. * User: yb
  275. * Date: 2024/8/8
  276. * Time: 10:09
  277. */
  278. public static function auth()
  279. {
  280. $userId = JwtToken::getCurrentId();
  281. $userInfo = Consultant::firstWhere(['id' => $userId]);
  282. if (empty($userInfo)) {
  283. return json_fail('用户不存在');
  284. }
  285. $status = $userInfo->status;
  286. if ($status != 1) {
  287. return json_fail('用户已离职');
  288. }
  289. $type = $userInfo->type;
  290. $relationUserId = $userInfo->relation_user_id;
  291. return json_success('请求成功', ['type' => $type, 'relation_user_id' => $relationUserId]);
  292. }
  293. /**
  294. * Notes: 获取需要查询的ids
  295. * User: yb
  296. * Date: 2024/8/13
  297. * Time: 15:58
  298. * @return array
  299. */
  300. public static function getIds($clearSelf = 0)
  301. {
  302. $userId = JwtToken::getCurrentId();
  303. $userInfo = Consultant::firstWhere(['id' => $userId]);
  304. if (empty($userInfo)) {
  305. return [];
  306. }
  307. $ids = [];
  308. if ($userInfo->type == 1) {
  309. //管理账号
  310. $deptId = $userInfo->dept_id;
  311. $deptIds = TeamService::getIds($deptId);
  312. //团队下的所有员工
  313. $where = [
  314. [function($query) use ($deptIds) {
  315. $query->whereIn('dept_id', $deptIds);
  316. }]
  317. ];
  318. if ($clearSelf == 1) {
  319. $where[] = ['id', '<>', $userId];
  320. }
  321. $ids = Consultant::where($where)->pluck('id')->toArray();
  322. } else {
  323. //普通账号
  324. $ids[] = $userId;
  325. }
  326. return $ids;
  327. }
  328. /**
  329. * Notes: 首页统计分析
  330. * User: yb
  331. * Date: 2024/8/14
  332. * Time: 10:23
  333. */
  334. public static function statistics($params)
  335. {
  336. //统计客户总数
  337. $userIds = self::getIds();
  338. $currentTime = time();
  339. $diffNums = CustomService::DIFF_TIME;
  340. $where = [
  341. [function($query) use ($userIds) {
  342. $query->whereIn('consultant_id', $userIds);
  343. }]
  344. ];
  345. //客户总量
  346. $customNums = MarketCustomer::where($where)->count();
  347. if (!empty($params['time'])) {
  348. $time = $params['time'];
  349. $start = strtotime($time[0]);
  350. $end = strtotime($time[1]);
  351. } else {
  352. $startDate = date('Y-m-01', strtotime(date('Y-m-d')));
  353. $endDate = date('Y-m-t', strtotime(date('Y-m-d')));
  354. $start = strtotime($startDate.' 00:00:00');
  355. $end = strtotime($endDate.' 23:59:59');
  356. }
  357. $where[] = [function($query) use ($start, $end) {
  358. $query->whereBetween('created_at', [$start, $end]);
  359. }];
  360. //待审核客户数量
  361. $checkCustomNums = MarketCustomer::where($where)->where('check_status', '=', 1)->count();
  362. //新增客户
  363. $newCustomNums = MarketCustomer::where($where)->count();
  364. //已报备客户数
  365. $whereReport = [
  366. [function($query) use ($diffNums, $currentTime) {
  367. $query->whereRaw("((visit_time + {$diffNums}) - {$currentTime} > 0)")->where('current_status', '=', 1);
  368. }],
  369. ['check_status', '=', 2]
  370. ];
  371. $reportCustomNums = MarketCustomer::where($where)->where($whereReport)->count();
  372. //已到访客户数量
  373. $visitCustomNums = MarketCustomer::where($where)->where('current_status', 2)->where('check_status', 2)->count();
  374. //已缴费客户数量
  375. $payCustomNums = MarketCustomer::where($where)->where('current_status', 3)->where('check_status', 2)->count();
  376. //已成交客户数量
  377. $dealCustomNums = MarketCustomer::where($where)->where('current_status', 4)->where('check_status', 2)->count();
  378. //新增跟进记录数量
  379. $newFollowNums = MarketCustomerFollow::where($where)->count();
  380. //男女性别占比
  381. $whereEffective = [
  382. [function($query) {
  383. $query->orWhere(function ($query){
  384. $diffNums = (60 * 60 * 24 * 30);
  385. $currentTime = time();
  386. $query->whereRaw("((visit_time + {$diffNums}) - {$currentTime} > 0)")->where('current_status', '=', 1);
  387. })->orWhereIn('current_status', [2,3,4]);
  388. }],
  389. ['check_status', '=', 2]
  390. ];
  391. /* 男女数量 */
  392. $genderDataNums = [
  393. ['label' => '男', 'value' => 1, 'nums' => 0],
  394. ['label' => '女', 'value' => 2, 'nums' => 0],
  395. ];
  396. $genderData = MarketCustomer::where($where)->select(Db::raw('gender, count(*) as nums'))->where($whereEffective)->groupBy('gender')->get();
  397. if (!$genderData->isEmpty()) {
  398. $genderData = $genderData->toArray();
  399. foreach ($genderDataNums as $genderKey => $genderVal) {
  400. foreach ($genderData as $genderItem) {
  401. if ($genderItem['gender'] == $genderVal['value']) {
  402. $genderDataNums[$genderKey]['nums'] = $genderItem['nums'];
  403. }
  404. }
  405. }
  406. }
  407. /* 客户级别 */
  408. $levelDataNums = [
  409. ['label' => 'A类', 'value' => 1, 'nums' => 0],
  410. ['label' => 'B类', 'value' => 2, 'nums' => 0],
  411. ['label' => 'C类', 'value' => 3, 'nums' => 0],
  412. ['label' => 'D类', 'value' => 4, 'nums' => 0],
  413. ['label' => '其他', 'value' => "", 'nums' => 0],
  414. ];
  415. $levelData = MarketCustomer::where($where)->select(Db::raw('level, count(*) as nums'))->where($whereEffective)->groupBy('level')->get();
  416. if (!$levelData->isEmpty()) {
  417. $levelData = $levelData->toArray();
  418. $levelData = array_column($levelData, 'nums', 'level');
  419. foreach ($levelDataNums as $levelKey => $levelVal) {
  420. if (isset($levelData[$levelVal['value']])) {
  421. $levelDataNums[$levelKey]['nums'] = $levelData[$levelVal['value']];
  422. }
  423. }
  424. }
  425. $data = [
  426. 'custom_nums' => $customNums,
  427. 'check_custom_nums' => $checkCustomNums,
  428. 'new_custom_nums' => $newCustomNums,
  429. 'report_custom_nums' => $reportCustomNums,
  430. 'visit_custom_nums' => $visitCustomNums,
  431. 'pay_custom_nums' => $payCustomNums,
  432. 'deal_custom_nums' => $dealCustomNums,
  433. 'new_follow_nums' => $newFollowNums,
  434. 'gender_data_nums' => $genderDataNums,
  435. 'level_data_nums' => $levelDataNums
  436. ];
  437. return json_success('请求成功', $data);
  438. }
  439. /**
  440. * Notes: 近7日客户走势
  441. * User: yb
  442. * Date: 2024/8/17
  443. * Time: 17:44
  444. */
  445. public static function customTrend($params)
  446. {
  447. //统计客户总数
  448. $userIds = self::getIds();
  449. $where = [
  450. [function($query) use ($userIds) {
  451. $query->whereIn('consultant_id', $userIds);
  452. }],
  453. [function($query) {
  454. $query->orWhere(function ($query){
  455. $diffNums = (60 * 60 * 24 * 30);
  456. $currentTime = time();
  457. $query->whereRaw("((visit_time + {$diffNums}) - {$currentTime} > 0)")->where('current_status', '=', 1);
  458. })->orWhereIn('current_status', [2,3,4]);
  459. }],
  460. ['check_status', '=', 2]
  461. ];
  462. $whereTrend = [];
  463. if (!empty($params['type'])) {
  464. $whereTrend[] = ['current_status', '=', $params['type']];
  465. }
  466. // 获取当前日期
  467. $today = Carbon::now();
  468. // 初始化日期数组和数量数组
  469. $dates = [date('Y-m-d')];
  470. // 循环7次,获取从今天开始往前推7天的日期
  471. for ($i = 0; $i < 6; $i++) {
  472. // 将日期推回到7天前
  473. $date = $today->subDay()->toDateString();
  474. // 将日期字符串存入数组
  475. $dates[] = $date;
  476. }
  477. // 逆序日期数组,因为我们是从今天往前计算的
  478. $dates = array_reverse($dates);
  479. $dateList = [];
  480. foreach ($dates as $item) {
  481. $dateList[] = ['label' => $item, 'nums' => 0, 'label_sim' => date('m/d', strtotime($item))];
  482. }
  483. $datesStr = implode('","', $dates);
  484. $datesStr = '"'.$datesStr.'"';
  485. $dateRaw = Db::raw("DATE_FORMAT(FROM_UNIXTIME(created_at), '%Y-%m-%d') IN ({$datesStr})");
  486. // 构建查询,使用whereBetween或whereIn根据需要筛选日期
  487. $results = MarketCustomer::select(Db::raw("DATE_FORMAT(FROM_UNIXTIME(created_at), '%Y-%m-%d') AS date,count(*) AS nums"))
  488. ->where($where)
  489. ->where($whereTrend)
  490. ->whereRaw($dateRaw)
  491. ->groupBy('date')->get();
  492. if (!$results->isEmpty()) {
  493. $results = $results->toArray();
  494. $results = array_column($results, 'nums', 'date');
  495. foreach ($dateList as $key => $val) {
  496. $dateList[$key]['nums'] = $results[$val['label']] ?? 0;
  497. }
  498. }
  499. //总数
  500. $customNums = MarketCustomer::where($where)->whereRaw($dateRaw)->count();
  501. //到访数
  502. $visitCustomNums = MarketCustomer::where($where)->whereRaw($dateRaw)->where('current_status', 2)->count();
  503. //已缴费数
  504. $payCustomNums = MarketCustomer::where($where)->whereRaw($dateRaw)->where('current_status', 3)->count();
  505. //已成交数
  506. $dealCustomNums = MarketCustomer::where($where)->whereRaw($dateRaw)->where('current_status', 4)->count();
  507. $data = [
  508. 'dateList' => $dateList,
  509. 'visit_nums' => $visitCustomNums,
  510. 'pay_nums' => $payCustomNums,
  511. 'deal_nums' => $dealCustomNums,
  512. 'total_nums' => $customNums
  513. ];
  514. return json_success('请求成功', $data);
  515. }
  516. /**
  517. * Notes: 用户详情
  518. * User: yb
  519. * Date: 2024/8/14
  520. * Time: 13:35
  521. */
  522. public static function info()
  523. {
  524. $userId = JwtToken::getCurrentId();
  525. $info = Consultant::firstWhere(['id' => $userId]);
  526. if (!empty($info)) {
  527. $info->dept_name = SysDept::where('dept_id', $info->dept_id)->value('dept_name');
  528. }
  529. return json_success('请求成功', $info);
  530. }
  531. /**
  532. * Notes: 修改个人信息
  533. * User: yb
  534. * Date: 2024/8/14
  535. * Time: 14:19
  536. * @param $params
  537. */
  538. public static function update($params)
  539. {
  540. $userId = JwtToken::getCurrentId();
  541. if (!self::checkMobile($params['mobile'])) {
  542. return json_fail('请输入正确的手机号');
  543. }
  544. //查询员工是否已被注册
  545. if (Consultant::where('mobile', $params['mobile'])->where('id', '<>', $userId)->exists()) {
  546. return json_fail('手机号已存在');
  547. }
  548. $info = Consultant::firstWhere(['id' => $userId]);
  549. if (empty($info)) {
  550. return json_fail('用户不存在');
  551. }
  552. $info->name = $params['name'];
  553. $info->gender = $params['gender'];
  554. $info->mobile = $params['mobile'];
  555. $result = $info->save();
  556. if ($result) {
  557. return json_success('修改成功');
  558. } else {
  559. return json_fail('修改失败');
  560. }
  561. }
  562. /**
  563. * Notes: 修改密码
  564. * User: yb
  565. * Date: 2024/8/14
  566. * Time: 14:20
  567. * @param $params
  568. */
  569. public static function editPassword($params)
  570. {
  571. $oldPassword = $params['old_password'];
  572. $password = $params['new_password'];
  573. $rePassword = $params['check_password'] ?? '';
  574. $len = mb_strlen($password);
  575. if ($len < 6) {
  576. return json_fail('密码长度最少为6位');
  577. }
  578. if ($len > 20) {
  579. return json_fail('密码长度最大为20位');
  580. }
  581. if ($password != $rePassword) {
  582. return json_fail('密码与确认密码不一致');
  583. }
  584. $userId = JwtToken::getCurrentId();
  585. $info = Consultant::firstWhere(['id' => $userId]);
  586. if (empty($info)) {
  587. return json_fail('用户不存在');
  588. }
  589. //校验密码
  590. $confoundPassword = $info->password;
  591. if ($confoundPassword != md5(md5($oldPassword))) {
  592. return json_fail('旧密码错误');
  593. }
  594. $info->password = md5(md5($password));
  595. $result = $info->save();
  596. if ($result) {
  597. return json_success('修改成功');
  598. } else {
  599. return json_fail('修改失败');
  600. }
  601. }
  602. /**
  603. * Notes: 团队列表
  604. * User: yb
  605. * Date: 2024/8/14
  606. * Time: 16:32
  607. */
  608. public static function getTeamList()
  609. {
  610. $userId = JwtToken::getCurrentId();
  611. $info = Consultant::firstWhere(['id' => $userId]);
  612. if (empty($info)) {
  613. return json_success('请求成功');
  614. }
  615. $deptId = $info->dept_id;
  616. $list = TeamService::getTeamList($deptId);
  617. return $list;
  618. }
  619. /**
  620. * Notes:校验手机号
  621. * User: yb
  622. * Date: 2024/8/2
  623. * Time: 11:12
  624. * @param $mobile
  625. * @return bool
  626. */
  627. protected static function checkMobile($mobile)
  628. {
  629. if (preg_match('/^1[0-9]\d{9}$/', $mobile)) {
  630. return true;
  631. } else {
  632. return false;
  633. }
  634. }
  635. /**
  636. * Notes: 处理密码
  637. * User: yb
  638. * Date: 2024/8/2
  639. * Time: 11:19
  640. * @param $password
  641. * @return mixed
  642. */
  643. protected static function handlePassword($password)
  644. {
  645. return md5(md5($password));
  646. }
  647. }