52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
const app = require('j7/app');
|
|
const utils = require('j7/utils');
|
|
const http = require('j7/http');
|
|
|
|
|
|
const constant = require('../constant');
|
|
|
|
|
|
class Star {
|
|
async start() {
|
|
console.log('Star And Pass Start');
|
|
let url_star = getUrl('resetStar');
|
|
let url_pass = getUrl('resetPassLevel');
|
|
while (true) {
|
|
await http.get(url_star,null)
|
|
await http.get(url_pass,null)
|
|
const nowTime = utils.getUtcTime();
|
|
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
|
|
const sleepTime = daySeconds + 3600 * 24 - nowTime;
|
|
console.log('Star.sleepTime:' + sleepTime, new Date(), sleepTime / 60);
|
|
await utils.sleep(sleepTime * 1000);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function getUrl(action){
|
|
// let url = 'http://james.com/webapp/index.php?&c=Star&a=resetStar';
|
|
let url = '';
|
|
if (utils.isOnlineEnv()) {
|
|
url = 'https://game2006api-test.cebggame.com/webapp/index.php?&c=Star&a=' + action;
|
|
} else {
|
|
url = 'https://game2006api-test.kingsome.cn/webapp/index.php?&c=Star&a=' + action;
|
|
}
|
|
return url;
|
|
}
|
|
|
|
function getV(){
|
|
|
|
}
|
|
|
|
function setV(){
|
|
|
|
}
|
|
|
|
function init() {
|
|
(new Star()).start();
|
|
}
|
|
|
|
exports.init = init;
|