From 6c890f334e200030c74776ef61f8ec9b518aeb77 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 12 Aug 2024 15:09:46 +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 --- .../Ghre/Ghre_CourseServices.cs | 67 +++++++------------ .../Ghre/Ghre_CourseWareServices.cs | 6 ++ 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index 5bb49026..fa9f7b27 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -315,6 +315,29 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == entity.CourseWareId); + if (ware != null) + { + var courseIds2 = new List(); + if (!string.IsNullOrWhiteSpace(ware.CourseIds)) + courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); + + if (!courseIds2.Any(x => x == id)) + { + courseIds2.Add(id); + + ware.CourseIds = JsonConvert.SerializeObject(courseIds2); + await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); + } + } + } + #endregion } #endregion @@ -380,28 +403,7 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == entity.CourseWareId); - if (ware != null) - { - var courseIds2 = new List(); - if (!string.IsNullOrWhiteSpace(ware.CourseIds)) - courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); - - if (!courseIds2.Any(x => x == result)) - { - courseIds2.Add(result); - - ware.CourseIds = JsonConvert.SerializeObject(courseIds2); - await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); - } - } - } - #endregion - + return result; } @@ -445,27 +447,6 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == editModel.CourseWareId); - if (ware != null) - { - var courseIds2 = new List(); - if (!string.IsNullOrWhiteSpace(ware.CourseIds)) - courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); - - if (!courseIds2.Any(x => x == Id)) - { - courseIds2.Add(Id); - - ware.CourseIds = JsonConvert.SerializeObject(courseIds2); - await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); - } - } - } - #endregion return result; } diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs index 1d08397d..ebdcd7ff 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs @@ -74,7 +74,13 @@ public class Ghre_CourseWareServices : BaseServices>(courseIds); + if (result.result.DT_TableDataT1[0].CourseIds2.Any()) + { + + } + } else result.result.DT_TableDataT1[0].CourseIds2 = new List();