|
@@ -28,7 +28,7 @@ export const encryptionFun = (config) => {
|
|
decodeURIComponent(JSON.stringify(sortObjectByKey(config.data))) : config.params && Object.keys(config.params).length ?
|
|
decodeURIComponent(JSON.stringify(sortObjectByKey(config.data))) : config.params && Object.keys(config.params).length ?
|
|
decodeURIComponent(qs.stringify(sortObjectByKey(config.params), { allowDots: true }) ): config.url.split('?')?.length>1 ?
|
|
decodeURIComponent(qs.stringify(sortObjectByKey(config.params), { allowDots: true }) ): config.url.split('?')?.length>1 ?
|
|
config.url.split('?')[1] : ''
|
|
config.url.split('?')[1] : ''
|
|
- // sha256加密字符串
|
|
|
|
|
|
+ // sha256加密字符串
|
|
if (paramsStr) initSign.sign = sha256(queryJsonData + paramsStr)
|
|
if (paramsStr) initSign.sign = sha256(queryJsonData + paramsStr)
|
|
// console.log('加密内容用完请注释->queryJsonData', queryJsonData)
|
|
// console.log('加密内容用完请注释->queryJsonData', queryJsonData)
|
|
// 请求头加参数initSign,请求头加参数: appId + nonce + timestamp + sign
|
|
// 请求头加参数initSign,请求头加参数: appId + nonce + timestamp + sign
|
|
@@ -36,10 +36,11 @@ export const encryptionFun = (config) => {
|
|
}
|
|
}
|
|
|
|
|
|
function sortObjectByKey(obj) {
|
|
function sortObjectByKey(obj) {
|
|
- return Object.keys(obj)
|
|
|
|
- .sort()
|
|
|
|
- .reduce((sortedObj, key) => {
|
|
|
|
- sortedObj[key] = obj[key];
|
|
|
|
- return sortedObj;
|
|
|
|
- }, {});
|
|
|
|
|
|
+ return obj
|
|
|
|
+ // return Object.keys(obj)
|
|
|
|
+ // .sort()
|
|
|
|
+ // .reduce((sortedObj, key) => {
|
|
|
|
+ // sortedObj[key] = obj[key];
|
|
|
|
+ // return sortedObj;
|
|
|
|
+ // }, {});
|
|
}
|
|
}
|