/** * 根据环境判断获取 apiUrl * @param forceEnv 强制接口环境 develop trial release */ export function getApiUrl(forceEnv = "") { const mpConfig = wx.getAccountInfoSync()["miniProgram"]; const envVersion = typeof mpConfig.envVersion !== "undefined" ? mpConfig.envVersion : "release"; if (forceEnv === "develop" || (!forceEnv && envVersion === "develop")) { // 开发板 // return "http://epmet-dev.elinkservice.cn:41080/api/"; return "http://58.59.63.11:8888/api/"; } else if (forceEnv === "trial" || (!forceEnv && envVersion === "trial")) { // 体验版 return "http://58.59.63.11:8888/api/"; } else { let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; if (extConfig.extAppid) { if (extConfig.extAppid == "wx2f89f36484439d54") { return "https://epmet-cloud-py.elinkservice.cn/api/"; } else if (extConfig.extAppid == "wxb50debf05ff2461e") { // 磐石 return "https://epmet-panshi.elinkservice.cn/api/"; } else if (extConfig.extAppid == "wxbc57b1341377ded7") { // 烟台 return "https://www.yantai1s.com/api/"; } else if (extConfig.extAppid == "wxfdc9b6975431f353") { // 灵山 return "https://lingshan-smps.elinkservice.cn/api/"; } else if (extConfig.extAppid == "wx281af2aaef82f411") { // 日照 return "https://zhsq.shuzirizhao.cn/api/"; } } // release 默认正式版,保证正式版不受影响 return "https://epmet-cloud.elinkservice.cn/api/"; } } export const apiUrl = getApiUrl(""); export const config = { apiUrl, qqMapKey: "FEEBZ-ZQALK-QH2JI-A3VIV-M4IAH-UBBNG", // 腾讯地图key qqMapSKey: "i6GBTClsHhl2VKAGMy4UNquNTLkrXrTg", // 腾讯地图key }; export default config;