// const debug = process.env.NODE_ENV == 'development' ? true : false;
const debug = false;
// #ifdef H5
const proxyApi = "/api";
// #endif

// #ifdef MP-WEIXIN || APP || MP-ALIPAY
const proxyApi = "http://192.168.1.42"; // 调试地址
const proxyApiwws = "ws://192.168.1.42:2348"; // 调试地址
// #endif

// #ifdef H5
const baseUrl = debug ? proxyApi : "http://192.168.1.42";
const baseUrlwws = "ws://192.168.1.42:2348";
// #endif

// #ifdef APP || MP-WEIXIN || MP-ALIPAY
const baseUrl = debug ? proxyApi : "https://cashier.sxczgkj.com"; // 线上
const baseUrlwws = debug ? proxyApiwws : "wss://czgeatws.sxczgkj.com/wss"; // 线上
// #endif

const version = "100";
const autoRemoveCache = {
	count: 100000,
	size: 100000,
};
uni.conf = {
	debug,
	baseUrl,
	version,
	autoRemoveCache,
	baseUrlwws,
};

console.log('uni.conf',uni.conf)

export const changeEnv = (env) => {
	if (env === "test") {
		let baseUrl = "http://192.168.1.42"
		// #ifdef H5
		baseUrl = "/api"
		// #endif
		uni.conf = {
			debug: true,
			baseUrl,
			phpUrl: 'http://192.168.1.42:8787/api/',
			phpChatWx: 'ws://192.168.1.42:2348',
			version: 100,
			autoRemoveCache,
			baseUrlwws: "ws://192.168.1.42:2348",
		};
	}
	if (env === "prod") {
		uni.conf = {
			debug: false,
			baseUrl: "https://cashier.sxczgkj.com",
			version: 100,
			autoRemoveCache,
			baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
		};
	}
};