| 66 | } |
| 67 | |
| 68 | function getSign(method, apiPath, params, timestamp) { |
| 69 | let valueText = ""; |
| 70 | const keys = Object.keys(params || {}).sort(); |
| 71 | for (const key of keys) { |
| 72 | let value = params[key]; |
| 73 | if (value === "" || value === null || value === undefined) continue; |
| 74 | if (typeof value !== "string") { |
| 75 | if (Object.prototype.toString.call(value) === "[object Object]") { |
| 76 | Object.keys(value).forEach((itemKey) => { |
| 77 | if (value[itemKey] === null) delete value[itemKey]; |
| 78 | }); |
| 79 | } |
| 80 | value = JSON.stringify(value); |
| 81 | } |
| 82 | valueText += value; |
| 83 | } |
| 84 | const paramSign = base64(valueText); |
| 85 | return md5(base64(`${method.toUpperCase()}${apiPath}${paramSign}${timestamp}`)); |
| 86 | } |
| 87 | |
| 88 | function formatMonth() { |
| 89 | const date = new Date(); |