diff --git a/src/AgileConfig.Server.Service/AppService.cs b/src/AgileConfig.Server.Service/AppService.cs index 67d2af93..5318066c 100644 --- a/src/AgileConfig.Server.Service/AppService.cs +++ b/src/AgileConfig.Server.Service/AppService.cs @@ -59,6 +59,8 @@ public async Task DeleteAsync(App app) app = await _appRepository.GetAsync(app.Id); if (app != null) { + await _appRepository.DeleteAsync(app); + var envs = await _settingService.GetEnvironmentList(); var updatedConfigIds = new List(); var updatedConfigPublishedIds = new List(); @@ -67,9 +69,9 @@ public async Task DeleteAsync(App app) { using var configRepository = _configRepositoryAccessor(env); using var configPublishedRepository = _configPublishedRepositoryAccessor(env); - await _appRepository.DeleteAsync(app); + //怕有的同学误删app导致要恢复,所以保留配置项吧。 - var configs = await configRepository.QueryAsync(x => x.AppId == app.Id); + var configs = await configRepository.QueryAsync(x => x.AppId == app.Id && x.Status == ConfigStatus.Enabled); var waitDeleteConfigs = new List(); foreach (var item in configs) {