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

Function getSuccessList

jd_try.js:389–426  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

387}
388
389async function getSuccessList() {
390 // 一页12个商品,不会吧不会吧,不会有人一次性中奖12个商品吧?!🤔
391 return new Promise((resolve, reject) => {
392 const option = {
393 url: `https://try.jd.com/my/tryList?selected=2&page=1&tryVersion=2&_s=m`,
394 headers: {
395 'Host': 'try.jd.com',
396 'Connection': 'keep-alive',
397 'UserAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
398 'Accept': '*/*',
399 'Referer': 'https://try.m.jd.com/',
400 'Accept-Encoding': 'gzip, deflate, br',
401 'Accept-Language': 'zh,zh-CN;q=0.9,en;q=0.8',
402 'Cookie': $.cookie
403 }
404 }
405 $.get(option, (err, resp, data) => {
406 try {
407 if (err) {
408 console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
409 } else {
410 data = JSON.parse(data)
411 if (data.success && data.data) {
412 $.successList = data.data.data.filter(item => {
413 return item.text.text.indexOf('请尽快领取') != -1
414 })
415 } else {
416 console.log(`💩 获得成功列表失败: ${data.message}`)
417 }
418 }
419 } catch (e) {
420 reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
421 } finally {
422 resolve()
423 }
424 })
425 })
426}
427
428async function showMsg() {
429 let message = `京东账号${$.index} ${$.nickName || $.UserName}\n🎉 本次申请:${$.totalTry}/${$.totalGoods}个商品🛒\n🎉 ${$.successList.length}个商品待领取🤩\n🎉 结束原因:${$.stopMsg}`

Callers 1

jd_try.jsFile · 0.85

Calls 2

getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected