From 614786cdb346db0a9e654eaaf6dfd1fbe7d28890 Mon Sep 17 00:00:00 2001 From: cool Date: Fri, 10 May 2024 17:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/plugin/service/info.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/plugin/service/info.ts b/src/modules/plugin/service/info.ts index e6aa16a..2b48423 100644 --- a/src/modules/plugin/service/info.ts +++ b/src/modules/plugin/service/info.ts @@ -103,7 +103,10 @@ export class PluginService extends BaseService { * @param param */ async update(param: any) { - const old = await this.pluginInfoEntity.findOneBy({ id: param.id }); + const old = await this.pluginInfoEntity.findOne({ + where: { id: param.id }, + select: ['id', 'status', 'hook'], + }); // 启用插件,禁用同名插件 if (old.hook && param.status == 1 && old.status != param.status) { await this.pluginInfoEntity.update( @@ -188,8 +191,9 @@ export class PluginService extends BaseService { message: `插件信息不完整,请检查${data.errorData}`, }; } - const check = await this.pluginInfoEntity.findOneBy({ - keyName: data.pluginJson.key, + const check = await this.pluginInfoEntity.findOne({ + where: { keyName: Equal(data.pluginJson.key) }, + select: ['id', 'hook', 'status'], }); if (check && !check.hook) { return { @@ -269,8 +273,9 @@ export class PluginService extends BaseService { return checkResult; } const { pluginJson, readme, logo, content } = await this.data(filePath); - const check = await this.pluginInfoEntity.findOneBy({ - keyName: pluginJson.key, + const check = await this.pluginInfoEntity.findOne({ + where: { keyName: Equal(pluginJson.key) }, + select: ['id', 'status', 'config'], }); const data = { name: pluginJson.name,