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

Function doTry

jd_try.js:362–387  ·  view source on GitHub ↗
(good)

Source from the content-addressed store, hash-verified

360}
361
362async function doTry(good) {
363 return new Promise((resolve, reject) => {
364 $.get(taskurl(`${selfDomain}/migrate/apply?activityId=${good.id}&source=1&_s=m`, good.id), (err, resp, data) => {
365 try {
366 if (err) {
367 console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
368 } else {
369 data = JSON.parse(data)
370 if (data.success) {
371 $.totalTry += 1
372 console.log(`🥳 ${good.id} 🛒${good.trialName.substr(0,15)}🛒 ${data.message}`)
373 } else if (data.code == '-131') { // 每日300个商品
374 $.stopMsg = data.message
375 $.running = false
376 } else {
377 console.log(`🤬 ${good.id} 🛒${good.trialName.substr(0,15)}🛒 ${JSON.stringify(data)}`)
378 }
379 }
380 } catch (e) {
381 reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
382 } finally {
383 resolve()
384 }
385 })
386 })
387}
388
389async function getSuccessList() {
390 // 一页12个商品,不会吧不会吧,不会有人一次性中奖12个商品吧?!🤔

Callers 1

tryGoodListFunction · 0.85

Calls 3

taskurlFunction · 0.70
getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected