()
| 225 | } |
| 226 | |
| 227 | async getLoginCode() { |
| 228 | if (!process.env.wx_auth) throw new Error("缺少 wx_auth,无法从 wx_server 获取 code"); |
| 229 | const { data } = await wechat.getCode(this.raw); |
| 230 | const code = data?.code || data?.data?.code; |
| 231 | if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`); |
| 232 | return code; |
| 233 | } |
| 234 | |
| 235 | async loginByWxCode() { |
| 236 | try { |