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

Function doTask

activity/jd_immortal.js:125–153  ·  view source on GitHub ↗
(itemToken)

Source from the content-addressed store, hash-verified

123}
124
125function doTask(itemToken) {
126 return new Promise((resolve) => {
127 $.post(taskPostUrl('mcxhd_brandcity_doTask', {itemToken: itemToken}, 'mcxhd_brandcity_doTask'), async (err, resp, data) => {
128 try {
129 if (err) {
130 console.log(`${JSON.stringify(err)}`)
131 console.log(`${$.name} API请求失败,请检查网路重试`)
132 } else {
133 data = JSON.parse(data);
134 if (data && data['retCode'] === "200") {
135 if (data.result.score)
136 console.log(`任务完成成功,获得${data.result.score}金币`)
137 else if (data.result.taskToken)
138 console.log(`任务请求成功,等待${$.duration}秒`)
139 else {
140 console.log(`任务请求结果未知`)
141 }
142 } else {
143 console.log(data.retMessage)
144 }
145 }
146 } catch (e) {
147 $.logErr(e, resp);
148 } finally {
149 resolve();
150 }
151 })
152 })
153}
154
155function doTask2(taskToken) {
156 let body = {

Callers 2

helpFriendsFunction · 0.70
getTaskListFunction · 0.70

Calls 4

taskPostUrlFunction · 0.70
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected