From 446f5b304b54bb7d7503ead15aa6a4dfd9d833e8 Mon Sep 17 00:00:00 2001 From: NobyDa <53217160+NobyDa@users.noreply.github.com> Date: Mon, 27 Jul 2020 15:48:12 +0800 Subject: [PATCH] Boxjs adjust. --- BDTieBa-DailyBonus/TieBa.js | 14 ++++++++++---- NobyDa_BoxJs.json | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/BDTieBa-DailyBonus/TieBa.js b/BDTieBa-DailyBonus/TieBa.js index 922504c..4ecafb3 100644 --- a/BDTieBa-DailyBonus/TieBa.js +++ b/BDTieBa-DailyBonus/TieBa.js @@ -54,7 +54,6 @@ hostname= c.tieba.baidu.com */ var $nobyda = nobyda(); var cookieVal = $nobyda.read("CookieTB"); -var done = $nobyda.done(); var useParallel = 0; //0自动切换,1串行,2并行(当贴吧数量大于30个以后,并行可能会导致QX崩溃,所以您可以自动切换) var singleNotifyCount = 20; //想签到几个汇总到一个通知里,这里就填几个(比如我有13个要签到的,这里填了5,就会分三次消息通知过去) var process = { @@ -96,20 +95,23 @@ if ($nobyda.isRequest) { function signTieBa() { + useParallel = $nobyda.read("BDTB_DailyBonus_Mode") || useParallel + singleNotifyCount = $nobyda.read("BDTB_DailyBonus_notify") || singleNotifyCount if (!cookieVal) { $nobyda.notify("贴吧签到", "签到失败", "未获取到cookie"); - return; + return $nobyda.done() } $nobyda.get(url_fetch_sign, function(error, response, data) { if (error) { $nobyda.notify("贴吧签到", "签到失败", "未获取到签到列表"); + $nobyda.done() } else { // $nobyda.notify("贴吧签到", "贴吧列表", response.body); var body = JSON.parse(data); var isSuccessResponse = body && body.no == 0 && body.error == "success" && body.data.tbs; if (!isSuccessResponse) { $nobyda.notify("贴吧签到", "签到失败", (body && body.error) ? body.error : "接口数据获取失败"); - return; + return $nobyda.done() } process.total = body.data.like_forum.length; if (body.data.like_forum && body.data.like_forum.length > 0) { @@ -122,7 +124,7 @@ function signTieBa() { } } else { $nobyda.notify("贴吧签到", "签到失败", "请确认您有关注的贴吧"); - return; + return $nobyda.done() } } }) @@ -166,6 +168,7 @@ function signBar(bar, tbs) { } } catch (e) { $nobyda.notify("贴吧签到", "贴吧签到数据处理异常", JSON.stringify(e)); + $nobyda.done() } checkIsAllProcessed(); } @@ -217,6 +220,7 @@ function signBars(bars, tbs, index) { } } catch (e) { $nobyda.notify("贴吧签到", "贴吧签到数据处理异常", JSON.stringify(e)); + $nobyda.done() } signBars(bars, tbs, ++index) } @@ -245,6 +249,7 @@ function checkIsAllProcessed() { } } $nobyda.notify("贴吧签到", `签到${spliceArr.length}个,成功${notifySuccessCount}个`, notify); + $nobyda.done() } } @@ -273,6 +278,7 @@ function GetCookie() { } } } + $nobyda.done() } function nobyda() { diff --git a/NobyDa_BoxJs.json b/NobyDa_BoxJs.json index 8c37870..b6ec5d1 100644 --- a/NobyDa_BoxJs.json +++ b/NobyDa_BoxJs.json @@ -85,6 +85,33 @@ "author": "@NobyDa", "repo": "https://github.com/NobyDa/Script/blob/master/Bilibili-DailyBonus/Manga.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/bilibili.png", "https://raw.githubusercontent.com/Orz-3/task/master/bilibili.png"] + }, { + "id": "BaiduTB", + "name": "百度贴吧", + "keys": ["CookieTB"], + "settings": [{ + "id": "BDTB_DailyBonus_Mode", + "name": "签到模式", + "val": "0", + "type": "radios", + "desc": "", + "items": [ + {"key": "0","label": "自动切换"}, + {"key": "1","label": "顺序执行"}, + {"key": "2","label": "并发执行"} + ] + }, { + "id": "BDTB_DailyBonus_notify", + "name": "通知汇总", + "val": "", + "type": "number", + "placeholder": "默认20 (点击以展开说明)", + "desc": "想签到几个汇总到一个通知里, 这里就填几个(比如我有13个要签到的, 这里填了5, 就会分三次推送通知)" + }], + "script": "https://raw.githubusercontent.com/NobyDa/Script/master/BDTieBa-DailyBonus/TieBa.js", + "author": "@sazs34 (Original)", + "repo": "https://github.com/sazs34/TaskConfig/blob/master/task/sign_baidu_tieba_v2.js", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/baidu.png","https://raw.githubusercontent.com/Orz-3/task/master/baidu.png"] }, { "id": "52poje", "name": "吾爱破解",