mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-12 14:56:45 +08:00
随机密码加密解密--index.js环境配置修改,区分post和get请求
This commit is contained in:
@@ -169,7 +169,7 @@ service.interceptors.request.use(
|
||||
* 请求拦截处理(待添加 判断走统一网关处理)
|
||||
*/
|
||||
console.log(config)
|
||||
if (config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && configApp.API_VERSION == 'v2') {
|
||||
if (config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && (configApp.API_VERSION == 'v2' || configApp.API_VERSION == 'v3')) {
|
||||
if (!config.data || config.data == null) {
|
||||
config.data = {}
|
||||
}
|
||||
@@ -185,6 +185,10 @@ service.interceptors.request.use(
|
||||
// 验证数据完整性MD5
|
||||
// 数据完整性MD5需要进行二次AES加密
|
||||
config.headers['signature'] = MD5(AESEncrypt(data, masterKey)).toString();
|
||||
if(config.method == 'get'){
|
||||
config.headers['ak'] = ak
|
||||
config.headers['data'] = data
|
||||
}
|
||||
config.data = { ak, data };
|
||||
console.log(config.data);
|
||||
if(AESDecrypt(config.data.data, masterKey)){
|
||||
@@ -226,7 +230,7 @@ service.interceptors.request.use(
|
||||
// 添加请时间戳
|
||||
let timeStr = new Date().getTime() + ''
|
||||
config.headers['timeStr'] = timeStr
|
||||
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'))
|
||||
// config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'))
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
@@ -240,7 +244,7 @@ service.interceptors.response.use(
|
||||
response => {
|
||||
let res = response.data
|
||||
if (
|
||||
configApp.API_VERSION == 'v2' &&
|
||||
(configApp.API_VERSION == 'v2' || configApp.API_VERSION == 'v3') &&
|
||||
response.config.url &&
|
||||
response.headers['content-type'].match(/application\/json/) &&
|
||||
/api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])
|
||||
|
||||
Reference in New Issue
Block a user