LoginLogic.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\workerapi\logic;
  3. use app\common\enum\notice\NoticeEnum;
  4. use app\common\logic\BaseLogic;
  5. use app\common\model\master_worker_register\MasterWorkerRegister;
  6. use app\common\service\sms\SmsDriver;
  7. /**
  8. * @author 林海涛
  9. * @date ${DATA}
  10. */
  11. class LoginLogic extends BaseLogic
  12. {
  13. /**
  14. * @notes 确认手机号
  15. * @param $params
  16. * @return bool
  17. * @author 段誉
  18. * @date 2022/9/21 17:28
  19. */
  20. public static function confirmMobile(array $params)
  21. {
  22. try {
  23. // 变更手机号场景
  24. $sceneId = NoticeEnum::OTHER_CAPTCHA;
  25. // 校验短信
  26. // $checkSmsCode = (new SmsDriver())->verify($params['mobile'], $params['code'], $sceneId);
  27. // if (!$checkSmsCode) {
  28. // throw new \Exception('验证码错误');
  29. // }
  30. return true;
  31. } catch (\Exception $e) {
  32. self::setError($e->getMessage());
  33. return false;
  34. }
  35. }
  36. public static function register(array $params)
  37. {
  38. try {
  39. MasterWorkerRegister::create([
  40. 'maintain_exp_type' => $params['maintain_exp_type'],
  41. 'other_exp_type' => $params['other_exp_type'],
  42. 'city' => $params['city'],
  43. 'vehicle_type' => $params['vehicle_type'],
  44. 'name' => $params['name'],
  45. 'age' => $params['age'],
  46. 'mobile' => $params['mobile'],
  47. ]);
  48. return true;
  49. } catch (\Exception $e) {
  50. self::setError($e->getMessage());
  51. return false;
  52. }
  53. }
  54. }