var r = function(e) { var t = n.md5(navigator.appVersion) , r = "" + (newDate).getTime() , i = r + parseInt(10 * Math.random(), 10); return { ts: r, bv: t, salt: i, sign: n.md5("fanyideskweb" + e + i + "Ygy_4c=r#e#4EX^NUGUc5") } };
将其稍微修改加入本地代码:
let generateSaltSign = function(e) { var t = n.md5(navigator.appVersion) , r = "" + (newDate).getTime() , i = r + parseInt(10 * Math.random(), 10); return { ts: r, bv: t, salt: i, sign: n.md5("fanyideskweb" + e + i + "Ygy_4c=r#e#4EX^NUGUc5") } };
let generateSaltSign = function(e) { const navigator = { appVersion:'5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56' }
let t = cryptojs.MD5(navigator.appVersion).toString() , r = "" + (newDate).getTime() , i = r + parseInt(10 * Math.random(), 10); return { ts: r, bv: t, salt: i, sign: cryptojs.MD5("fanyideskweb" + e + i + "Ygy_4c=r#e#4EX^NUGUc5").toString() } };
let n = '测试' , r =generateSaltSign(n) , i = n.length;
let need = { salt : r.salt, sign : r.sign, lts :r.ts, bv :r.bv }
console.log(need)
将其封装一下,最终代码:
const cryptojs = require('crypto-js')
let generateSaltSign = function(e) { const navigator = { appVersion:'5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56' }
let t = cryptojs.MD5(navigator.appVersion).toString() , r = "" + (newDate).getTime() , i = r + parseInt(10 * Math.random(), 10); return { ts: r, bv: t, salt: i, sign: cryptojs.MD5("fanyideskweb" + e + i + "Ygy_4c=r#e#4EX^NUGUc5").toString() } };
functiongetIt(text){ let n = text , r =generateSaltSign(n) , i = n.length;
let need = { salt : r.salt, sign : r.sign, lts :r.ts, bv :r.bv }