From 8c63ec487a2ab4f0711f841fceb09c8254622ac2 Mon Sep 17 00:00:00 2001 From: kron Date: Wed, 6 Aug 2025 11:56:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E7=94=A8=E7=8E=AF=E5=A2=83=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=8D=E5=90=8C=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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");