jy-safe-app/config/common.js
2025-10-29 11:54:39 +08:00

139 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const getServiceHost = api => {
const apimodules = [{
OP: 5116
}, {
BD: 5101
}, {
DD: 5102
}, {
EA: 5103
}, {
ED: 5104
}, {
EM: 5105
}, {
FC: 5106
},
{
FM: 5107
}, {
KR: 5108
}, {
LG: 5109
}, {
MR: 5110
}, {
NW: 5111
}, {
PF: 5112
}, {
PM: 5113
}, {
QC: 5114
}, {
FW: 5115
}, {
OP: 5116
},
{
HM: 5117
}, {
PP: 5118
}, {
FO: 5119
}, {
UT: 5177
}, {
BS: 5178
}, {
SC: 5179
}, {
TI: 5179
}, {
SE: 5179
}, {
AE: 5179
}, {
PT: 5179
}, {
LR: 5179
}, {
OG: 5179
}, {
PE: 5179
}, {
OH: 5179
}, {
CM: 5179
}, {
PR: 5179
}, {
DM: 5179
}, {
BI: 5179
}, {
WB: 5179
},{
TL: 5179
},
{ SK: 5180 }
]
let port = 5112
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", // 请求接口的地址
uni_app_web_source_url: "http://localhost:5199", // 资源地址
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://121.41.2.71", // 请求接口的地址
uni_app_web_source_url: "http://121.41.2.71:5199", // 资源地址
uni_app_web_local_api_url: "http://121.41.2.71", // 请求接口的地址
}
} 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://124.117.209.78" : "http://121.41.2.71",
uni_app_web_source_url: APP_ENV === 'release' ? "http://124.117.209.78:5199" : "http://121.41.2.71:5199",
uni_app_web_local_api_url: APP_ENV === 'release' ? "http://124.117.209.78" :
"http://121.41.2.71" //打包测试: 121.41.2.71 开发可 localhost
}
export default configURL