(pathname, data)
| 147 | } |
| 148 | |
| 149 | async function gateway(pathname, data) { |
| 150 | const res = await axios.post(`${PASSPORT_BASE}/${pathname}`, JSON.stringify(data), { |
| 151 | timeout: 30000, |
| 152 | validateStatus: () => true, |
| 153 | headers: { |
| 154 | "Content-Type": "application/json", |
| 155 | "User-Agent": "Mozilla/5.0 MicroMessenger MiniProgramEnv/Windows", |
| 156 | Referer: `https://servicewechat.com/${MINI_APP_ID}/${PACKAGE_VERSION}/page-frame.html`, |
| 157 | }, |
| 158 | }); |
| 159 | if (res.status !== 200 || Number(res.data?.ReturnCode) !== 0) { |
| 160 | throw new Error(`${pathname}失败: ${JSON.stringify(res.data)}`); |
| 161 | } |
| 162 | return parseJsonMaybe(res.data.Result || "{}"); |
| 163 | } |
| 164 | |
| 165 | async function h5Api(pathname, data, account) { |
| 166 | const cookies = []; |
no test coverage detected