lm-safe-app/config/common.js

134 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-06-03 09:37:52 +08:00
const getServiceHost = api => {
const apimodules = [{
2024-06-04 09:31:35 +08:00
OP: 7116
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
BD: 7101
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
DD: 7102
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
EA: 7103
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
ED: 7104
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
EM: 7105
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
FC: 7106
2024-06-03 09:37:52 +08:00
},
{
2024-06-04 09:31:35 +08:00
FM: 7107
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
KR: 7108
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
LG: 7109
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
MR: 7110
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
NW: 7111
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
PF: 7112
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
PM: 7113
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
QC: 7114
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
FW: 7115
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
OP: 7116
2024-06-03 09:37:52 +08:00
},
{
2024-06-04 09:31:35 +08:00
HM: 7117
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
PP: 7118
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
FO: 7119
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
UT: 7177
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
BS: 7178
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
SC: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
TI: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
SE: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
AE: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
PT: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
LR: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
OG: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
PE: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
OH: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
CM: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
PR: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
DM: 7179
2024-06-03 09:37:52 +08:00
}, {
2024-06-04 09:31:35 +08:00
BI: 7179
2024-06-03 09:37:52 +08:00
}
]
2024-06-04 09:31:35 +08:00
let port = 7112
2024-06-03 09:37:52 +08:00
for (let i = 0; i < apimodules.length; i++) {
const apimodule = apimodules[i]
const key = Object.keys(apimodule)[0]
if (api.indexOf(`/${key}/`) > -1) {
port = apimodule[key]
break
}
}
return `${port}/api${api}`
}
// 发行APP前先确定要发布的版本
let APP_ENV = 'beta' // beta: 测试版release: 发行版
let configURL
if (process.env.CUSTOM_PLATFORM === "dev") {
//本地环境
configURL = {
web_name: "",
serviceHost(api) {
const apis = getServiceHost(api)
return `${this.uni_app_web_api_url}:${apis}` //测试环境
},
uni_app_web_url: "", //
uni_app_web_api_url: "http://localhost", // 请求接口的地址
2024-06-04 09:31:35 +08:00
uni_app_web_source_url: "http://localhost:7199", // 资源地址
2024-06-03 09:37:52 +08:00
uni_app_web_local_api_url: "http://localhost", // 请求接口的地址
}
} else if (process.env.CUSTOM_PLATFORM === "test") {
//测试环境
configURL = {
web_name: "",
serviceHost(api) {
const apis = getServiceHost(api)
return `${this.uni_app_web_api_url}:${apis}` //测试环境
},
uni_app_web_url: "", //
uni_app_web_api_url: "http://47.122.43.22", // 请求接口的地址
2024-06-04 09:31:35 +08:00
uni_app_web_source_url: "http://47.122.43.22:7199", // 资源地址
2024-06-03 09:37:52 +08:00
uni_app_web_local_api_url: "http://47.122.43.22", // 请求接口的地址
}
} else
//生产环境 发布等
configURL = {
web_name: "",
serviceHost(api) {
const apis = getServiceHost(api)
return `${this.uni_app_web_local_api_url}:${apis}`
},
uni_app_web_url: "",
uni_app_web_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : "http://47.122.43.22",
2024-06-05 14:34:18 +08:00
uni_app_web_source_url: APP_ENV === 'release' ? "http://xmmhe.com:7199" : "http://47.122.43.22:7199",
2025-07-01 10:48:27 +08:00
uni_app_web_local_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : "http://localhost" //打包测试: 47.122.43.22 开发可 localhost
2024-06-03 09:37:52 +08:00
}
export default configURL