From 1b2a299d0a14f6a1e64b948c54c10299a58efa5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=81=B0=E7=81=B0?= Date: Sun, 18 Sep 2022 17:00:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E7=BD=AE=E7=94=A8=E6=88=B7=E7=88=B6=E7=BA=A7?= =?UTF-8?q?=E5=8F=91=E5=B1=95=E4=BA=BA=E5=BA=8F=E5=88=97=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=BA0=E7=9A=84=E6=83=85=E5=86=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/User/CoreCmsUserController.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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);