()
| 423 | } |
| 424 | |
| 425 | async getLoginCode() { |
| 426 | if (!process.env.wx_auth) throw new Error("缺少 wx_auth,无法从 wx_server 获取 code"); |
| 427 | const { data } = await wechat.getCode(this.account); |
| 428 | const code = data?.code || data?.data?.code; |
| 429 | if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`); |
| 430 | return code; |
| 431 | } |
| 432 | |
| 433 | async loginByWxCode() { |
| 434 | const checkData = { |