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

Function readShareCode

jd_fruit.js:1258–1280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1256 return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
1257}
1258function readShareCode() {
1259 return new Promise(async resolve => {
1260 $.get({url: `http://www.helpu.cf/jdcodes/getcode.php?type=farm&num=${randomCount}`, timeout: 10000,}, (err, resp, data) => {
1261 try {
1262 if (err) {
1263 console.log(`${JSON.stringify(err)}`)
1264 console.log(`${$.name} API请求失败,请检查网路重试`)
1265 } else {
1266 if (data) {
1267 console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
1268 data = JSON.parse(data);
1269 }
1270 }
1271 } catch (e) {
1272 $.logErr(e, resp)
1273 } finally {
1274 resolve(data);
1275 }
1276 })
1277 await $.wait(10000);
1278 resolve()
1279 })
1280}
1281//提交互助码
1282function submitCode() {
1283 return new Promise(async resolve => {

Callers 1

shareCodesFormatFunction · 0.70

Calls 4

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

Tested by

no test coverage detected