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

Function goldCreatorDoTask

jd_gold_creator.js:216–246  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

214 }
215}
216function goldCreatorDoTask(body) {
217 return new Promise(resolve => {
218 const options = taskUrl('goldCreatorDoTask', body)
219 $.get(options, async (err, resp, data) => {
220 try {
221 if (err) {
222 console.log(`${JSON.stringify(err)}`)
223 console.log(`${$.name} goldCreatorDetail API请求失败,请检查网路重试`)
224 } else {
225 if (safeGet(data)) {
226 data = JSON.parse(data)
227 if (data.code === '0') {
228 if (data.result.taskCode === '0') {
229 console.log(`成功,获得 ${data.result.lotteryScore}京豆\n`);
230 if (data.result.lotteryScore) $.beans += parseInt(data.result.lotteryScore);
231 } else {
232 console.log(`失败:${data.result['taskMsg']}\n`);
233 }
234 } else {
235 console.log(`失败:${JSON.stringify(data)}\n`);
236 }
237 }
238 }
239 } catch (e) {
240 $.logErr(e, resp)
241 } finally {
242 resolve();
243 }
244 })
245 })
246}
247function taskUrl(function_id, body = {}) {
248 return {
249 url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=content_ecology&clientVersion=10.0.0&client=wh5&eufv=false&uuid=`,

Callers 2

doTaskFunction · 0.85
doTask2Function · 0.85

Calls 5

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

Tested by

no test coverage detected