- 进入关卡成功后显示 toast 提示消耗体力及剩余体力 - 将 StorageManager 中 UserInfo 接口移至模块顶层,修复嵌套接口语法问题 - WxSDK.getWx() 改为 static 公开方法,便于外部调用
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
/**
|
|
* API 配置常量
|
|
* 统一管理所有服务端 API 地址
|
|
*/
|
|
|
|
/** 服务端 API 基础地址 */
|
|
export const API_BASE = 'https://ilookai.cn/api/v1';
|
|
|
|
/** API 端点 */
|
|
export const API_ENDPOINTS = {
|
|
/** 微信登录 */
|
|
WX_LOGIN: `${API_BASE}/auth/wx-login`,
|
|
/** 用户资料(含实时体力) */
|
|
USER_PROFILE: `${API_BASE}/user/profile`,
|
|
/** 游戏数据(体力 + 通关进度) */
|
|
USER_GAME_DATA: `${API_BASE}/user/game-data`,
|
|
/** 关卡列表 */
|
|
LEVELS: `${API_BASE}/levels`,
|
|
/** 游戏配置 */
|
|
GAME_CONFIGS: `${API_BASE}/game-configs`,
|
|
/** 分享相关 */
|
|
SHARE_CREATE: `${API_BASE}/share`,
|
|
SHARE_PROGRESS: `${API_BASE}/share/progress`,
|
|
/** 用户信息 */
|
|
USER_INFO: `${API_BASE}/user/info`,
|
|
} as const;
|
|
|
|
export function getLevelEnterUrl(levelId: string): string {
|
|
return `${API_BASE}/levels/${levelId}/enter`;
|
|
}
|
|
|
|
export function getLevelCompleteUrl(levelId: string): string {
|
|
return `${API_BASE}/levels/${levelId}/complete`;
|
|
}
|
|
|
|
export function getShareJoinUrl(code: string): string {
|
|
return `${API_BASE}/share/${code}/join`;
|
|
}
|
|
|
|
export function getGameConfigUrl(key: string): string {
|
|
return `${API_BASE}/game-configs/${key}`;
|
|
}
|
|
|
|
/** 请求超时时间(毫秒) */
|
|
export const API_TIMEOUT = {
|
|
DEFAULT: 8000,
|
|
SHORT: 5000,
|
|
} as const;
|