修改 动态更新周期修改为每天

This commit is contained in:
Suwings 2019-10-03 10:54:34 +08:00
parent 80643ca4b2
commit 2a736b1eeb
4 changed files with 14 additions and 52 deletions

10
app.js
View File

@ -67,7 +67,9 @@ const counter = require('./core/counter');
const DataModel = require('./core/DataModel');
const ftpServerInterface = require('./ftpd/ftpserver');
const tokenManger = require('./helper/TokenManager');
const nodeSchedule = require("node-schedule");
const Schedule = require('./helper/Schedule');
const RequestNews = require('./model/RequestNews');
//控制台颜色
const colors = require('colors');
@ -289,5 +291,13 @@ app.get('*', function (req, res) {
res.end();
})
//设置定时获取最新新闻动态
nodeSchedule.scheduleJob('59 59 23 * *', function () {
MCSERVER.infoLog('INFO', '自动更新新闻动态与最新消息');
RequestNews.requestNews();
});
//程序退出信号处理
require('./core/procexit');

View File

@ -1,11 +0,0 @@
const DataModel = require('../DataModel');
module.exports.SoftConfig = class {
constructor() {
this.dataModel = new DataModel();
this.dataModel.prot = 24444;
}
}

View File

@ -1,39 +0,0 @@
//表实体
class Table {
constructor(tableName) {
this.tableName = tableName;
this._objs = {};
}
setItem(k, v = null) {
this._objs[k] = v;
}
addItem(k, v = null) {
if (this._objs[k])
throw new Error("ADD_ITEM_ERROR: This is not null!");
else
this._objs[k] = v;
}
delItem(k, v = null) {
delete this._objs[k];
}
toString() {
return JSON.stringify(this._objs);
}
}
//权限表实体
class PermissionTable extends Table {
constructor(tableName) {
super(tableName);
}
}
module.exports = {
PermissionTable,
Table
}

View File

@ -18,7 +18,7 @@ function requestNewsError() {
}
}
//get 请求外网
//请求下载最新动态并且缓存到本地
function requestNews() {
let req = http.get(requestNewsUrl, function (req, res) {
var html = '';
@ -42,4 +42,6 @@ function requestNews() {
});
}
module.exports = requestNews;
module.exports = {
requestNews
}