38 lines
1.0 KiB
TypeScript
38 lines
1.0 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_ASSETS: `${API_BASE}/user/assets`,
|
|
USER_ASSETS_CONSUME: `${API_BASE}/user/assets/consume`,
|
|
USER_ASSETS_EARN: `${API_BASE}/user/assets/earn`,
|
|
USER_GAME_DATA: `${API_BASE}/user/game-data`,
|
|
LEVELS: `${API_BASE}/wechat-game/levels`,
|
|
SHARE_CREATE: `${API_BASE}/share`,
|
|
SHARE_PROGRESS: `${API_BASE}/share/progress`,
|
|
USER_INFO: `${API_BASE}/user/info`,
|
|
} as const;
|
|
|
|
/** 构建加入分享的 URL */
|
|
export function getShareJoinUrl(code: string): string {
|
|
return `${API_BASE}/share/${code}/join`;
|
|
}
|
|
|
|
/** 积分操作原因 */
|
|
export const POINT_REASONS = {
|
|
HINT_UNLOCK: 'hint_unlock',
|
|
LEVEL_COMPLETE: 'level_complete',
|
|
} as const;
|
|
|
|
/** 请求超时时间(毫秒) */
|
|
export const API_TIMEOUT = {
|
|
DEFAULT: 8000,
|
|
SHORT: 5000,
|
|
} as const;
|