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

Function getGoodListByCond

jd_try.js:172–196  ·  view source on GitHub ↗
(cids, page, pageSize, type, state)

Source from the content-addressed store, hash-verified

170}
171
172function getGoodListByCond(cids, page, pageSize, type, state) {
173 return new Promise((resolve, reject) => {
174 let option = taskurl(`${selfDomain}/activity/list?pb=1&cids=${cids}&page=${page}&pageSize=${pageSize}&type=${type}&state=${state}`)
175 delete option.headers['Cookie']
176 $.get(option, (err, resp, data) => {
177 try {
178 if (err) {
179 console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
180 } else {
181 data = JSON.parse(data)
182 if (data.success) {
183 $.totalPages = data.data.pages
184 allGoodList = allGoodList.concat(data.data.data)
185 } else {
186 console.log(`💩 获得 ${cids} ${page} 列表失败: ${data.message}`)
187 }
188 }
189 } catch (e) {
190 reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
191 } finally {
192 resolve()
193 }
194 })
195 })
196}
197
198async function getGoodList() {
199 if (args.cidsList.length === 0) args.cidsList.push("全部商品")

Callers 1

getGoodListFunction · 0.85

Calls 3

taskurlFunction · 0.70
getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected