diff --git a/src/apis.js b/src/apis.js index bfe195b..ce68424 100644 --- a/src/apis.js +++ b/src/apis.js @@ -1,4 +1,26 @@ -const BASE_URL = "https://api.shelingxingqiu.com/api/shoot"; +let BASE_URL = "https://api.shelingxingqiu.com/api/shoot"; // 默认正式版 + +try { + const accountInfo = uni.getAccountInfoSync(); + const envVersion = accountInfo.miniProgram.envVersion; + + switch (envVersion) { + case "develop": // 开发版 + BASE_URL = "https://api.shelingxingqiu.com/api/shoot"; + break; + case "trial": // 体验版 + BASE_URL = "https://api.shelingxingqiu.com/api/shoot"; + break; + case "release": // 正式版 + BASE_URL = "https://api.shelingxingqiu.com/api/shoot"; + break; + default: + // 保持默认值 + break; + } +} catch (e) { + console.error("获取环境信息失败,使用默认正式环境", e); +} function request(method, url, data = {}) { const token = uni.getStorageSync("token");