| 121 | } |
| 122 | |
| 123 | async function request(options) { |
| 124 | const res = await axios.request({ |
| 125 | timeout: 30000, |
| 126 | validateStatus: () => true, |
| 127 | ...options, |
| 128 | headers: { |
| 129 | Accept: "application/json, text/plain, */*", |
| 130 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 MicroMessenger MiniProgramEnv/Windows", |
| 131 | Referer: `https://servicewechat.com/${MINI_APP_ID}/${PACKAGE_VERSION}/page-frame.html`, |
| 132 | ...(options.headers || {}), |
| 133 | }, |
| 134 | }); |
| 135 | return { status: res.status, data: res.data, headers: res.headers || {} }; |
| 136 | } |
| 137 | |
| 138 | async function getWxCode(openid) { |
| 139 | if (!WX_AUTH) throw new Error("未配置 wx_auth,无法从 wx_server 获取 code"); |