wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 };