| 362 | } |
| 363 | |
| 364 | async sign() { |
| 365 | const before = await this.signInfo(); |
| 366 | const today = (before.checkInList || []).find((item) => Number(item.isCheckInDay) === 1) || {}; |
| 367 | if (Number(today.isCheckIn) === 1) { |
| 368 | this.log("签到结果: 今日已签到"); |
| 369 | return before; |
| 370 | } |
| 371 | |
| 372 | const url = "https://act-ug.vip.com/checkInAward/withSign/checkin"; |
| 373 | const data = { ...this.baseData(), openid: this.vipOpenid, actId: ACT_ID, biz_code: "old" }; |
| 374 | const { status, data: res } = await request({ |
| 375 | method: "POST", |
| 376 | url: `${url}?api_key=${API_KEY}`, |
| 377 | headers: this.signedHeaders(url, data), |
| 378 | data: form(data), |
| 379 | }); |
| 380 | if (status !== 200 || Number(res?.code) !== 1) { |
| 381 | const message = String(res?.msg || ""); |
| 382 | if (/已签|重复|already/i.test(message)) { |
| 383 | this.log("签到结果: 今日已签到"); |
| 384 | return this.signInfo(); |
| 385 | } |
| 386 | throw new Error(`签到失败 HTTP ${status}: ${short(res)}`); |
| 387 | } |
| 388 | const result = res.data || {}; |
| 389 | this.log( |
| 390 | `签到结果: 成功,获得${result.awardAmount ?? result.awardValDesc ?? "-"},累计${result.numTotal ?? "-"}天,连续${ |
| 391 | result.nonStopNum ?? "-" |
| 392 | }天` |
| 393 | ); |
| 394 | return this.signInfo(); |
| 395 | } |
| 396 | |
| 397 | async run() { |
| 398 | try { |