去除部分调试打印,优化环境变量控制,修复再来一单只有一个商品时自动弹出图片预览问题,

This commit is contained in:
2025-12-24 13:42:00 +08:00
parent addb9f0e75
commit 0736726336
14 changed files with 136 additions and 65 deletions

View File

@@ -1,4 +1,3 @@
export default async (params) => {
let url = params.url;
let method = params.method || "get";
@@ -9,7 +8,31 @@ export default async (params) => {
const shopId = uni.cache.get("shopId") * 1;
const userInfo = uni.cache.get("userInfo") || {};
// #ifdef H5
token = "b61c8b0f1c9d47ad924e33c48b496ce6";
token = "1b5e8baf0cc1492a858a208f113d0971";
uni.cache.set('userInfo', {
"acQrcodeValidTime": "2026-01-13 13:35:59",
"alipayOpenId": "",
"birthDay": "",
"createTime": "2024-03-13 10:56:40",
"distributionAmount": 0,
"headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
"id": "36689",
"idCard": "",
"isAc": 0,
"lastLoginTime": "2025-12-24 11:24:12",
"nickName": "微信用户",
"password": "",
"payPwd": "e10adc3949ba59abbe56e057f20f883e",
"phone": "",
"realName": "",
"sex": null,
"status": 1,
"updateTime": "2025-12-24 11:22:47",
"usePayPwd": 0,
"wechatAcOpenId": "",
"wechatAcQrcode": "http://weixin.qq.com/q/029s5JtP1xfmJ1g_HDxFco",
"wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
})
// #endif
let header = {
version: uni.conf.version,
@@ -37,7 +60,7 @@ export default async (params) => {
mask: true,
});
}
return new Promise((resolve, reject) => {
const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒
uni.request({

View File

@@ -1,29 +1,38 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false;
const debug = false; // false线上 true本地
// #ifdef H5
const proxyApi = "/api";
// #endif
let baseUrl = ''
let baseUrlwws = ''
// #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,
};
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,
@@ -36,10 +45,10 @@ uni.conf = {
export const changeEnv = (env) => {
if (env === "test") {
let baseUrl = "http://192.168.1.42"
let baseUrlwws="ws://192.168.1.42:2348"
let baseUrlwws = "ws://192.168.1.42:2348"
// #ifdef H5
baseUrl = "/api"
baseUrlwws="http://192.168.1.42:2348"
baseUrlwws = "http://192.168.1.42:2348"
// #endif
uni.conf = {
debug: true,
@@ -52,9 +61,13 @@ export const changeEnv = (env) => {
};
}
if (env === "prod") {
let baseUrl = "https://cashier.sxczgkj.com"
// #ifdef H5
baseUrl = "/prodApi"
// #endif
uni.conf = {
debug: false,
baseUrl: "https://cashier.sxczgkj.com",
baseUrl,
version: 100,
autoRemoveCache,
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",