From 81f65e3bf06fb7e58c9f6a0cd4694ed34a3a470a Mon Sep 17 00:00:00 2001 From: xxe Date: Fri, 14 Oct 2022 16:20:17 +0800 Subject: [PATCH] 111 --- HKCardManager/InstitutionalEntry.cs | 2 +- .../UserPages/InstitutionalEntryPage.cs | 2 +- HKLib/Interfaces/HKLibHelper.cs | 24 ++++++++++--------- HKLib/Logic/ServiceHandler.cs | 2 ++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/HKCardManager/InstitutionalEntry.cs b/HKCardManager/InstitutionalEntry.cs index 61ba6c5..00e0393 100644 --- a/HKCardManager/InstitutionalEntry.cs +++ b/HKCardManager/InstitutionalEntry.cs @@ -45,7 +45,7 @@ namespace HKCardManager } else { - this.Invoke(() => { label2.Text = "添加失败,请重试"; }); + this.Invoke(() => { label2.Text = "添加失败,请重试,请检查机构是否存在"; }); } }); diff --git a/HKCardManager/UserPages/InstitutionalEntryPage.cs b/HKCardManager/UserPages/InstitutionalEntryPage.cs index 7b97cfd..42c87ee 100644 --- a/HKCardManager/UserPages/InstitutionalEntryPage.cs +++ b/HKCardManager/UserPages/InstitutionalEntryPage.cs @@ -40,7 +40,7 @@ namespace HKCardManager.UserPages MessageLogNotify.GetInstance.Show($"【{name}】 机构添加成功"); } else - MessageLogNotify.GetInstance.ShowError($"【{name}】 机构添加失败,请重试"); + MessageLogNotify.GetInstance.ShowError($"【{name}】 机构添加失败,请重试,请检查机构是否存在"); }); } diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 5ea012c..9293b76 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -41,7 +41,7 @@ namespace HKLib.Interfaces var res = data.ToModel()["data"]["isSuccess"].ToString().AsBool(); if (res) { - ServiceQueryPush.QueryPush.PushMQ(input, "TimeChanged", MQEnum.Push); + ServiceQueryPush.QueryPush.PushMQAsync(input, "TimeChanged", MQEnum.Push); return res; } return false; @@ -99,12 +99,13 @@ namespace HKLib.Interfaces /// public static List GetUserList(string keyword) { - return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => - { - t.NodePath = $"{Configer.SaasRoute}api/one-card/staff-list"; - t.ReqType = MultiType.POST; - t.JsonParam = (new { realName = keyword }).ToJson(); - }).Build().RunStringFirst().ToModel()["data"]["data"].ToJson().ToModel>(); + var data = IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => + { + t.NodePath = $"{Configer.SaasRoute}api/one-card/staff-list"; + t.ReqType = MultiType.POST; + t.JsonParam = (new { realName = keyword }).ToJson(); + }).Build().RunStringFirst(); + return data.ToModel()["data"]["data"].ToJson().ToModel>(); } /// /// 添加用户并绑卡 @@ -126,11 +127,12 @@ namespace HKLib.Interfaces /// public static bool DisableUser(string userName) { + List a = new List() { userName }; return IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => { - t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card"; + t.NodePath = $"{Configer.SaasRoute}api/one-card/del-staff"; t.ReqType = MultiType.POST; - t.JsonParam = (new { realName = userName }).ToJson(); + t.JsonParam = a.ToJson(); }).Build().RunStringFirst().ToModel()["data"]["isSuccess"].ToString().AsBool(); } /// @@ -152,7 +154,7 @@ namespace HKLib.Interfaces /// public static bool CardStutasChange(CardStutasDto input) { - input.CardNo = GetUserList(input.keywrod).FirstOrDefault(t => t.Name.Equals(input.keywrod)).Cards.FirstOrDefault(t => t.State == 1).CardNum; + input.CardNo = GetUserList(input.keywrod).FirstOrDefault(t => t.Name.Equals(input.keywrod)).Cards.FirstOrDefault().CardNum; var x = IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => { @@ -162,7 +164,7 @@ namespace HKLib.Interfaces }).Build().RunStringFirst().ToModel()["data"]["isSuccess"].ToString().AsBool(); if (x) { - ServiceQueryPush.QueryPush.PushMQ(input, "CardStutasChanged", MQEnum.Top); + ServiceQueryPush.QueryPush.PushMQAsync(input, "CardStutasChanged", MQEnum.Top); return x; } return false; diff --git a/HKLib/Logic/ServiceHandler.cs b/HKLib/Logic/ServiceHandler.cs index 83ac556..0ac4e71 100644 --- a/HKLib/Logic/ServiceHandler.cs +++ b/HKLib/Logic/ServiceHandler.cs @@ -12,6 +12,8 @@ namespace HKLib.Logic #region 机构类 public static bool AddOrg(string Name) { + var check = DbContext.Context.Queryable().First(t => t.Name == Name); + if (check != null) return false; var SiD = HKLibHelper.SetOrg(Name); return DbContext.Context.Insertable(new OrgTable {