// const debug = process.env.NODE_ENV == 'development' ? true : false;
// const debug = false; // false线上 true本地
const debug = true; // false线上 true本地
let baseUrl = ''
let baseUrlwws = ''

const version = "100";
const autoRemoveCache = {
	count: 100000,
	size: 100000,
};

function init() {
	if (debug) {
		baseUrl = 'http://192.168.1.42'
		baseUrlwws = "ws://192.168.1.42:2348";
	} else {
		baseUrl = 'https://cashier.sxczgkj.com'
		baseUrlwws = "wss://czgeatws.sxczgkj.com/wss";
	}
	// #ifdef H5

	if (debug) {
		baseUrl = "/testApi";
		baseUrlwws = "http://192.168.1.42:2348";
	} else {
		baseUrl = "/prodApi";
		baseUrlwws = "https://czgeatws.sxczgkj.com/wss";
	}
	// #endif
}

init()

uni.conf = {
	debug,
	baseUrl,
	version,
	autoRemoveCache,
	baseUrlwws,
};


export const changeEnv = (env) => {
	if (env === "test") {
		let baseUrl = "http://192.168.1.42"
		let baseUrlwws = "ws://192.168.1.42:2348"
		// #ifdef H5
		baseUrl = "/testApi"
		baseUrlwws = "http://192.168.1.42:2348"
		// #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,
		};
	}
	if (env === "prod") {
		let baseUrl = "https://cashier.sxczgkj.com"
		// #ifdef H5
		baseUrl = "/prodApi"
		// #endif
		uni.conf = {
			debug: false,
			baseUrl,
			version: 100,
			autoRemoveCache,
			baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
		};
	}
};

export default uni.conf