export const apiServer = process.env.API_BASE_URL;
// console.log("apiServer", apiServer);

export const token = '';
// export const token = '5c654da466ad325c6a1121e6d9e18f21';

// 商家系统登录
export const apiVerfSignIn = apiServer + 'VerfSignIn';

// 商家系统核销
export const apiVerfExchange = apiServer + 'VerfExchange';

// 商家系统已核销记录查询
export const apiVerfExchangedListQuery = apiServer + 'VerfExchangedListQuery';

// 商家系统获取微信JsConfig
export const apiGetWxJsSdkConfig = apiServer + 'GetWxJsSdkConfig';


// 检测request的返回值
export function checkResCode(res) {
	if (res.data.code == 0) {
		return true;
	} else if (res.statusCode == 401) { // 未登录
		uni.showToast({
			title: `您尚未登录`,
			icon: 'none',
			duration: 3000
		});
		// window.location.href = `action://to_login/`;
		uni.navigateTo({
			url: '/pages/login/login'
		});
		return false;
	} else {
		uni.showToast({
			title: `${res.data.message}`,
			icon: 'none',
			duration: 3000
		});
		return false;
	}
};
