Commit b54ea60a authored by 徐光星's avatar 徐光星

feat: 增加定时任务删除历史记录表一年前的数据

parent dddab3dc
...@@ -7,8 +7,8 @@ export default class RecordsService extends Service { ...@@ -7,8 +7,8 @@ export default class RecordsService extends Service {
this.context = ctx; this.context = ctx;
} }
async clearInvalidPageHistoryRecords() { async clearInvalidPageHistoryRecords() {
// 操作记录表直接删除年以上的操作记录 // 操作记录表直接删除年以上的操作记录
const limitDate = new Date(new Date().getTime() - 180 * 24 * 3600 * 1000).toLocaleDateString().replace(/\//g, '-') const limitDate = new Date(new Date().getTime() - 365 * 24 * 3600 * 1000).toLocaleDateString().replace(/\//g, '-')
try { try {
this.context.logger.info(`开始删除页面历史记录,删除范围为日期在${limitDate}之前的所有记录`); this.context.logger.info(`开始删除页面历史记录,删除范围为日期在${limitDate}之前的所有记录`);
await this.context.model.PageHistory.destroy({ await this.context.model.PageHistory.destroy({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment