Files
danyang-match/miniapp/env.ts
T

27 lines
643 B
TypeScript
Raw Normal View History

2026-09-09 22:05:00 +08:00
/**
* 环境配置
*/
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;
}
2026-09-09 22:05:00 +08:00
const info = (wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync()) as any;
return info.platform === 'devtools';
} catch {
return false;
}
}
export const API_BASE_URL: string = isDev()
? 'http://localhost:8085/api/v1'
: 'https://api.danyang-match.example.com/api/v1';
export const IS_DEV: boolean = isDev();