This commit is contained in:
“xHuPo” 2025-06-09 13:35:15 +08:00
commit 2b8870a40e
51 changed files with 5845 additions and 0 deletions

42
utils/config.js Normal file
View file

@ -0,0 +1,42 @@
/**
* 统一配置中心
* 合并原 config.js configManager.js 的功能
*/
// 基础配置
const baseConfig = {
// 生产环境配置
API_BASE_URL: 'https://otpm.zeroc.net',
API_VERSION: 'v1',
// API端点配置 (统一使用微信登录端点)
API_ENDPOINTS: {
AUTH: {
LOGIN: '/auth/login', // 改回原登录端点
REFRESH: '/auth/refresh'
},
OTP: {
SAVE: '/otp/save',
RECOVER: '/otp/recover'
}
},
// JWT配置
JWT_CONFIG: {
storage: {
access: 'jwt_access_token',
refresh: 'jwt_refresh_token'
},
refreshThreshold: 5 * 60 * 1000, // Token过期前5分钟开始刷新
headerKey: 'Authorization',
tokenPrefix: 'Bearer '
}
};
// 导出合并后的配置
module.exports = {
...baseConfig.API_ENDPOINTS,
...baseConfig.JWT_CONFIG,
API_BASE_URL: baseConfig.API_BASE_URL,
API_VERSION: baseConfig.API_VERSION
};