From 8b9b19c753eae2513867e166b229c3bfa7be5d49 Mon Sep 17 00:00:00 2001 From: xxe Date: Fri, 23 Sep 2022 10:13:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardIN/Helper/DataBus.cs | 4 ++-- HKCardIN/Logic/BaseLogic.cs | 13 +++++++++---- HKCardIN/Views/CardView.xaml.cs | 13 +++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/HKCardIN/Helper/DataBus.cs b/HKCardIN/Helper/DataBus.cs index 486bdaf..a91bd3c 100644 --- a/HKCardIN/Helper/DataBus.cs +++ b/HKCardIN/Helper/DataBus.cs @@ -21,7 +21,7 @@ namespace HKCardIN.Helper /// /// 拉取用户和卡信息 /// - public static string PullUserAndCardInfo = DataBus.SaasRoute + "api/member-helper/membercardinfo/"; + public static string PullUserAndCardInfo = DataBus.SaasRoute + "api/member-helper/membercardinfo"; /// /// 推送充值到服务器 /// @@ -29,6 +29,6 @@ namespace HKCardIN.Helper /// /// 根据会员手机获取卡号 /// - public static string GetCardNoByPhone = DataBus.SaasRoute + "api/"; + public static string GetCardNoByPhone = DataBus.SaasRoute + "api/member-helper/membercardinfo"; } } diff --git a/HKCardIN/Logic/BaseLogic.cs b/HKCardIN/Logic/BaseLogic.cs index e173655..06a5242 100644 --- a/HKCardIN/Logic/BaseLogic.cs +++ b/HKCardIN/Logic/BaseLogic.cs @@ -1,4 +1,5 @@ -using HKCardIN.Helper; +using HandyControl.Controls; +using HKCardIN.Helper; using HKCardIN.Logic.Model; using Newtonsoft.Json.Linq; using System; @@ -23,7 +24,9 @@ namespace HKCardIN.Logic { return IHttpMultiClient.HttpMulti.AddNode(t => { - t.NodePath = ApiRoute.PullUserAndCardInfo + CardNo; + t.NodePath = ApiRoute.PullUserAndCardInfo; + t.ReqType = MultiType.POST; + t.JsonParam = (new { cardNum = CardNo }).ToJson(); }).Build().RunStringFirst().ToModel()["data"].ToJson().ToModel(); } /// @@ -46,11 +49,13 @@ namespace HKCardIN.Logic /// /// /// - public string GetCardNoByPhone(string Phone) + public UserAndCardInfo GetCardNoByPhone(string Phone) { var data = IHttpMultiClient.HttpMulti.AddNode(t => { t.NodePath = ApiRoute.GetCardNoByPhone; - }).Build().RunStringFirst(); + t.ReqType = MultiType.POST; + t.JsonParam = (new { phone = Phone }).ToJson(); + }).Build().RunStringFirst().ToModel()["data"].ToJson().ToModel(); return data; } } diff --git a/HKCardIN/Views/CardView.xaml.cs b/HKCardIN/Views/CardView.xaml.cs index 16f66ec..a0e0224 100644 --- a/HKCardIN/Views/CardView.xaml.cs +++ b/HKCardIN/Views/CardView.xaml.cs @@ -1,4 +1,6 @@ -using HKLog; +using HKCardIN.Logic; +using HKCardIN.Logic.Model; +using HKLog; using System.Text.RegularExpressions; using System.Windows; using UHFHelper; @@ -11,6 +13,7 @@ namespace HKCardIN.Views /// public partial class CardView : System.Windows.Window { + UserAndCardInfo info; public CardView() { InitializeComponent(); @@ -20,13 +23,15 @@ namespace HKCardIN.Views { if (this.Phone.Text.IsNullOrEmpty()) HandyControl.Controls.Growl.InfoGlobal("手机号不能为空!"); if (!Regex.IsMatch(this.Phone.Text, "\\d{11}")) HandyControl.Controls.Growl.InfoGlobal("请输入正确的手机号!"); - //查询接口 - Create.IsEnabled = true; + info = BaseLogic.GetInstance().GetCardNoByPhone(Phone.Text); + if (info != null) + //查询接口 + Create.IsEnabled = true; } private void CreateClick(object sender, RoutedEventArgs e) { - var res = UHFCardHelper.GetInstance().WriteCard("1569245210230263808"); + var res = UHFCardHelper.GetInstance().WriteCard(info.CardNum); HKLogImport.WriteInfo(res.ResMes); DialogResult = true; Close();