Files
cashier_wx/common/config.js

105 lines
2.2 KiB
JavaScript

// const debug = process.env.NODE_ENV == 'development' ? true : false;
const debug = true; // false线上 true本地
let baseUrl = ''
let baseUrlwws = ''
// #ifdef H5
uni.cache.set('token', 'b61c8b0f1c9d47ad924e33c48b496ce6')
uni.cache.set('userInfo', {
"acQrcodeValidTime": "2025-11-17 17:57:16",
"alipayOpenId": "",
"birthDay": "2025-10-17",
"createTime": "2024-07-06 11:30:16",
"distributionAmount": 0,
"headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
"id": "36434",
"idCard": "612401199810058031",
"isAc": 0,
"lastLoginTime": "2025-12-24 14:30:51",
"nickName": "微信用户",
"password": "",
"payPwd": "e10adc3949ba59abbe56e057f20f883e",
"phone": "18049104914",
"realName": "叶明飞",
"sex": 1,
"status": 1,
"updateTime": "2025-12-24 14:29:51",
"usePayPwd": 0,
"wechatAcOpenId": "1111",
"wechatAcQrcode": "",
"wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
})
// #endif
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 = "/api";
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 = "/api"
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