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

Function readShareCode

jd_sgmh.js:320–346  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

318}
319
320function readShareCode() {
321 console.log(`开始`)
322 return new Promise(async resolve => {
323 $.get({
324 url: `http://www.helpu.cf/jdcodes/getcode.php?type=sgmh&num=${randomCount}`,
325 'timeout': 10000
326 }, (err, resp, data) => {
327 try {
328 if (err) {
329 console.log(`${JSON.stringify(err)}`)
330 console.log(`${$.name} API请求失败,请检查网路重试`)
331 } else {
332 if (data) {
333 console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`)
334 data = JSON.parse(data);
335 }
336 }
337 } catch (e) {
338 $.logErr(e, resp)
339 } finally {
340 resolve(data);
341 }
342 })
343 await $.wait(2000);
344 resolve()
345 })
346}
347//提交互助码
348function submitCode() {
349 return new Promise(async resolve => {

Callers 1

shareCodesFormatFunction · 0.70

Calls 4

logMethod · 0.45
getMethod · 0.45
logErrMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected