You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
329 B
22 lines
329 B
import md5 from "md5";
|
|
|
|
function useSign(params: any) {
|
|
const timestamp = new Date().getTime();
|
|
|
|
let arr = [`timestamp=${timestamp}`];
|
|
|
|
for (const i in params) {
|
|
arr.push(`${i}=${decodeURIComponent(params[i])}`);
|
|
}
|
|
|
|
arr.sort();
|
|
|
|
const sign = md5(arr.join("&"));
|
|
|
|
return {
|
|
timestamp,
|
|
sign,
|
|
};
|
|
}
|
|
|
|
export { useSign };
|
|
|