Authored by baoss

修复url公共参数格式问题

... ... @@ -61,9 +61,7 @@ const sign = async(data, encode = false) => {
return '';
}
data = stringify(data, {
encode: encode
});
data = stringifyParam(data, encode)
return HmacSHA256(data, verifyKey).toString();
... ... @@ -73,6 +71,12 @@ const sign = async(data, encode = false) => {
// verifyKey = 'bc330db80e80fa1f0204e7bbf83063f2'
// }
}
const stringifyParam = (data, encode = false) => {
data = stringify(data, {
encode: encode
});
return data
}
export const computeSecret = (data, url, encode = false) => {
let newData = {
private_key: dataUtils.getConfig().apiParams.private_key
... ... @@ -89,7 +93,7 @@ export const computeSecret = (data, url, encode = false) => {
if (url) {
let body = createBody(data);
let queryStrigPair = sign(body, true);
let queryStrigPair = stringifyParam(body, true);;
url = url.indexOf('?') >= 0 ? url + '&' + queryStrigPair : url + '?' + queryStrigPair;
newData.url = url
... ...