This commit is contained in:
aozhiwei 2022-11-25 10:32:43 +08:00
parent 05112f21d0
commit 4dc4dfb55f

View File

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