|
@@ -233,7 +233,7 @@ class AccountService
|
|
|
private function storeVerifyCode(string $mobile, int $code): void
|
|
|
{
|
|
|
// 构建缓存键名(verify_code:手机号)
|
|
|
- $key = self::VERIFY_CODE_PREFIX . $mobile;
|
|
|
+ $key = self::VERIFY_CODE_PREFIX.$mobile;
|
|
|
|
|
|
// 将验证码存入缓存,并设置过期时间
|
|
|
Cache::put($key, $code, self::VERIFY_CODE_EXPIRE);
|
|
@@ -284,7 +284,7 @@ class AccountService
|
|
|
private function verifyCode(string $mobile, string $code): void
|
|
|
{
|
|
|
// 使用手机号和前缀构建缓存键,获取存储的验证码
|
|
|
- $cacheCode = Cache::get(self::VERIFY_CODE_PREFIX . $mobile);
|
|
|
+ $cacheCode = Cache::get(self::VERIFY_CODE_PREFIX.$mobile);
|
|
|
|
|
|
// 验证码不存在或不匹配则抛出业务异常
|
|
|
if (! $cacheCode || $cacheCode != $code) {
|
|
@@ -352,10 +352,10 @@ class AccountService
|
|
|
// 创建新的用户记录
|
|
|
return MemberUser::create([
|
|
|
'state' => UserStatus::OPEN->value, // 设置用户状态为开启
|
|
|
- 'register_area' => request()->header('area_code'), // 从请求头获取注册区域
|
|
|
+ 'register_area' => request()->header('area_code') ?? '0000', // 从请求头获取注册区域
|
|
|
'nickname' => $userInfo['nickname'] ?? null, // 设置微信昵称,可选
|
|
|
'avatar' => $userInfo['avatar'] ?? null, // 设置微信头像,可选
|
|
|
- 'gender' => $userInfo['gender'] ?? null, // 设置性别,可选
|
|
|
+ 'gender' => $userInfo['gender'] ?? 0, // 设置性别,可选
|
|
|
]);
|
|
|
}
|
|
|
|
|
@@ -583,8 +583,8 @@ class AccountService
|
|
|
* 3. 更新用户手机号
|
|
|
* 4. 返回更新后的用户信息
|
|
|
*
|
|
|
- * @param string $mobile 新手机号
|
|
|
- * @param string $code 验证码
|
|
|
+ * @param string $mobile 新手机号
|
|
|
+ * @param string $code 验证码
|
|
|
* @return array 包含成功消息和更新后的用户信息
|
|
|
*
|
|
|
* @throws BusinessException 手机号已被使用时抛出异常
|