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

Function canTry

jd_try.js:281–302  ·  view source on GitHub ↗
(good)

Source from the content-addressed store, hash-verified

279}
280
281function canTry(good) {
282 return new Promise((resolve, reject) => {
283 let ret = false
284 $.get(taskurl(`${selfDomain}/activity?id=${good.id}`), (err, resp, data) => {
285 try {
286 if (err) {
287 console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
288 } else {
289 ret = data.indexOf('trySku') != -1
290 let result = data.match(/"shopId":(\d+)/)
291 if (result) {
292 good.shopId = eval(result[1])
293 }
294 }
295 } catch (e) {
296 reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
297 } finally {
298 resolve(ret)
299 }
300 })
301 })
302}
303
304function isFollowed(good) {
305 return new Promise((resolve, reject) => {

Callers 1

tryGoodListFunction · 0.85

Calls 3

taskurlFunction · 0.70
getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected