()
| 1256 | return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()); |
| 1257 | } |
| 1258 | function 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 | //提交互助码 |
| 1282 | function submitCode() { |
| 1283 | return new Promise(async resolve => { |
no test coverage detected