| 170 | } |
| 171 | |
| 172 | getHeaders(method, apiPath, payload) { |
| 173 | const timestamp = String(Date.now()); |
| 174 | return { |
| 175 | "User-Agent": USER_AGENT, |
| 176 | "Referer": `https://servicewechat.com/${MINI_APP_ID}/${PAGE_VERSION}/page-frame.html`, |
| 177 | "Accept": "application/json, text/plain, */*", |
| 178 | "Content-Type": "application/json", |
| 179 | "X-Request-Lang": "zh-CN", |
| 180 | "Authorization": this.token || "", |
| 181 | "x-request-ts": timestamp, |
| 182 | "x-request-sign": getSign(method, `/${apiPath}`, payload, timestamp), |
| 183 | }; |
| 184 | } |
| 185 | |
| 186 | async request(apiPath, data = {}, method = "GET", options = {}) { |
| 187 | const payload = options.enterpriseNo ? { ...data } : { enterpriseNo: ENTERPRISE_NO, ...data }; |