()
| 336 | } |
| 337 | |
| 338 | async run() { |
| 339 | $.log(`\n账号[${this.index}] ${mask(this.openid || this.cacheKey)}`); |
| 340 | |
| 341 | if (this.openid) { |
| 342 | try { |
| 343 | await this.getWxCode(); |
| 344 | } catch (e) { |
| 345 | $.log(`账号[${this.index}] 获取 wxcode 失败,继续使用 token: ${e.message || e}`); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | if (!this.token) this.token = this.getCached().token || ""; |
| 350 | if (!this.token) await this.loginByOperateData(); |
| 351 | this.ensureToken(); |
| 352 | |
| 353 | try { |
| 354 | const member = await this.getMemberInfo(); |
| 355 | $.log(`账号[${this.index}] 会员: ${mask(member.phone || member.account || member.id || "")}`); |
| 356 | } catch (e) { |
| 357 | this.removeToken(); |
| 358 | throw e; |
| 359 | } |
| 360 | |
| 361 | if (this.openid) { |
| 362 | try { |
| 363 | await this.getWxCode(); |
| 364 | } catch (e) { |
| 365 | $.log(`账号[${this.index}] 刷新签到 wxcode 失败: ${e.message || e}`); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | const signInfo = await this.getUserSign(); |
| 370 | this.printSignInfo(signInfo); |
| 371 | await this.receiveCoupon(signInfo.cpId); |
| 372 | |
| 373 | const rewards = await this.queryAllRewards(); |
| 374 | if (rewards.length) $.log(`账号[${this.index}] 奖励列表: ${rewards.length}条`); |
| 375 | |
| 376 | const scroll = await this.queryScrollScreen(); |
| 377 | if (scroll.length) $.log(`账号[${this.index}] 滚屏记录: ${scroll.length}条`); |
| 378 | |
| 379 | const photo = await this.queryPhoto(); |
| 380 | if (photo.activityImg) $.log(`账号[${this.index}] 活动背景已获取`); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | !(async () => { |
no test coverage detected