// 接口基础配置 // 环境地址配置 const ENV_CONFIG = { // 正式版 release: 'https://xcx.yun.588580.xyz', trial: 'https://qywx.yun.588580.xyz', // 开发版 & 体验版 develop: 'https://qywx.yun.588580.xyz' } // 自动判断当前运行环境 function getBaseUrl() { const accountInfo = wx.getAccountInfoSync() const envVersion = accountInfo.miniProgram.envVersion // release = 正式版, develop = 开发版, trial = 体验版 return envVersion === 'trial' ? ENV_CONFIG.trial : ENV_CONFIG.develop } const BASE_URL = getBaseUrl() // API 路径配置 const API = { LOGIN: '/api/wx-mini/login', APPOINTMENT_LATEST: '/api/wx-mini/appointment/latest', APPOINTMENT_LIST: '/api/wx-mini/appointment/list', APPOINTMENT_CREATE: '/api/wx-mini/appointment/create', APPOINTMENT_CANCEL: '/api/wx-mini/appointment/cancel' } console.log('[config] 当前环境:', wx.getAccountInfoSync().miniProgram.envVersion, 'BASE_URL:', BASE_URL) module.exports = { BASE_URL, API }