feat(env): 新增环境识别,网关地址按环境自动切换

- 新增 utils/env,用 wx.getAccountInfoSync().miniProgram.envVersion 识别 develop/trial/release
- request 与 lefu 的地址由硬编码改为按环境映射,develop/trial 走测试网关,release 走正式网关

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-08-28 11:59:44 +08:00
co-authored by Claude Opus 4.7
parent b4b2d2c7f3
commit b94a6780f0
4 changed files with 41 additions and 9 deletions
+12
View File
@@ -0,0 +1,12 @@
import type { EnvType } from './types'
export type { EnvType }
/** 获取当前运行环境,基础库不支持 getAccountInfoSync 时回退 develop */
export const ENV: EnvType = (() => {
try {
return wx.getAccountInfoSync().miniProgram.envVersion as EnvType
} catch {
return 'develop'
}
})()
+2
View File
@@ -0,0 +1,2 @@
/** 小程序运行环境:develop 开发版 / trial 体验版 / release 正式版 */
export type EnvType = 'develop' | 'trial' | 'release'