This commit is contained in:
2023-09-27 16:24:23 +08:00
parent 6d88cd5659
commit 1c588d3c35
2 changed files with 35 additions and 59 deletions

View File

@@ -37,25 +37,17 @@ service.interceptors.request.use(
config.headers['dataSources'] = 'MP'
if (env === 'production') {
// 生产环境,加密,不输出任何东西
// 设置jsessionid和token
const JSESSIONID = utils.uuid()
config.headers['JSESSIONID'] = JSESSIONID
config.headers['token'] = utils.md5Salt(JSESSIONID)
// if ( encryptWhite.indexOf(config.url) < 0) {
// if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) {
// 这是定义在哪的
const data = { // 用于存储加密
params: '' // 加密后的密文
}
// 要加密
data.params = utils.encrypt(JSON.stringify(config.data))
// console.log('参数', config.url, '参数加密前',config.data)
config.data = data
// }
} else {
console.log('\n\n-----------------------')
console.log('参数', config.url, '参数加密前', config.data)
url = config.url
}
@@ -78,15 +70,10 @@ service.interceptors.response.use(
if (env === 'production') {
// 生产环境,进行加密解密,不输出日志
if (res.encrypt == 1) {
// 加密的数据,需要解密
const dataParam = JSON.parse(utils.decrypt(res.data))
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
// console.log('返回', response.config.url, '返回结果',res)
}
} else {
console.log('返回', response.config.url, '返回结果未加密', res)
console.log('-------------------------------------------\n\n')
}
}
uni.hideLoading()
if(response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1){
@@ -95,9 +82,7 @@ service.interceptors.response.use(
title: res.msg,
icon: "none"
})
}
}
return res
},