Commit a76016be authored by 郭志伟's avatar 郭志伟

feat: 刷新功能开发完成

parent ec30a0f2
......@@ -72,7 +72,22 @@ export default class EditorController extends Controller {
}
public async clearCache(ctx: Context) {
ctx.body = ctx.helper.ok({});
const where = {
updated_at: {
[ctx.model.Sequelize.Op.lt]: Date.now(),
[ctx.model.Sequelize.Op.gt]: new Date(Date.now() - 1000 * 60 * 60 * 24 * 7)
},
enable: 1,
isPublish: 1
};
const pageInfo = await ctx.model.PageInfo.findAll({
attributes: ['uuid'],
where
});
pageInfo.forEach(async item => {
await ctx.service.redis.del(`page:${item.uuid}`);
});
ctx.body = ctx.helper.ok();
}
public async delete(ctx: Context) {
......
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