删除解密

This commit is contained in:
2026-01-03 01:21:25 -08:00
parent ffbed8c72d
commit 4fc0b21c9c
5 changed files with 42 additions and 42 deletions
+30 -30
View File
@@ -153,27 +153,27 @@ export default class Request {
...config.extraConfig,
}
if (config.data && !(config.data instanceof FormData)) {
const plainText = JSON.stringify(config.data)
config.data = HiAesUtil.encryptData(plainText, encryptionKey)
}
if (config.method?.toLowerCase() === 'get' || config.params) {
const paramsToEncrypt = config.params || {}
const plainParamsText = JSON.stringify(paramsToEncrypt)
const encryptedParams = HiAesUtil.encryptData(plainParamsText, encryptionKey)
config.params = {
data: encryptedParams.data,
time: encryptedParams.time,
}
}
// if (config.data && !(config.data instanceof FormData)) {
// const plainText = JSON.stringify(config.data)
// config.data = HiAesUtil.encryptData(plainText, encryptionKey)
// }
//
// if (config.method?.toLowerCase() === 'get' || config.params) {
// const paramsToEncrypt = config.params || {}
// const plainParamsText = JSON.stringify(paramsToEncrypt)
// const encryptedParams = HiAesUtil.encryptData(plainParamsText, encryptionKey)
//
// config.params = {
// data: encryptedParams.data,
// time: encryptedParams.time,
// }
// }
config.headers = mergeExtraConfig.formatHeader({
...this.config.headers,
...config.headers,
lang: 'zh_CN',
'login-type': 'device',
// 'login-type': 'device',
...(mergeExtraConfig.withToken && {
[mergeExtraConfig.tokenKey]: mergeExtraConfig.getToken(),
}),
@@ -193,21 +193,21 @@ export default class Request {
this.axiosInstance.interceptors.response.use(
(response: ResponseType) => {
const { data, config } = response
let responseData = response.data.data
const responseData = response.data.data
if (responseData && responseData.data && responseData.time) {
try {
const decryptedStr = HiAesUtil.decryptData(
responseData.data,
responseData.time,
encryptionKey,
)
responseData = JSON.parse(decryptedStr)
} catch (e) {
console.error('解密失败:', e)
return Promise.reject({ message: '数据解密异常' })
}
}
// if (responseData && responseData.data && responseData.time) {
// try {
// const decryptedStr = HiAesUtil.decryptData(
// responseData.data,
// responseData.time,
// encryptionKey,
// )
// responseData = JSON.parse(decryptedStr)
// } catch (e) {
// console.error('解密失败:', e)
// return Promise.reject({ message: '数据解密异常' })
// }
// }
axiosCanceler.removePending(config)
if (data.code !== 200) {