()
| 313 | } |
| 314 | |
| 315 | async doSign() { |
| 316 | try { |
| 317 | const date = todayInfo(); |
| 318 | const monthInfo = await this.queryMonthSign(); |
| 319 | const signedList = Array.isArray(monthInfo?.signDateList) ? monthInfo.signDateList : []; |
| 320 | if (signedList.some((item) => normalizeDate(item) === date.today)) { |
| 321 | $.log(`账号[${this.index}] 今日已签到`); |
| 322 | return; |
| 323 | } |
| 324 | |
| 325 | const data = await this.request("/activity/sign/sign", { |
| 326 | activityId: this.signActivityId, |
| 327 | shopId: this.shopId, |
| 328 | signDate: date.today, |
| 329 | }, "POST"); |
| 330 | const integral = data?.integral ?? data?.memberDayIntegral ?? "未知"; |
| 331 | $.log(`账号[${this.index}] 签到成功: +${integral}积分`); |
| 332 | } catch (e) { |
| 333 | const message = String(e.message || e); |
| 334 | if (/已签|重复|already/i.test(message)) { |
| 335 | $.log(`账号[${this.index}] 今日已签到`); |
| 336 | return; |
| 337 | } |
| 338 | $.log(`账号[${this.index}] 签到失败: ${message}`); |
| 339 | if (isTokenError(message)) this.removeCachedToken(); |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | !(async () => { |
no test coverage detected