MCPcopy Create free account
hub / github.com/Semporia/Scripts / sign

Function sign

jd_live.js:217–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215 })
216}
217function sign() {
218 return new Promise(resolve => {
219 $.get(taskUrl("getChannelTaskRewardToM", {"type":"signTask","itemId":"1"}), async (err, resp, data) => {
220 try {
221 if (err) {
222 console.log(`${JSON.stringify(err)}`)
223 console.log(`${$.name} API请求失败,请检查网路重试`)
224 } else {
225 if (safeGet(data)) {
226 data = JSON.parse(data);
227 if (data.subCode === "0") {
228 $.bean += data.sum
229 console.log(`签到领奖成功,获得 ${data.sum} 京豆`);
230 message += `任务领奖成功,获得 ${data.sum} 京豆\n`
231 } else {
232 console.log(`任务领奖失败,${data.msg}`)
233 }
234 }
235 }
236 } catch (e) {
237 $.logErr(e, resp)
238 } finally {
239 resolve(data);
240 }
241 })
242 })
243}
244function taskPostUrl(function_id, body = {}, url=null) {
245 if(!url) url = `${JD_API_HOST}?functionId=${function_id}`
246 return {

Callers 1

jdHealthFunction · 0.70

Calls 5

taskUrlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected