()
| 227 | } |
| 228 | |
| 229 | async loginByWxCode() { |
| 230 | try { |
| 231 | const code = await this.getLoginCode(); |
| 232 | const data = await this.request("/wxAppLogin", { |
| 233 | code, |
| 234 | appid: MINI_APP_ID, |
| 235 | shopId: null, |
| 236 | envVersion: "", |
| 237 | isEnterpriseWx: false, |
| 238 | scene: "", |
| 239 | referrerInfo: "", |
| 240 | }, "POST"); |
| 241 | this.applyToken({ |
| 242 | token: data?.mobileToken, |
| 243 | shopId: data?.shopId, |
| 244 | shopName: data?.shopName, |
| 245 | }); |
| 246 | this.saveCachedToken(); |
| 247 | $.log(`账号[${this.index}] 登录成功: ${this.shopName || this.shopId || "未知门店"}`); |
| 248 | } catch (e) { |
| 249 | $.log(`账号[${this.index}] 登录失败: ${e.message || e}`); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | async checkToken() { |
| 254 | try { |
no test coverage detected