MCPcopy Create free account
hub / github.com/NobyDa/Script / signBar

Function signBar

BDTieBa-DailyBonus/TieBa.js:108–152  ·  view source on GitHub ↗
(bar, tbs)

Source from the content-addressed store, hash-verified

106}
107
108function signBar(bar, tbs) {
109 if (bar.is_sign == 1) { //已签到的,直接不请求接口了
110 process.result.push({
111 bar: `${bar.forum_name}`,
112 level: bar.user_level,
113 exp: bar.user_exp,
114 errorCode: 9999,
115 errorMsg: "已签到"
116 });
117 checkIsAllProcessed();
118 } else {
119 url_fetch_add.body = `tbs=${tbs}&kw=${bar.forum_name}&ie=utf-8`;
120 $nobyda.post(url_fetch_add, function(error, response, data) {
121 if (error) {
122 process.result.push({
123 bar: bar.forum_name,
124 errorCode: 999,
125 errorMsg: '接口错误'
126 });
127 checkIsAllProcessed();
128 } else {
129 try {
130 var addResult = JSON.parse(data);
131 if (addResult.no == 0) {
132 process.result.push({
133 bar: bar.forum_name,
134 errorCode: 0,
135 errorMsg: `获得${addResult.data.uinfo.cont_sign_num}积分,第${addResult.data.uinfo.user_sign_rank}个签到`
136 });
137 } else {
138 process.result.push({
139 bar: bar.forum_name,
140 errorCode: addResult.no,
141 errorMsg: addResult.error
142 });
143 }
144 } catch (e) {
145 $nobyda.notify("贴吧签到", "贴吧签到数据处理异常", JSON.stringify(e));
146 $nobyda.done()
147 }
148 checkIsAllProcessed();
149 }
150 })
151 }
152}
153
154function signBars(bars, tbs, index) {
155 //$nobyda.notify("贴吧签到", `进度${index}/${bars.length}`, "");

Callers 1

signTieBaFunction · 0.85

Calls 5

checkIsAllProcessedFunction · 0.85
postMethod · 0.45
notifyMethod · 0.45
stringifyMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected