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

Function getGoodList

activity/jd_5g.js:285–310  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

283 })
284}
285function getGoodList() {
286 return new Promise((resolve) => {
287 $.get(taskUrl('task/listGoods'), async (err, resp, data) => {
288 try {
289 if (err) {
290 console.log(`${JSON.stringify(err)}`)
291 console.log(`${$.name} API请求失败,请检查网路重试`)
292 } else {
293 data = JSON.parse(data);
294 if (data && data['code'] === 200) {
295 for(let vo of data.data.goodsList){
296 await browseGood(vo['id'])
297 await getGoodPrize(vo['id'])
298 }
299 } else {
300 console.log(JSON.stringify(data))
301 }
302 }
303 } catch (e) {
304 $.logErr(e, resp);
305 } finally {
306 resolve();
307 }
308 })
309 })
310}
311function browseGood(id) {
312 return new Promise((resolve) => {
313 $.get(taskUrl('task/browseGoods', `skuId=${id}`), async (err, resp, data) => {

Callers 1

jdFiveFunction · 0.70

Calls 6

browseGoodFunction · 0.85
getGoodPrizeFunction · 0.85
taskUrlFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected