feat : phone pool
This commit is contained in:
@@ -203,6 +203,7 @@ abstract class LoginBaseService extends BaseService
|
||||
$model->nickname = '用户'.StringUtil::randStr(6);
|
||||
$model->avatar_id = 0;
|
||||
$model->reg_ip = SystemUtil::getClientIp();
|
||||
$model->mobile = $this->mobile;
|
||||
|
||||
if (!$model->save()) throw new ErrException('数据保存失败-注册失败');
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ use App\Event\RegistrationEvent;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\UserAccount;
|
||||
use App\Model\UserThird;
|
||||
use App\Service\ServiceTrait\Api\PhonePoolTrait;
|
||||
use App\Service\ServiceTrait\Api\WxMiniTrait;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
@@ -26,6 +27,7 @@ use RedisException;
|
||||
class WxFastLoginService extends LoginBaseService
|
||||
{
|
||||
use WxMiniTrait;
|
||||
use PhonePoolTrait;
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
@@ -56,6 +58,7 @@ class WxFastLoginService extends LoginBaseService
|
||||
|
||||
$wxPhone = $this->jsCodeGetPhoneNumber($phoneCode);
|
||||
$this->mobile = $wxPhone['phone_info']['purePhoneNumber'] ?? '';
|
||||
if ($this->mobile == '') throw new ErrException('手机号获取失败');
|
||||
|
||||
$this->checkLock(self::LOGIN_TYPE);
|
||||
|
||||
@@ -72,6 +75,8 @@ class WxFastLoginService extends LoginBaseService
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
private function updateMobile(): void
|
||||
{
|
||||
@@ -82,6 +87,8 @@ class WxFastLoginService extends LoginBaseService
|
||||
$this->userInfo->mobile = $this->mobile;
|
||||
|
||||
if (!$this->userInfo->save()) throw new ErrException('更新手机号失败');
|
||||
|
||||
$this->addMobilePhone($this->mobile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user