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:
co-authored by
Claude Opus 4.7
parent
b4b2d2c7f3
commit
b94a6780f0
@@ -1,8 +1,12 @@
|
||||
// TODO: 替换为实际接口地址
|
||||
const IS_DEV = true
|
||||
import { ENV, type EnvType } from '../env/index'
|
||||
|
||||
export const BASE_URL = IS_DEV
|
||||
? 'http://10.10.10.10:8889/'
|
||||
: ''
|
||||
/** 各环境接口网关地址:develop / trial 走测试网关,release 走正式网关 */
|
||||
const BASE_URLS: Record<EnvType, string> = {
|
||||
develop: 'http://10.10.10.10:8889/',
|
||||
trial: 'http://10.10.10.10:8889/',
|
||||
release: 'https://device.shuziweidao.com/gateway/',
|
||||
}
|
||||
|
||||
export const BASE_URL = BASE_URLS[ENV]
|
||||
|
||||
export const TIMEOUT = 30000
|
||||
|
||||
Reference in New Issue
Block a user