mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复删除日志命令
This commit is contained in:
@@ -15,6 +15,7 @@ export default (app: Router) => {
|
||||
const subscriptionService = Container.get(SubscriptionService);
|
||||
const data = await subscriptionService.list(
|
||||
req.query.searchValue as string,
|
||||
req.query.ids as string,
|
||||
);
|
||||
return res.send({ code: 200, data });
|
||||
} catch (e) {
|
||||
@@ -212,8 +213,8 @@ export default (app: Router) => {
|
||||
body: Joi.array().items(Joi.number().required()),
|
||||
query: Joi.object({
|
||||
force: Joi.boolean().optional(),
|
||||
t: Joi.number()
|
||||
})
|
||||
t: Joi.number(),
|
||||
}),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
getUniqPath,
|
||||
safeJSONParse,
|
||||
} from '../config/util';
|
||||
import { Op, where, col as colFn, FindOptions, fn } from 'sequelize';
|
||||
import { Op, where, col as colFn, FindOptions, fn, Order } from 'sequelize';
|
||||
import path from 'path';
|
||||
import { TASK_PREFIX, QL_PREFIX } from '../config/const';
|
||||
import cronClient from '../schedule/client';
|
||||
@@ -362,9 +362,9 @@ export default class CronService {
|
||||
order.unshift([field, type]);
|
||||
}
|
||||
}
|
||||
let condition: any = {
|
||||
let condition: FindOptions<Crontab> = {
|
||||
where: query,
|
||||
order: order,
|
||||
order: order as Order,
|
||||
};
|
||||
if (page && size) {
|
||||
condition.offset = (page - 1) * size;
|
||||
|
||||
@@ -41,8 +41,12 @@ export default class SubscriptionService {
|
||||
private crontabService: CrontabService,
|
||||
) {}
|
||||
|
||||
public async list(searchText?: string): Promise<Subscription[]> {
|
||||
public async list(
|
||||
searchText?: string,
|
||||
ids?: string,
|
||||
): Promise<Subscription[]> {
|
||||
let query = {};
|
||||
const subIds = JSON.parse(ids || '[]');
|
||||
if (searchText) {
|
||||
const reg = {
|
||||
[Op.or]: [
|
||||
@@ -63,7 +67,7 @@ export default class SubscriptionService {
|
||||
}
|
||||
try {
|
||||
const result = await SubscriptionModel.findAll({
|
||||
where: query,
|
||||
where: { ...query, ...(ids ? { id: subIds } : undefined) },
|
||||
order: [
|
||||
['is_disabled', 'ASC'],
|
||||
['createdAt', 'DESC'],
|
||||
|
||||
Reference in New Issue
Block a user