- 同步版本号:VERSION / backend pom / admin-web / miniapp 均升至 1.1.0 - 合并本轮代码审查修复(详见 docs/CODE-REVIEW-2026-09-24.md): - 后端:微信登录真实实现 RealWechatLoginProvider、实名核验真实实现 RealIdentityVerificationProvider(本地强校验 + 可配置第三方 + fail-closed/fail-fast) - 照片直传落库端点 POST /me/photos/confirm(fileKey 归属校验 + 对象存在性校验后 savePhoto) - 刷新 Token Redis TTL 修正(getExpirationMs()*2 的 4h → refreshExpirationMs 的 14 天) - 管理端 token 改为 HttpOnly Cookie + silent-refresh,移除 localStorage 明文存储与 30+ 处手工注入 - 小程序:红娘接单鉴权头错位修复、serviceType 中文映射、生产域名可配置 - 隔离本地产物(.workbuddy/、*.bundle、*.dump、secrets、application-dev.yml 等已被 .gitignore 覆盖) 未验证项(打标签 ≠ 生产发布): - 后端编译 / 单测未在本环境执行(Maven 慢、Docker DNS 受限) - 管理端 登录→刷新→登出 端到端、小程序真机走查待人工验收 - 生产部署需注入 WECHAT_APP_ID / WECHAT_APP_SECRET、VERIFICATION_API_URL / VERIFICATION_API_KEY 与小程序生产域名
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/**
|
|
* 环境配置
|
|
*/
|
|
declare const wx: WechatMiniprogram.Wx;
|
|
|
|
function isDev(): boolean {
|
|
try {
|
|
const accountInfo = typeof wx.getAccountInfoSync === 'function'
|
|
? wx.getAccountInfoSync()
|
|
: null;
|
|
if (accountInfo?.miniProgram?.envVersion === 'develop') {
|
|
return true;
|
|
}
|
|
|
|
const info = (wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync()) as any;
|
|
return info.platform === 'devtools';
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// 生产环境后端地址(线上正式域名)。
|
|
// 部署前必须替换为真实域名,并到小程序后台「开发管理 → 开发设置 → 服务器域名」配置 request 合法域名。
|
|
// 如需在构建期注入(CI/打包脚本),可在打包前以全局 __DY_PROD_API_BASE__ 覆盖本默认值。
|
|
declare const __DY_PROD_API_BASE__: string | undefined;
|
|
const PROD_API_BASE_URL: string =
|
|
(typeof __DY_PROD_API_BASE__ !== 'undefined' ? __DY_PROD_API_BASE__ : undefined)
|
|
|| 'https://api.danyang-match.example.com/api/v1'; // TODO(部署): 替换为真实生产域名
|
|
|
|
export const API_BASE_URL: string = isDev()
|
|
? 'http://localhost:8085/api/v1'
|
|
: PROD_API_BASE_URL;
|
|
|
|
export const IS_DEV: boolean = isDev();
|