136 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			136 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
const getServiceHost = api => {
 | 
						||
	const apimodules = [{
 | 
						||
			OP: 3116
 | 
						||
		}, {
 | 
						||
			BD: 3101
 | 
						||
		}, {
 | 
						||
			DD: 3102
 | 
						||
		}, {
 | 
						||
			EA: 3103
 | 
						||
		}, {
 | 
						||
			ED: 3104
 | 
						||
		}, {
 | 
						||
			EM: 3105
 | 
						||
		}, {
 | 
						||
			FC: 3106
 | 
						||
		},
 | 
						||
		{
 | 
						||
			FM: 3107
 | 
						||
		}, {
 | 
						||
			KR: 3108
 | 
						||
		}, {
 | 
						||
			LG: 3109
 | 
						||
		}, {
 | 
						||
			MR: 3110
 | 
						||
		}, {
 | 
						||
			NW: 3111
 | 
						||
		}, {
 | 
						||
			PF: 3112
 | 
						||
		}, {
 | 
						||
			PM: 3113
 | 
						||
		}, {
 | 
						||
			QC: 3114
 | 
						||
		}, {
 | 
						||
			FW: 3115
 | 
						||
		}, {
 | 
						||
			OP: 3116
 | 
						||
		},
 | 
						||
		{
 | 
						||
			HM: 3117
 | 
						||
		}, {
 | 
						||
			PP: 3118
 | 
						||
		}, {
 | 
						||
			FO: 3119
 | 
						||
		}, {
 | 
						||
			UT: 3177
 | 
						||
		}, {
 | 
						||
			BS: 3178
 | 
						||
		}, {
 | 
						||
			SC: 3179
 | 
						||
		}, {
 | 
						||
			TI: 3179
 | 
						||
		}, {
 | 
						||
			SE: 3179
 | 
						||
		}, {
 | 
						||
			AE: 3179
 | 
						||
		}, {
 | 
						||
			PT: 3179
 | 
						||
		}, {
 | 
						||
			LR: 3179
 | 
						||
		}, {
 | 
						||
			OG: 3179
 | 
						||
		}, {
 | 
						||
			PE: 3179
 | 
						||
		}, {
 | 
						||
			OH: 3179
 | 
						||
		}, {
 | 
						||
			CM: 3179
 | 
						||
		}, {
 | 
						||
			PR: 3179
 | 
						||
		}, {
 | 
						||
			DM: 3179
 | 
						||
		}, {
 | 
						||
			BI: 3179
 | 
						||
		}
 | 
						||
	]
 | 
						||
	let port = 3112
 | 
						||
	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:3199", // 资源地址
 | 
						||
		uni_app_web_local_api_url: "http://localhost", // 请求接口的地址
 | 
						||
		uni_app_url: "http://47.122.43.22:9100"
 | 
						||
	}
 | 
						||
} 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", // 请求接口的地址
 | 
						||
		uni_app_web_source_url: "http://47.122.43.22:3199", // 资源地址
 | 
						||
		uni_app_web_local_api_url: "http://47.122.43.22", // 请求接口的地址
 | 
						||
		uni_app_url: "http://47.122.43.22:9100"
 | 
						||
	}
 | 
						||
} 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",
 | 
						||
		uni_app_web_source_url: APP_ENV === 'release' ? "http://xmmhe.com:3199" : "http://47.122.43.22:3199",
 | 
						||
		uni_app_web_local_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : "http://47.122.43.22", //打包测试: 47.122.43.22  开发可  localhost
 | 
						||
		uni_app_url: APP_ENV === 'release' ? "http://xmmhe.com:9100" : "http://47.122.43.22:9100"
 | 
						||
 | 
						||
	}
 | 
						||
 | 
						||
export default configURL |