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

Function queryMaterials

activity/jd_nian.js:703–740  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

701}
702
703function queryMaterials() {
704 let body = {
705 "qryParam": "[{\"type\":\"advertGroup\",\"mapTo\":\"viewLogo\",\"id\":\"05149412\"},{\"type\":\"advertGroup\",\"mapTo\":\"bottomLogo\",\"id\":\"05149413\"}]",
706 "activityId": "2cKMj86srRdhgWcKonfExzK4ZMBy",
707 "pageId": "",
708 "reqSrc": "",
709 "applyKey": "21beast"
710 }
711 return new Promise(resolve => {
712 $.post(taskPostUrl("qryCompositeMaterials", body, "qryCompositeMaterials"), async (err, resp, data) => {
713 try {
714 if (err) {
715 console.log(`${JSON.stringify(err)}`)
716 console.log(`${$.name} API请求失败,请检查网路重试`)
717 } else {
718 if (safeGet(data)) {
719 data = JSON.parse(data);
720 if (data.code === '0') {
721 let shopList = data.data.viewLogo.list.concat(data.data.bottomLogo.list)
722 let nameList = []
723 for (let vo of shopList) {
724 if (nameList.includes(vo.name)) continue
725 nameList.push(vo.name)
726 console.log(`去做${vo.name}店铺任务`)
727 await shopLotteryInfo(vo.desc)
728 await $.wait(2000)
729 }
730 }
731 }
732 }
733 } catch (e) {
734 $.logErr(e, resp)
735 } finally {
736 resolve();
737 }
738 })
739 })
740}
741
742function shopLotteryInfo(shopSign) {
743 let body = {"shopSign": shopSign}

Callers 1

jdNianFunction · 0.85

Calls 7

shopLotteryInfoFunction · 0.85
taskPostUrlFunction · 0.70
safeGetFunction · 0.70
postMethod · 0.45
logMethod · 0.45
waitMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected