定时任务增加置顶功能

This commit is contained in:
hanhh
2021-09-19 22:25:57 +08:00
parent 1cc54b5da6
commit aa08f489d7
3 changed files with 152 additions and 2 deletions
+26
View File
@@ -115,6 +115,32 @@ export default class CronService {
});
}
public async pin(ids: string[]) {
return new Promise((resolve: any) => {
this.cronDb.update(
{ _id: { $in: ids } },
{ $set: { isPinned: 1 } },
{ multi: true },
async (err) => {
resolve();
},
);
});
}
public async unPin(ids: string[]) {
return new Promise((resolve: any) => {
this.cronDb.update(
{ _id: { $in: ids } },
{ $set: { isPinned: 0 } },
{ multi: true },
async (err) => {
resolve();
},
);
});
}
public async crontabs(searchText?: string): Promise<Crontab[]> {
let query = {};
if (searchText) {