From a9511ea8284a5035cd72527f6b4301ae8776e098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Wed, 10 Sep 2025 22:13:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=9C=B0=E5=8C=BA?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/userService.ts | 38 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/src/services/userService.ts b/src/services/userService.ts index 825bfa5..afb3ea2 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -18,6 +18,7 @@ interface UserDetailData { country: string; province: string; city: string; + district:string; language: string; phone: string; is_subscribed: string; @@ -118,9 +119,6 @@ export class UserService { const start_time = new Date(game.start_time); const date_time = this.format_date_time(start_time); - // 处理技能等级 - const skill_level = this.format_skill_level(game.skill_level_min, game.skill_level_max); - // 处理图片数组 - 兼容两种数据格式 let images: string[] = []; if (game.image_list && game.image_list.length > 0) { @@ -150,17 +148,21 @@ export class UserService { const registered_count = game.current_players || game.participant_count || 0; const max_count = game.max_players || game.max_participants || 0; + // 转换为 ListCard 期望的格式 return { id: game.id, title: game.title || '未命名球局', - dateTime: date_time, + start_time: date_time, location: location, - distance: distance, - registeredCount: registered_count, - maxCount: max_count, - skillLevel: skill_level, + distance_km: parseFloat(distance.replace('km', '')) || 0, + current_players: registered_count, + max_players: max_count, + skill_level_min: parseInt(game.skill_level_min) || 0, + skill_level_max: parseInt(game.skill_level_max) || 0, + play_type: game.play_type || '不限', + image_list: images, + court_type: game.court_type || '未知', matchType: game.play_type || '不限', - images: images, shinei: game.court_type || '未知' }; }); @@ -191,22 +193,6 @@ export class UserService { return `${date_str} ${time_str}`; } - // 格式化技能等级 - private static format_skill_level(min: string, max: string): string { - const min_num = parseInt(min) || 0; - const max_num = parseInt(max) || 0; - - if (min_num === 0 && max_num === 0) { - return '不限'; - } - - if (min_num === max_num) { - return `${min_num}.0`; - } - - return `${min_num}.0-${max_num}.0`; - } - // 计算距离(模拟实现,实际需要根据用户位置计算) private static calculate_distance(latitude: number, longitude: number): string { if (latitude === 0 && longitude === 0) { @@ -241,7 +227,7 @@ export class UserService { }, personal_profile: '', - location: userData.province + userData.city || '', + location: userData.city + userData.district|| '', occupation: '', ntrp_level: '', phone: userData.phone || '',