参数:url: https://uhome.haier.net:6503/css/v1/protected/familyService/familyappKey: e8a1e19058c0928d7690cfd59c6b062dappId: SV-ABC-0000serviceKey: e8a1e19058c092fdfd328dd59c6b062dserviceId: UWS-FML-0000timestamp: 1234567890Body:{"userId":"u12","deviceType":"101c120024000810e2010540000044"}待签名字符串:/css/v1/protected/familyService/family{"userId":"u12","deviceType":"101c120024000810e2010540000044"}SV-ABC-0000e8a1e19058c0928d7690cfd59c6b062d签名字符串:7c2e0ff62383263f10179d614c5a92df给定的参数如何用JS 拼接成待签名字符串主要是几个参数拼接,求JS 方法如何拼接成/css/v1/protected/familyService/family{"userId":"u12","deviceType":"101c120024000810e2010540000044"}SV-ABC-0000e8a1e19058c0928d7690cfd59c6b062d最后字符串如何转换成签名字符串 sign=SHA256(url字符串 + Body字符串+appId+appKey +timestamp);
1 回答
RISEBY
TA贡献1856条经验 获得超5个赞
//封装全局签名函数
Vue.prototype.signGenerate = (obj, key) => {
let str0 = '';
for (let i in obj) {
if (i != 'sign') {
let str1 = '';
str1 = i + '=' + obj[i];
str0 += str1;
}
}
return sha1(str0 + key);
};
//调用
let obj = {
appid: '',
terminalNumber: '',
time: parseInt(new Date().getTime() / 1000)
};
obj.sign = this.signGenerate(obj, this.key);
添加回答
举报
0/150
提交
取消