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

Function getTask

activity/jd_super_box.js:113–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112
113function getTask() {
114 return new Promise(resolve => {
115 $.get(taskUrl('apTaskList',{"linkId":"xrfyA3nByKnAd7qxzmURNQ","encryptPin":""}), async (err, resp, data) => {
116 try {
117 if (err) {
118 console.log(`${JSON.stringify(err)}`)
119 console.log(`${$.name} API请求失败,请检查网路重试`)
120 } else {
121 if (safeGet(data)) {
122 data = JSON.parse(data);
123 if (data.success) {
124 for(let vo of data.data){
125 if(vo.taskType==='BROWSE_SHOP'){
126 if(vo.taskDoTimes<vo.taskLimitTimes) {
127 console.log(`去做${vo.taskTitle}任务`)
128 for(let i = vo.taskDoTimes;i<vo.taskLimitTimes;++i){
129 await getTaskDetail(vo.id,vo.taskType)
130 return
131 }
132 }
133 else
134 console.log(`${vo.taskTitle}任务已做完`)
135 }else if(vo.taskType==='SHARE_INVITE'){
136 console.log(`助力任务完成进度${vo.taskDoTimes}/${vo.taskLimitTimes}`)
137 }
138 }
139 } else {
140 console.log(`任务获取失败`)
141 }
142 }
143 }
144 } catch (e) {
145 $.logErr(e, resp)
146 } finally {
147 resolve();
148 }
149 })
150 })
151}
152function getTaskDetail(taskId,taskType) {
153 let body = {
154 "taskId":taskId,

Callers 1

superBoxFunction · 0.70

Calls 6

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

Tested by

no test coverage detected