// 接口基础配置 // 环境地址配置 const ENV_CONFIG = { // 正式版 // release: 'https://xcx.yun.588580.xyz', trial: 'https://qywx.yun.588580.xyz', // 开发版 & 体验版 // develop: 'http://172.16.60.235:8080' develop: 'http://10.50.13.191:8080' } // 自动判断当前运行环境 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', APPOINTMENT_DETAIL: '/api/wx-mini/appointment/detail', WXACODE: '/api/wx-mini/wxacode', PERSON_SELECTOR: '/api/wx-mini/appointment/person/selector', NOTIFY_HOST: '/visitor/notify-host' } console.log('[config] 当前环境:', wx.getAccountInfoSync().miniProgram.envVersion, 'BASE_URL:', BASE_URL) module.exports = { BASE_URL, API }