Files
mp-xieyingeng/assets/scripts/config/ApiConfig.ts
richarjiang 0da6fc12bb feat: 接入微信隐私授权API和用户信息获取
- WxSDK 新增隐私授权检查和用户信息获取方法
- StorageManager 新增用户信息本地缓存方法
- PageHome 进入时检查隐私授权状态
- PageWriteLevels 分享时获取用户头像昵称并上传服务端
- ApiConfig 新增用户信息 API 端点

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 21:40:48 +08:00

37 lines
989 B
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`,
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;