host.js 1.44 KB
Newer Older
王建威's avatar
王建威 committed
1
// php测试环境
郑秀明's avatar
郑秀明 committed
2
// export const php = 'http://test.pet-dbc.cn/mobile/index.php?'
王建威's avatar
王建威 committed
3 4

// php镜像
郑秀明's avatar
郑秀明 committed
5
// export const php = 'https://jingxiang.pet-dbc.cn/mobile/index.php?'
王建威's avatar
王建威 committed
6 7

// php正式环境
郑秀明's avatar
郑秀明 committed
8
// export const php = 'https://shop.pet-dbc.cn/mobile/index.php?'
王建威's avatar
王建威 committed
9 10

// go测试环境
郑秀明's avatar
郑秀明 committed
11
// export const go = 'https://tm.pet-dbc.cn'
王建威's avatar
王建威 committed
12 13

// go镜像环境 
郑秀明's avatar
郑秀明 committed
14
// export const go = 'https://jxm.pet-dbc.cn'
王建威's avatar
王建威 committed
15 16

// go正式环境
郑秀明's avatar
郑秀明 committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30
// export const go = 'https://m.pet-dbc.cn';

// 获取php正式环境
export const php = phpfunc();
// 获取跳转白条地址
export const go = gofunc();

/**
 * 根据当前域名返回ecmall地址
 * */ 
function phpfunc(){
	const { origin } = window.location;
	let url = '';
	// 测试环境
郑秀明's avatar
郑秀明 committed
31
	if(origin.indexOf('local') > -1 || origin.indexOf('test') > -1){
郑秀明's avatar
郑秀明 committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
		if(origin.indexOf('test') > -1){
			url = `${origin}/mobile/index.php?`;
		}else{
			url = 'https://test.pet-dbc.cn/mobile/index.php?';
		}
	}else if(origin.indexOf('jingxiang') > -1){
		url = 'https://jingxiang.pet-dbc.cn/mobile/index.php?';
	}else{
		url = 'https://shop.pet-dbc.cn/mobile/index.php?';
	}
	return url;
}

/**
 * 根据当前域名返回白条地址
 * */ 
 
function gofunc(){
	const { origin } = window.location;
	let url = '';
	// 测试环境
	if(origin.indexOf('localhost') > -1 || origin.indexOf('test') > -1){
		url = 'https://tm.pet-dbc.cn';
	}else if(origin.indexOf('jingxiang') > -1){
		url = 'https://jxm.pet-dbc.cn';
	}else{
		url = 'https://m.pet-dbc.cn';
	}
	return url;
}