修复列表查询字符转码

This commit is contained in:
whyour 2023-06-04 22:11:48 +08:00
parent 26c914d1db
commit f64ff83414
5 changed files with 26 additions and 37 deletions

View File

@ -21,7 +21,7 @@ import { spawn } from 'cross-spawn';
@Service()
export default class CronService {
constructor(@Inject('logger') private logger: winston.Logger) { }
constructor(@Inject('logger') private logger: winston.Logger) {}
private isSixCron(cron: Crontab) {
const { schedule } = cron;
@ -194,17 +194,13 @@ export default class CronService {
{
[operate2]: [
{ [operate]: `%${value}%` },
{ [operate]: `%${encodeURIComponent(value)}%` },
{ [operate]: `%${encodeURI(value)}%` },
],
},
{
[operate2]: [
where(colFn(property), operate, `%${value}%`),
where(
colFn(property),
operate,
`%${encodeURIComponent(value)}%`,
),
where(colFn(property), operate, `%${encodeURI(value)}%`),
],
},
],
@ -231,7 +227,7 @@ export default class CronService {
q[column] = {
[Op.or]: [
{ [Op.like]: `%${textArray[1]}%` },
{ [Op.like]: `%${encodeURIComponent(textArray[1])}%` },
{ [Op.like]: `%${encodeURI(textArray[1])}%` },
],
};
break;
@ -239,7 +235,7 @@ export default class CronService {
const reg = {
[Op.or]: [
{ [Op.like]: `%${searchText}%` },
{ [Op.like]: `%${encodeURIComponent(searchText)}%` },
{ [Op.like]: `%${encodeURI(searchText)}%` },
],
};
q[Op.or] = [
@ -367,9 +363,9 @@ export default class CronService {
{ status: CrontabStatus.queued },
{ where: { id: ids } },
);
ids.forEach(id => {
this.runSingle(id)
})
ids.forEach((id) => {
this.runSingle(id);
});
}
public async stop(ids: number[]) {
@ -451,7 +447,7 @@ export default class CronService {
resolve();
});
});
})
});
}
public async disabled(ids: number[]) {

View File

@ -21,7 +21,7 @@ export default class DependenceService {
constructor(
@Inject('logger') private logger: winston.Logger,
private sockService: SockService,
) { }
) {}
public async create(payloads: Dependence[]): Promise<Dependence[]> {
const tabs = payloads.map((x) => {
@ -79,7 +79,7 @@ export default class DependenceService {
): Promise<Dependence[]> {
let condition = { ...query, type: DependenceTypes[type as any] };
if (searchValue) {
const encodeText = encodeURIComponent(searchValue);
const encodeText = encodeURI(searchValue);
const reg = {
[Op.or]: [
{ [Op.like]: `%${searchValue}%` },
@ -106,12 +106,8 @@ export default class DependenceService {
force: boolean = false,
) {
docs.forEach((dep) => {
this.installOrUninstallDependencies(
[dep],
isInstall,
force,
)
})
this.installOrUninstallDependencies([dep], isInstall, force);
});
}
public async reInstall(ids: number[]): Promise<Dependence[]> {
@ -186,7 +182,9 @@ export default class DependenceService {
});
await this.updateLog(depIds, message);
const cp = spawn(`${depRunCommand} ${depNames}`, { shell: '/bin/bash' });
const cp = spawn(`${depRunCommand} ${depNames}`, {
shell: '/bin/bash',
});
cp.stdout.on('data', async (data) => {
this.sockService.sendMessage({
@ -250,6 +248,6 @@ export default class DependenceService {
resolve(null);
});
});
})
});
}
}

View File

@ -121,7 +121,7 @@ export default class EnvService {
public async envs(searchText: string = '', query: any = {}): Promise<Env[]> {
let condition = { ...query };
if (searchText) {
const encodeText = encodeURIComponent(searchText);
const encodeText = encodeURI(searchText);
const reg = {
[Op.or]: [
{ [Op.like]: `%${searchText}%` },

View File

@ -75,7 +75,7 @@ export default class OpenService {
): Promise<App[]> {
let condition = { ...query };
if (searchText) {
const encodeText = encodeURIComponent(searchText);
const encodeText = encodeURI(searchText);
const reg = {
[Op.or]: [
{ [Op.like]: `%${searchText}%` },

View File

@ -6,9 +6,7 @@ import {
SubscriptionModel,
SubscriptionStatus,
} from '../data/subscription';
import {
ChildProcessWithoutNullStreams,
} from 'child_process';
import { ChildProcessWithoutNullStreams } from 'child_process';
import fs from 'fs';
import {
getFileContentByName,
@ -37,7 +35,7 @@ export default class SubscriptionService {
private scheduleService: ScheduleService,
private sockService: SockService,
private sshKeyService: SshKeyService,
) { }
) {}
public async list(searchText?: string): Promise<Subscription[]> {
let query = {};
@ -45,7 +43,7 @@ export default class SubscriptionService {
const reg = {
[Op.or]: [
{ [Op.like]: `%${searchText}%` },
{ [Op.like]: `%${encodeURIComponent(searchText)}%` },
{ [Op.like]: `%${encodeURI(searchText)}%` },
],
};
query = {
@ -276,9 +274,9 @@ export default class SubscriptionService {
{ status: SubscriptionStatus.queued },
{ where: { id: ids } },
);
ids.forEach(id => {
this.runSingle(id)
})
ids.forEach((id) => {
this.runSingle(id);
});
}
public async stop(ids: number[]) {
@ -315,10 +313,7 @@ export default class SubscriptionService {
const command = formatCommand(subscription);
this.scheduleService.runTask(
command,
this.taskCallbacks(subscription),
);
this.scheduleService.runTask(command, this.taskCallbacks(subscription));
}
public async disabled(ids: number[]) {