| 63 | } |
| 64 | |
| 65 | async function request(options) { |
| 66 | const res = await axios.request({ |
| 67 | timeout: 25000, |
| 68 | validateStatus: () => true, |
| 69 | ...options, |
| 70 | headers: { |
| 71 | "User-Agent": USER_AGENT, |
| 72 | Accept: "application/json, text/plain, */*", |
| 73 | "content-type": "application/json", |
| 74 | Referer: `https://servicewechat.com/${APP.appid}/${APP.version}/page-frame.html`, |
| 75 | ...(options.headers || {}), |
| 76 | }, |
| 77 | }); |
| 78 | return { status: res.status, data: res.data, headers: res.headers || {} }; |
| 79 | } |
| 80 | |
| 81 | async function getWxCode(openid) { |
| 82 | if (!WX_AUTH) throw new Error("未配置 wx_auth,无法从 wx_server 获取 code"); |