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

Function getTaskList

jd_ms.js:136–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134 })
135}
136function getTaskList() {
137 let body = {"encryptProjectId": $.encryptProjectId, "sourceCode": "wh5"}
138 return new Promise(resolve => {
139 $.post(taskPostUrl('queryInteractiveInfo', body), async (err, resp, data) => {
140 try {
141 if (err) {
142 console.log(`${err},${jsonParse(resp.body)['message']}`)
143 console.log(`${$.name} API请求失败,请检查网路重试`)
144 } else {
145 if (safeGet(data)) {
146 data = JSON.parse(data)
147 $.risk = false
148 if (data.code === '0') {
149 for (let vo of data.assignmentList) {
150 if($.risk) break
151 if (vo['completionCnt'] < vo['assignmentTimesLimit']) {
152 if (vo['assignmentType'] === 1) {
153 if(vo['ext'][vo['ext']['extraType']].length === 0) continue;
154 for (let i = vo['completionCnt']; i < vo['assignmentTimesLimit']; ++i) {
155 console.log(`去做${vo['assignmentName']}任务:${i + 1}/${vo['assignmentTimesLimit']}`)
156 let body = {
157 "encryptAssignmentId": vo['encryptAssignmentId'],
158 "itemId": vo['ext'][vo['ext']['extraType']][i]['itemId'],
159 "actionType": 1,
160 "completionFlag": ""
161 }
162 await doTask(body)
163 await $.wait(vo['ext']['waitDuration'] * 1000 + 500)
164 body['actionType'] = 0
165 await doTask(body)
166 }
167 } else if (vo['assignmentType'] === 0) {
168 for (let i = vo['completionCnt']; i < vo['assignmentTimesLimit']; ++i) {
169 console.log(`去做${vo['assignmentName']}任务:${i + 1}/${vo['assignmentTimesLimit']}`)
170 let body = {
171 "encryptAssignmentId": vo['encryptAssignmentId'],
172 "itemId": "",
173 "actionType": "0",
174 "completionFlag": true
175 }
176 await doTask(body)
177 await $.wait(1000)
178 }
179 } else if (vo['assignmentType'] === 3) {
180 for (let i = vo['completionCnt']; i < vo['assignmentTimesLimit']; ++i) {
181 console.log(`去做${vo['assignmentName']}任务:${i + 1}/${vo['assignmentTimesLimit']}`)
182 let body = {
183 "encryptAssignmentId": vo['encryptAssignmentId'],
184 "itemId": vo['ext'][vo['ext']['extraType']][i]['itemId'],
185 "actionType": 0,
186 "completionFlag": ""
187 }
188 await doTask(body)
189 await $.wait(1000)
190 }
191 }
192 }
193 }

Callers 1

jdMsFunction · 0.70

Calls 8

taskPostUrlFunction · 0.70
jsonParseFunction · 0.70
safeGetFunction · 0.70
doTaskFunction · 0.70
postMethod · 0.45
logMethod · 0.45
waitMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected