(method, path, data = {})
| 165 | } |
| 166 | |
| 167 | async miniRequest(method, path, data = {}) { |
| 168 | const upperMethod = method.toUpperCase(); |
| 169 | const { status, data: result } = await request({ |
| 170 | method: upperMethod, |
| 171 | url: `${MINI_API}${path}`, |
| 172 | headers: this.miniHeaders(), |
| 173 | params: upperMethod === "GET" ? data : undefined, |
| 174 | data: upperMethod === "GET" ? undefined : data, |
| 175 | }); |
| 176 | if (status !== 200) throw new Error(`${path} HTTP ${status}: ${short(result)}`); |
| 177 | if (result?.ret && String(result.ret) !== "1") { |
| 178 | throw new Error(`${path} 失败: ${result.errMsg || result.message || short(result)}`); |
| 179 | } |
| 180 | return result; |
| 181 | } |
| 182 | |
| 183 | async h5Request(method, path, data = {}) { |
| 184 | const upperMethod = method.toUpperCase(); |
no test coverage detected