remove unused configuration

This commit is contained in:
weiweiw 2024-07-21 08:53:09 +08:00
parent 149dc3cbeb
commit 2fd185f1f7
2 changed files with 12 additions and 9 deletions

View File

@ -6,12 +6,12 @@ const cbc_iv = CryptoJS.enc.Utf8.parse('1234567812345678')
* 默认参数需要加密 * 默认参数需要加密
* @type {boolean} * @type {boolean}
*/ */
const encryptEnabled=true; const encryptEnabled= true;
/** // /**
* 默认后台会自动加密 // * 默认后台会自动加密
* @type {boolean} // * @type {boolean}
*/ // */
const decryptEnabled=true; // const decryptEnabled=true;
/** /**
* 加密 * 加密
* @param word * @param word
@ -35,9 +35,9 @@ export const encryptCBC = function(word) {
* @returns {*} * @returns {*}
*/ */
export const decryptCBC = function(word) { export const decryptCBC = function(word) {
if(!decryptEnabled){ // if(!decryptEnabled){
return word; // return word;
} // }
const encrypted = CryptoJS.AES.decrypt(word, cbc_key, { const encrypted = CryptoJS.AES.decrypt(word, cbc_key, {
iv: cbc_iv, iv: cbc_iv,
mode: CryptoJS.mode.CBC, mode: CryptoJS.mode.CBC,

View File

@ -115,6 +115,9 @@ service.interceptors.response.use(res => {
const resultData=decryptCBC(res.data.data); const resultData=decryptCBC(res.data.data);
res.data=JSON.parse(resultData); res.data=JSON.parse(resultData);
} }
else if(typeof res.data.code=='undefined'){
res.data= res.data.data
}
// 未设置状态码则默认成功状态 // 未设置状态码则默认成功状态
const code = res.data.code || 200; const code = res.data.code || 200;
// 获取错误信息 // 获取错误信息