Merge branch 'light_v2'
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Taro from "@tarojs/taro";
|
||||
import httpService, { ApiResponse } from "./httpService";
|
||||
import tokenManager from "../utils/tokenManager";
|
||||
import tokenManager from '../utils/tokenManager';
|
||||
import { useUser } from '@/store/userStore';
|
||||
|
||||
// 微信用户信息接口
|
||||
export interface WechatUserInfo {
|
||||
@@ -42,6 +43,13 @@ export interface UserStats {
|
||||
participated_games_count: number;
|
||||
}
|
||||
|
||||
// 手机号验证码登录接口参数
|
||||
export interface PhoneLoginParams {
|
||||
phone: string;
|
||||
verification_code: string;
|
||||
user_code: string
|
||||
}
|
||||
|
||||
export interface UserInfoType {
|
||||
subscribe_time: string;
|
||||
last_login_time: string;
|
||||
@@ -91,6 +99,13 @@ export const wechat_auth_login = async (
|
||||
});
|
||||
|
||||
if (auth_response.code === 0) {
|
||||
// 登录成功后,更新用户信息到 store
|
||||
try {
|
||||
await useUser.getState().fetchUserInfo();
|
||||
} catch (error) {
|
||||
console.error('更新用户信息到 store 失败:', error);
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "微信登录成功",
|
||||
@@ -132,6 +147,13 @@ export const phone_auth_login = async (
|
||||
});
|
||||
|
||||
if (verify_response.code === 0) {
|
||||
// 登录成功后,更新用户信息到 store
|
||||
try {
|
||||
await useUser.getState().fetchUserInfo();
|
||||
} catch (error) {
|
||||
console.error('更新用户信息到 store 失败:', error);
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "登录成功",
|
||||
|
||||
Reference in New Issue
Block a user