fix: 对小闪电添加判断; 获取关注出错时直接结束运行

This commit is contained in:
shanmite 2021-04-16 13:38:02 +08:00
parent 0966e91a79
commit abbc70f9b0
2 changed files with 22 additions and 18 deletions

View File

@ -281,6 +281,7 @@ const BiliAPI = {
mid: uid,
photo: false
},
retry: false,
hasCookies: true,
success: responseText => {
const res = strToJson(responseText);

View File

@ -41,21 +41,23 @@ class Monitor extends Public {
async startLottery() {
const allLottery = await this.filterLotteryInfo();
let status = 0;
if (allLottery.length) {
let dyids = [];
for (const Lottery of allLottery) {
status = await this.go(Lottery);
if (!status) break
dyids.push(Lottery.dyid);
if (allLottery instanceof Array) {
if (allLottery.length) {
let dyids = [];
for (const Lottery of allLottery) {
status = await this.go(Lottery);
if (!status) break
dyids.push(Lottery.dyid);
}
if (dyids.length) MyStorage.updateDyid(dyids.toString())
Base.tooltip.log('开始转发下一组动态');
} else {
status = 1;
Base.tooltip.log('无未转发抽奖');
}
if (dyids.length) MyStorage.updateDyid(dyids.toString())
Base.tooltip.log('开始转发下一组动态');
} else {
status = 1;
Base.tooltip.log('无未转发抽奖');
}
status ?
eventBus.emit('Turn_on_the_Monitor') : eventBus.emit('Turn_off_the_Monitor');
} else { status = 0 }
status ? eventBus.emit('Turn_on_the_Monitor') : eventBus.emit('Turn_off_the_Monitor');
}
/**
* 抽奖配置
@ -68,7 +70,7 @@ class Monitor extends Public {
* @property {string} rid 评论类型
*/
/**
* @returns {Promise<LotteryOptions[] | []>}
* @returns {Promise<LotteryOptions[] | null>}
*/
async filterLotteryInfo() {
const self = this,
@ -112,15 +114,16 @@ class Monitor extends Public {
if (hasOfficialLottery && model[0] === '1') {
const oneLNotice = await BiliAPI.getLotteryNotice(dyid);
ts = oneLNotice.ts;
if (!ts) { alllotteryinfo = null; break }
isLottery = ts > now_ts_10 && ts < now_ts_10 + maxday;
isSendChat = chatmodel[0] === '1';
} else if (!hasOfficialLottery && model[1] === '1') {
if (!haslottery) continue;
} else if (!hasOfficialLottery && model[1] === '1' && haslottery && hasGuanZhuan) {
ts = Base.getLotteryNotice(description).ts;
if (!official_verify) {
const followerNum = await BiliAPI.getUserInfo(uid);
if (!followerNum) { alllotteryinfo = null; break }
if (followerNum < Number(minfollower)) continue;
isLottery = hasGuanZhuan && !befilter && (ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday));
isLottery = !befilter && (ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday));
} else {
isLottery = ts === 0 || (ts > now_ts_10 && ts < now_ts_10 + maxday);
}