微信小程序发布试用版本
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
"use strict";
|
||||
const common_vendor = require("./vendor.js");
|
||||
const common_env = require("./env.js");
|
||||
const API_TARGETS = {
|
||||
local: "http://localhost:8090/",
|
||||
@@ -20,20 +19,16 @@ function resolveApiEnv() {
|
||||
{
|
||||
const mapped = ENV_ALIAS[fileEnv.toLowerCase()];
|
||||
if (mapped) {
|
||||
common_vendor.index.__f__("log", "at common/config.js:30", "[API Config] 使用 env.js 配置:", fileEnv, "=>", mapped);
|
||||
return mapped;
|
||||
}
|
||||
}
|
||||
const runtimeEnv = typeof process !== "undefined" && (process == null ? void 0 : process.env) ? process.env.UNI_APP_API_ENV || "development" : "";
|
||||
const aliasKey = runtimeEnv ? runtimeEnv.toLowerCase() : "";
|
||||
const env = ENV_ALIAS[aliasKey] || "prod";
|
||||
common_vendor.index.__f__("log", "at common/config.js:42", "[API Config] 使用环境变量:", runtimeEnv, "=>", env);
|
||||
return env;
|
||||
}
|
||||
const API_ENV = resolveApiEnv();
|
||||
const API_BASE_URL = normalizeBaseUrl(API_TARGETS[API_ENV] || API_TARGETS.prod);
|
||||
common_vendor.index.__f__("log", "at common/config.js:52", "[API Config] 当前环境:", API_ENV);
|
||||
common_vendor.index.__f__("log", "at common/config.js:53", "[API Config] API_BASE_URL:", API_BASE_URL);
|
||||
function getApiEnv() {
|
||||
return API_ENV;
|
||||
}
|
||||
@@ -41,7 +36,6 @@ function getApiUrl(path = "") {
|
||||
const apiPath = path.startsWith("/") ? path : `/${path}`;
|
||||
const fullPath = apiPath.startsWith("/") ? apiPath.slice(1) : apiPath;
|
||||
const fullUrl = `${API_BASE_URL}${fullPath}`;
|
||||
common_vendor.index.__f__("log", "at common/config.js:76", "[API Config] 非H5环境使用完整URL:", fullUrl);
|
||||
return fullUrl;
|
||||
}
|
||||
exports.getApiEnv = getApiEnv;
|
||||
|
||||
Reference in New Issue
Block a user