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

Function doTask

activity/jx_sign.js:143–167  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

141 })
142}
143function doTask(id) {
144 return new Promise((resolve) => {
145 $.get(taskUrl("pgcenter/task/drawUserTask",`taskid=${id}`), async (err, resp, data) => {
146 try {
147 if (err) {
148 console.log(`${JSON.stringify(err)}`)
149 console.log(`${$.name} API请求失败,请检查网路重试`)
150 } else {
151 if (safeGet(data)) {
152 data = JSON.parse(data);
153 if(data.retCode ===0){
154 console.log(`任务领取成功`)
155 }else{
156 console.log(`任务完成失败,错误信息${data.errMsg}`)
157 }
158 }
159 }
160 } catch (e) {
161 $.logErr(e, resp)
162 } finally {
163 resolve(data);
164 }
165 })
166 })
167}
168function finishTask(id) {
169 return new Promise((resolve) => {
170 $.get(taskUrl("pgcenter/task/UserTaskFinish",`taskid=${id}`), async (err, resp, data) => {

Callers 1

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