他人页

This commit is contained in:
2025-09-15 21:13:13 +08:00
parent 7a0bc71f9f
commit f4c7840130
6 changed files with 95 additions and 49 deletions

View File

@@ -218,7 +218,7 @@ export class UserService {
if (response.code === 0) {
const userData = response.data;
return {
id: userData.user_code || user_id || '',
id: userData.user_code || userData.id || '',
nickname: userData.nickname || '',
avatar: userData.avatar_url || '',
join_date: userData.subscribe_time ? `${new Date(userData.subscribe_time).getFullYear()}${new Date(userData.subscribe_time).getMonth() + 1}月加入` : '',
@@ -285,7 +285,7 @@ export class UserService {
}
// 获取用户主办的球局
static async get_hosted_games(userId: string): Promise<any[]> {
static async get_hosted_games(userId: string | number): Promise<any[]> {
try {
const response = await httpService.post<any>(API_CONFIG.USER.HOSTED_GAMES, {
userId
@@ -308,7 +308,7 @@ export class UserService {
}
// 获取用户参与的球局
static async get_participated_games(userId: string): Promise<any[]> {
static async get_participated_games(userId: string | number): Promise<any[]> {
try {
const response = await httpService.post<any>(API_CONFIG.USER.PARTICIPATED_GAMES, {
userId
@@ -332,7 +332,7 @@ export class UserService {
}
// 获取用户球局记录(兼容旧方法)
static async get_user_games(user_id: string, type: 'hosted' | 'participated'): Promise<any[]> {
static async get_user_games(user_id: string | number, type: 'hosted' | 'participated'): Promise<any[]> {
if (type === 'hosted') {
return this.get_hosted_games(user_id);
} else {
@@ -341,10 +341,10 @@ export class UserService {
}
// 关注/取消关注用户
static async toggle_follow(user_id: string, is_following: boolean): Promise<boolean> {
static async toggle_follow(following_id: string | number, is_following: boolean): Promise<boolean> {
try {
const endpoint = is_following ? API_CONFIG.USER.UNFOLLOW : API_CONFIG.USER.FOLLOW;
const response = await httpService.post<any>(endpoint, { user_id }, {
const response = await httpService.post<any>(endpoint, { following_id }, {
showLoading: true,
loadingText: is_following ? '取消关注中...' : '关注中...'