feat: 球局详情完善 & 订单详情完善

This commit is contained in:
2025-09-11 19:21:46 +08:00
parent c430ed407b
commit 03c2571dda
12 changed files with 856 additions and 423 deletions

View File

@@ -1,47 +1,120 @@
import httpService from './httpService'
import type { ApiResponse } from './httpService'
import httpService from "./httpService";
import type { ApiResponse } from "./httpService";
// 用户接口
export interface GameDetail {
id: number,
title: string,
venue_id: number,
creator_id: number,
game_date: string,
start_time: string,
end_time: string,
max_participants: number,
current_participants: number,
ntrp_level: string,
play_style: string,
description: string,
status: string,
created_at: string,
updated_at: string,
interface VenueImage {
id: string;
url: string;
}
interface Weather {
fxDate: string;
tempMax: string;
tempMin: string;
iconDay: string;
textDay: string;
iconNight: string;
textNight: string;
humidity: string;
}
interface UserActionStatus {
can_assess: boolean;
can_join: boolean;
can_substitute: boolean;
can_pay: boolean;
waiting_start: boolean;
is_substituting: boolean;
}
export interface GameData {
image_list: string[];
description_tag: string[];
start_time: string;
end_time: string;
venue_description_tag: string[];
venue_image_list: VenueImage[];
remark_tag: string[];
create_time: string;
last_modify_time: string;
id: number;
title: string;
description: string;
game_type: string;
play_type: string;
publisher_id: string;
venue_id: string;
max_players: number;
current_players: number;
price: string;
price_mode: string;
court_type: string;
court_surface: string;
gender_limit: string;
skill_level_min: string;
skill_level_max: string;
is_urgent: string;
is_substitute_supported: string;
max_substitute_players: number;
current_substitute_count: number;
is_wechat_contact: number;
wechat_contact: string;
privacy_level: string;
member_visibility: string;
match_status: number;
venue_description: string;
location_name: string;
location: string;
latitude: number;
longitude: number;
deadline_hours: number;
remark: string;
venue_dtl: any | null;
formal_members: any[];
substitute_members: any[];
participants: any[];
participant_count: number;
max_participants: number;
weather: Weather[];
user_action_status: UserActionStatus;
}
export enum MATCH_STATUS {
NOT_STARTED = 0, // 未开始
IN_PROGRESS = 1, //进行中
FINISHED = 2 //已结束
NOT_STARTED = 0, // 未开始
IN_PROGRESS = 1, //进行中
FINISHED = 2, //已结束
}
// 响应接口
export interface Response {
code: string
message: string
data: GameDetail
export interface UpdateLocationRes {
latitude: number;
longitude: number;
country: string;
province: string;
city: string;
district: string;
}
// 发布球局类
class GameDetailService {
// 用户登录
async getDetail(id: number): Promise<ApiResponse<Response>> {
return httpService.post('/games/detail', { id }, {
async getDetail(id: number): Promise<ApiResponse<GameData>> {
return httpService.post(
"/games/detail",
{ id },
{
showLoading: true,
},
);
}
async updateLocation(location: {
latitude: number;
longitude: number;
}): Promise<ApiResponse<UpdateLocationRes>> {
return httpService.post("/user/update_location", location, {
showLoading: true,
})
});
}
}
// 导出认证服务实例
export default new GameDetailService()
export default new GameDetailService();