mirror of
				https://github.com/whyour/qinglong.git
				synced 2025-10-31 17:06:07 +08:00 
			
		
		
		
	修复列表查询字符转码
This commit is contained in:
		
							parent
							
								
									26c914d1db
								
							
						
					
					
						commit
						f64ff83414
					
				|  | @ -21,7 +21,7 @@ import { spawn } from 'cross-spawn'; | ||||||
| 
 | 
 | ||||||
| @Service() | @Service() | ||||||
| export default class CronService { | export default class CronService { | ||||||
|   constructor(@Inject('logger') private logger: winston.Logger) { } |   constructor(@Inject('logger') private logger: winston.Logger) {} | ||||||
| 
 | 
 | ||||||
|   private isSixCron(cron: Crontab) { |   private isSixCron(cron: Crontab) { | ||||||
|     const { schedule } = cron; |     const { schedule } = cron; | ||||||
|  | @ -194,17 +194,13 @@ export default class CronService { | ||||||
|               { |               { | ||||||
|                 [operate2]: [ |                 [operate2]: [ | ||||||
|                   { [operate]: `%${value}%` }, |                   { [operate]: `%${value}%` }, | ||||||
|                   { [operate]: `%${encodeURIComponent(value)}%` }, |                   { [operate]: `%${encodeURI(value)}%` }, | ||||||
|                 ], |                 ], | ||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 [operate2]: [ |                 [operate2]: [ | ||||||
|                   where(colFn(property), operate, `%${value}%`), |                   where(colFn(property), operate, `%${value}%`), | ||||||
|                   where( |                   where(colFn(property), operate, `%${encodeURI(value)}%`), | ||||||
|                     colFn(property), |  | ||||||
|                     operate, |  | ||||||
|                     `%${encodeURIComponent(value)}%`, |  | ||||||
|                   ), |  | ||||||
|                 ], |                 ], | ||||||
|               }, |               }, | ||||||
|             ], |             ], | ||||||
|  | @ -231,7 +227,7 @@ export default class CronService { | ||||||
|           q[column] = { |           q[column] = { | ||||||
|             [Op.or]: [ |             [Op.or]: [ | ||||||
|               { [Op.like]: `%${textArray[1]}%` }, |               { [Op.like]: `%${textArray[1]}%` }, | ||||||
|               { [Op.like]: `%${encodeURIComponent(textArray[1])}%` }, |               { [Op.like]: `%${encodeURI(textArray[1])}%` }, | ||||||
|             ], |             ], | ||||||
|           }; |           }; | ||||||
|           break; |           break; | ||||||
|  | @ -239,7 +235,7 @@ export default class CronService { | ||||||
|           const reg = { |           const reg = { | ||||||
|             [Op.or]: [ |             [Op.or]: [ | ||||||
|               { [Op.like]: `%${searchText}%` }, |               { [Op.like]: `%${searchText}%` }, | ||||||
|               { [Op.like]: `%${encodeURIComponent(searchText)}%` }, |               { [Op.like]: `%${encodeURI(searchText)}%` }, | ||||||
|             ], |             ], | ||||||
|           }; |           }; | ||||||
|           q[Op.or] = [ |           q[Op.or] = [ | ||||||
|  | @ -367,9 +363,9 @@ export default class CronService { | ||||||
|       { status: CrontabStatus.queued }, |       { status: CrontabStatus.queued }, | ||||||
|       { where: { id: ids } }, |       { where: { id: ids } }, | ||||||
|     ); |     ); | ||||||
|     ids.forEach(id => { |     ids.forEach((id) => { | ||||||
|       this.runSingle(id) |       this.runSingle(id); | ||||||
|     }) |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async stop(ids: number[]) { |   public async stop(ids: number[]) { | ||||||
|  | @ -451,7 +447,7 @@ export default class CronService { | ||||||
|           resolve(); |           resolve(); | ||||||
|         }); |         }); | ||||||
|       }); |       }); | ||||||
|     }) |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async disabled(ids: number[]) { |   public async disabled(ids: number[]) { | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ export default class DependenceService { | ||||||
|   constructor( |   constructor( | ||||||
|     @Inject('logger') private logger: winston.Logger, |     @Inject('logger') private logger: winston.Logger, | ||||||
|     private sockService: SockService, |     private sockService: SockService, | ||||||
|   ) { } |   ) {} | ||||||
| 
 | 
 | ||||||
|   public async create(payloads: Dependence[]): Promise<Dependence[]> { |   public async create(payloads: Dependence[]): Promise<Dependence[]> { | ||||||
|     const tabs = payloads.map((x) => { |     const tabs = payloads.map((x) => { | ||||||
|  | @ -79,7 +79,7 @@ export default class DependenceService { | ||||||
|   ): Promise<Dependence[]> { |   ): Promise<Dependence[]> { | ||||||
|     let condition = { ...query, type: DependenceTypes[type as any] }; |     let condition = { ...query, type: DependenceTypes[type as any] }; | ||||||
|     if (searchValue) { |     if (searchValue) { | ||||||
|       const encodeText = encodeURIComponent(searchValue); |       const encodeText = encodeURI(searchValue); | ||||||
|       const reg = { |       const reg = { | ||||||
|         [Op.or]: [ |         [Op.or]: [ | ||||||
|           { [Op.like]: `%${searchValue}%` }, |           { [Op.like]: `%${searchValue}%` }, | ||||||
|  | @ -106,12 +106,8 @@ export default class DependenceService { | ||||||
|     force: boolean = false, |     force: boolean = false, | ||||||
|   ) { |   ) { | ||||||
|     docs.forEach((dep) => { |     docs.forEach((dep) => { | ||||||
|       this.installOrUninstallDependencies( |       this.installOrUninstallDependencies([dep], isInstall, force); | ||||||
|         [dep], |     }); | ||||||
|         isInstall, |  | ||||||
|         force, |  | ||||||
|       ) |  | ||||||
|     }) |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async reInstall(ids: number[]): Promise<Dependence[]> { |   public async reInstall(ids: number[]): Promise<Dependence[]> { | ||||||
|  | @ -186,7 +182,9 @@ export default class DependenceService { | ||||||
|         }); |         }); | ||||||
|         await this.updateLog(depIds, message); |         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) => { |         cp.stdout.on('data', async (data) => { | ||||||
|           this.sockService.sendMessage({ |           this.sockService.sendMessage({ | ||||||
|  | @ -250,6 +248,6 @@ export default class DependenceService { | ||||||
|           resolve(null); |           resolve(null); | ||||||
|         }); |         }); | ||||||
|       }); |       }); | ||||||
|     }) |     }); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -121,7 +121,7 @@ export default class EnvService { | ||||||
|   public async envs(searchText: string = '', query: any = {}): Promise<Env[]> { |   public async envs(searchText: string = '', query: any = {}): Promise<Env[]> { | ||||||
|     let condition = { ...query }; |     let condition = { ...query }; | ||||||
|     if (searchText) { |     if (searchText) { | ||||||
|       const encodeText = encodeURIComponent(searchText); |       const encodeText = encodeURI(searchText); | ||||||
|       const reg = { |       const reg = { | ||||||
|         [Op.or]: [ |         [Op.or]: [ | ||||||
|           { [Op.like]: `%${searchText}%` }, |           { [Op.like]: `%${searchText}%` }, | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ export default class OpenService { | ||||||
|   ): Promise<App[]> { |   ): Promise<App[]> { | ||||||
|     let condition = { ...query }; |     let condition = { ...query }; | ||||||
|     if (searchText) { |     if (searchText) { | ||||||
|       const encodeText = encodeURIComponent(searchText); |       const encodeText = encodeURI(searchText); | ||||||
|       const reg = { |       const reg = { | ||||||
|         [Op.or]: [ |         [Op.or]: [ | ||||||
|           { [Op.like]: `%${searchText}%` }, |           { [Op.like]: `%${searchText}%` }, | ||||||
|  |  | ||||||
|  | @ -6,9 +6,7 @@ import { | ||||||
|   SubscriptionModel, |   SubscriptionModel, | ||||||
|   SubscriptionStatus, |   SubscriptionStatus, | ||||||
| } from '../data/subscription'; | } from '../data/subscription'; | ||||||
| import { | import { ChildProcessWithoutNullStreams } from 'child_process'; | ||||||
|   ChildProcessWithoutNullStreams, |  | ||||||
| } from 'child_process'; |  | ||||||
| import fs from 'fs'; | import fs from 'fs'; | ||||||
| import { | import { | ||||||
|   getFileContentByName, |   getFileContentByName, | ||||||
|  | @ -37,7 +35,7 @@ export default class SubscriptionService { | ||||||
|     private scheduleService: ScheduleService, |     private scheduleService: ScheduleService, | ||||||
|     private sockService: SockService, |     private sockService: SockService, | ||||||
|     private sshKeyService: SshKeyService, |     private sshKeyService: SshKeyService, | ||||||
|   ) { } |   ) {} | ||||||
| 
 | 
 | ||||||
|   public async list(searchText?: string): Promise<Subscription[]> { |   public async list(searchText?: string): Promise<Subscription[]> { | ||||||
|     let query = {}; |     let query = {}; | ||||||
|  | @ -45,7 +43,7 @@ export default class SubscriptionService { | ||||||
|       const reg = { |       const reg = { | ||||||
|         [Op.or]: [ |         [Op.or]: [ | ||||||
|           { [Op.like]: `%${searchText}%` }, |           { [Op.like]: `%${searchText}%` }, | ||||||
|           { [Op.like]: `%${encodeURIComponent(searchText)}%` }, |           { [Op.like]: `%${encodeURI(searchText)}%` }, | ||||||
|         ], |         ], | ||||||
|       }; |       }; | ||||||
|       query = { |       query = { | ||||||
|  | @ -276,9 +274,9 @@ export default class SubscriptionService { | ||||||
|       { status: SubscriptionStatus.queued }, |       { status: SubscriptionStatus.queued }, | ||||||
|       { where: { id: ids } }, |       { where: { id: ids } }, | ||||||
|     ); |     ); | ||||||
|     ids.forEach(id => { |     ids.forEach((id) => { | ||||||
|       this.runSingle(id) |       this.runSingle(id); | ||||||
|     }) |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async stop(ids: number[]) { |   public async stop(ids: number[]) { | ||||||
|  | @ -315,10 +313,7 @@ export default class SubscriptionService { | ||||||
| 
 | 
 | ||||||
|     const command = formatCommand(subscription); |     const command = formatCommand(subscription); | ||||||
| 
 | 
 | ||||||
|     this.scheduleService.runTask( |     this.scheduleService.runTask(command, this.taskCallbacks(subscription)); | ||||||
|       command, |  | ||||||
|       this.taskCallbacks(subscription), |  | ||||||
|     ); |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async disabled(ids: number[]) { |   public async disabled(ids: number[]) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 whyour
						whyour