import httpService from "./httpService"; import type { ApiResponse } from "./httpService"; 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; is_disabled: number; } export enum MATCH_STATUS { NOT_STARTED = 0, // 未开始 IN_PROGRESS = 1, //进行中 FINISHED = 2, //已结束 CANCELED = 3, // 已取消 } // 是否支持候补 export enum IsSubstituteSupported { SUPPORT = '1', // 支持 NOTSUPPORT = '0', // 不支持 } export interface UpdateLocationRes { latitude: number; longitude: number; country: string; province: string; city: string; district: string; } class GameDetailService { // 查询球局详情 async getDetail(id: number): Promise> { return httpService.post( "/games/detail", { id }, { showLoading: false, showToast: false, }, ); } async updateLocation(location: { latitude: number; longitude: number; }): Promise> { return httpService.post("/user/update_location", location, { showLoading: false, }); } // 组织者加入球局 async organizerJoin(game_id: number): Promise> { return httpService.post("/games/organizer_join", { game_id }, { showLoading: true, }); } // 组织者退出球局 async organizerQuit(req: { game_id: number, quit_reason: string }): Promise> { return httpService.post("/games/organizer_quit", req, { showLoading: true, }); } // 组织者解散球局 async disbandGame(req: { game_id: number, settle_reason: string }): Promise> { return httpService.post("/games/settle_game", req, { showLoading: true, }); } async getActivityId(req: { business_type: 'game' | 'order' | 'participant', business_id: number, is_private: boolean }): Promise> { return httpService.post('/user/create_activity_id', req, { showLoading: false, showToast: false, }) } async getQrCodeUrl(req: { page: string, scene: string }): Promise> { return httpService.post('/user/generate_qrcode', req, { showLoading: true }) } async getLinkUrl(req: { path: string, query: string }): Promise> { return httpService.post('/user/generate_url_link', req, { showLoading: true }) } } // 导出认证服务实例 export default new GameDetailService();