This commit is contained in:
aozhiwei 2022-11-25 10:16:46 +08:00
parent a34da39f73
commit 05112f21d0
2 changed files with 42 additions and 0 deletions

View File

@ -9,6 +9,7 @@ function init() {
add('fragment');
add('damping');
add('season');
add('feeback');
}
exports.init = init;

View File

@ -0,0 +1,41 @@
const app = require('j7/app');
const utils = require('j7/utils');
const constant = require('../constant');
class FeeBack {
async start() {
console.log('feeback start');
while (true) {
await this.alloc(utils.getUtcTime());
const nowTime = utils.getUtcTime();
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
const hourSeconds = utils.getHourSeconds(nowTime, constant.TIME_ZONE);
const sleepTime = (3600 - (nowTime - daySeconds - hourSeconds)) + 10;
console.log('feeback sleepTime:' + sleepTime, new Date(), sleepTime /60);
await utils.sleep(sleepTime * 1000);
}
}
async backUser(nowTime) {
try {
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
const hourSeconds = utils.getHourSeconds(nowTime, constant.TIME_ZONE);
const {err, conn} = await app.getDbConn("GameDb20060");
if (err) {
throw err;
}
} catch (err) {
console.log(err);
}
}
}
function init() {
(new FeeBack()).start();
}
exports.init = init;