diff --git a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs index 89c42d04..19e4b617 100644 --- a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs @@ -1110,11 +1110,18 @@ namespace CoreCms.Net.Web.Admin.Controllers return jm; } - var parentObj = await _coreCmsUserServices.QueryByIdAsync(entity.parentId); - if (parentObj == null) + if (entity.parentId > 0) { - jm.msg = "不存在此上级信息"; - return jm; + var parentObj = await _coreCmsUserServices.QueryByIdAsync(entity.parentId); + if (parentObj == null) + { + jm.msg = "不存在此上级信息"; + return jm; + } + } + else + { + entity.parentId = 0; } var bl = await _coreCmsUserServices.UpdateAsync(p => new CoreCmsUser() { parentId = entity.parentId }, p => p.id == model.id);