()
| 164 | } |
| 165 | |
| 166 | async getLoginCode() { |
| 167 | if (!process.env.wx_auth) throw new Error("缺少 wx_auth,无法从 wx_server 获取 code"); |
| 168 | const { data } = await wechat.getCode(this.openid); |
| 169 | const code = data?.code || data?.data?.code; |
| 170 | if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`); |
| 171 | return code; |
| 172 | } |
| 173 | |
| 174 | async loginByWxCode() { |
| 175 | try { |