From c4425cff88e278d0df5ce40450af9dbd9c5cfa4a Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Sun, 16 Oct 2022 12:29:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=AD=A3=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/user.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/model/user.js b/model/user.js index 7caf22c..6bfb776 100644 --- a/model/user.js +++ b/model/user.js @@ -98,7 +98,9 @@ export default class user { await utils.sleepAsync(3000) //等几毫秒免得请求太频繁了 if (res?.data?.list?.length === 0 || !res?.data?.list) { message += `签到: 未绑定${forum.name}信息\n`; - this.allSign[forum.name].bindGame++; + if(this.allSign){ + this.allSign[forum.name].bindGame++; + } utils.randomSleepAsync() continue; } @@ -111,7 +113,9 @@ export default class user { await utils.sleepAsync(500) item.total_sign_day = res?.data?.total_sign_day if (res?.data?.is_sign) { - this.allSign[forum.name].isSign++; + if(this.allSign){ + this.allSign[forum.name].isSign++; + } message += `${item.nickname}-${item.game_uid}:今日已签到~\n`; } else { for (let i = 0; i < 2; i++) { //循环请求 @@ -138,17 +142,24 @@ export default class user { data.headers = header res = await this.getData("sign", data) if (!res?.data?.gt) { - this.allSign[forum.name].sign++; + if(this.allSign){ + this.allSign[forum.name].sign++; + } message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n` break; } else { + if(this.allSign){ + this.allSign[forum.name].error++; + } item.is_sign = false; message += `${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`; } } } else { - this.allSign[forum.name].sign++; + if(this.allSign){ + this.allSign[forum.name].sign++; + } item.total_sign_day++; message += `${item.nickname}-${item.game_uid}:${res.message=="OK"?"签到成功":res.message}\n` @@ -167,7 +178,9 @@ export default class user { await utils.randomSleepAsync() } } catch (e) { - this.allSign[forum.name].error++; + if(this.allSign){ + this.allSign[forum.name].error++; + } Bot.logger.error(`${forum.name} 签到失败 [${res?.message}]`); message += `签到失败: [${res?.message}]\n`; }