mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复订阅任务参数
This commit is contained in:
parent
c573186e34
commit
53ef0fe296
|
@ -58,6 +58,6 @@ export default async () => {
|
|||
await subscriptionService.setSshConfig();
|
||||
const subs = await subscriptionService.list();
|
||||
for (const sub of subs) {
|
||||
subscriptionService.handleTask(sub, !sub.is_disabled);
|
||||
subscriptionService.handleTask(sub.get({ plain: true }), !sub.is_disabled);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@ import winston from 'winston';
|
|||
import config from '../config';
|
||||
import {
|
||||
Subscription,
|
||||
SubscriptionInstance,
|
||||
SubscriptionModel,
|
||||
SubscriptionStatus,
|
||||
} from '../data/subscription';
|
||||
|
@ -44,7 +45,7 @@ export default class SubscriptionService {
|
|||
public async list(
|
||||
searchText?: string,
|
||||
ids?: string,
|
||||
): Promise<Subscription[]> {
|
||||
): Promise<SubscriptionInstance[]> {
|
||||
let query = {};
|
||||
const subIds = JSON.parse(ids || '[]');
|
||||
if (searchText) {
|
||||
|
@ -207,12 +208,12 @@ export default class SubscriptionService {
|
|||
public async create(payload: Subscription): Promise<Subscription> {
|
||||
const tab = new Subscription(payload);
|
||||
const doc = await this.insert(tab);
|
||||
await this.handleTask(doc);
|
||||
await this.handleTask(doc.get({ plain: true }));
|
||||
await this.setSshConfig();
|
||||
return doc;
|
||||
}
|
||||
|
||||
public async insert(payload: Subscription): Promise<Subscription> {
|
||||
public async insert(payload: Subscription): Promise<SubscriptionInstance> {
|
||||
return await SubscriptionModel.create(payload, { returning: true });
|
||||
}
|
||||
|
||||
|
@ -264,7 +265,7 @@ export default class SubscriptionService {
|
|||
public async remove(ids: number[], query: { force?: boolean }) {
|
||||
const docs = await SubscriptionModel.findAll({ where: { id: ids } });
|
||||
for (const doc of docs) {
|
||||
await this.handleTask(doc, false);
|
||||
await this.handleTask(doc.get({ plain: true }), false);
|
||||
}
|
||||
await SubscriptionModel.destroy({ where: { id: ids } });
|
||||
await this.setSshConfig();
|
||||
|
@ -341,7 +342,7 @@ export default class SubscriptionService {
|
|||
const docs = await SubscriptionModel.findAll({ where: { id: ids } });
|
||||
await this.setSshConfig();
|
||||
for (const doc of docs) {
|
||||
await this.handleTask(doc, false);
|
||||
await this.handleTask(doc.get({ plain: true }), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +351,7 @@ export default class SubscriptionService {
|
|||
const docs = await SubscriptionModel.findAll({ where: { id: ids } });
|
||||
await this.setSshConfig();
|
||||
for (const doc of docs) {
|
||||
await this.handleTask(doc);
|
||||
await this.handleTask(doc.get({ plain: true }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user