This commit is contained in:
cool 2024-05-10 17:34:52 +08:00
parent da533ae1ed
commit 614786cdb3

View File

@ -103,7 +103,10 @@ export class PluginService extends BaseService {
* @param param * @param param
*/ */
async update(param: any) { 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) { if (old.hook && param.status == 1 && old.status != param.status) {
await this.pluginInfoEntity.update( await this.pluginInfoEntity.update(
@ -188,8 +191,9 @@ export class PluginService extends BaseService {
message: `插件信息不完整,请检查${data.errorData}`, message: `插件信息不完整,请检查${data.errorData}`,
}; };
} }
const check = await this.pluginInfoEntity.findOneBy({ const check = await this.pluginInfoEntity.findOne({
keyName: data.pluginJson.key, where: { keyName: Equal(data.pluginJson.key) },
select: ['id', 'hook', 'status'],
}); });
if (check && !check.hook) { if (check && !check.hook) {
return { return {
@ -269,8 +273,9 @@ export class PluginService extends BaseService {
return checkResult; return checkResult;
} }
const { pluginJson, readme, logo, content } = await this.data(filePath); const { pluginJson, readme, logo, content } = await this.data(filePath);
const check = await this.pluginInfoEntity.findOneBy({ const check = await this.pluginInfoEntity.findOne({
keyName: pluginJson.key, where: { keyName: Equal(pluginJson.key) },
select: ['id', 'status', 'config'],
}); });
const data = { const data = {
name: pluginJson.name, name: pluginJson.name,