50 lines
1.1 KiB
JavaScript
50 lines
1.1 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.start');
|
|
let url = getUrl();
|
|
while (true) {
|
|
await http.get(url,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(){
|
|
// 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=resetStar';
|
|
} else {
|
|
url = 'https://game2006api-test.kingsome.cn/webapp/index.php?&c=Star&a=resetStar ';
|
|
}
|
|
return url;
|
|
}
|
|
|
|
function getV(){
|
|
|
|
}
|
|
|
|
function setV(){
|
|
|
|
}
|
|
|
|
function init() {
|
|
(new Star()).start();
|
|
}
|
|
|
|
exports.init = init;
|