function genSignParams(secretKey, inObject){
var sorter = function (inObject) {
var sortedJson = {};
var sortedKeys = Object.keys(inObject).sort();
for (var i = 0; i < sortedKeys.length; i++) {
sortedJson[sortedKeys[i]] = inObject[sortedKeys[i]]
}
return sortedJson;
}
var sortedParam = sorter(inObject);
var needSignatureStr = "";
for (var key in sortedParam) {
var value = sortedParam[key];
needSignatureStr = needSignatureStr + key + '=' + value + '&';
}
needSignatureStr += 'secretKey=' + secretKey;
console.log(needSignatureStr)
}
genSignParams('secretKey', { nc: 1, nb: 2, na: 3 })
console