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

Function doTask

jd_cash.js:235–260  ·  view source on GitHub ↗
(type,taskInfo)

Source from the content-addressed store, hash-verified

233 })
234}
235function doTask(type,taskInfo) {
236 return new Promise((resolve) => {
237 $.get(taskUrl("cash_doTask",{"type":type,"taskInfo":taskInfo}), (err, resp, data) => {
238 try {
239 if (err) {
240 console.log(`${JSON.stringify(err)}`)
241 console.log(`${$.name} API请求失败,请检查网路重试`)
242 } else {
243 if (safeGet(data)) {
244 data = JSON.parse(data);
245 if( data.code === 0){
246 console.log(`任务完成成功`)
247 // console.log(data.data.result.taskInfos)
248 }else{
249 console.log(data)
250 }
251 }
252 }
253 } catch (e) {
254 $.logErr(e, resp)
255 } finally {
256 resolve(data);
257 }
258 })
259 })
260}
261function getReward(source = 1) {
262 return new Promise((resolve) => {
263 $.get(taskUrl("cash_mob_reward",{"source": Number(source),"rewardNode":""}), (err, resp, data) => {

Callers 1

indexFunction · 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