Pārlūkot izejas kodu

读取卡

Lishi
xxe pirms 2 gadiem
vecāks
revīzija
8b9b19c753
3 mainītis faili ar 20 papildinājumiem un 10 dzēšanām
  1. +2
    -2
      HKCardIN/Helper/DataBus.cs
  2. +9
    -4
      HKCardIN/Logic/BaseLogic.cs
  3. +9
    -4
      HKCardIN/Views/CardView.xaml.cs

+ 2
- 2
HKCardIN/Helper/DataBus.cs Parādīt failu

@@ -21,7 +21,7 @@ namespace HKCardIN.Helper
/// <summary>
/// 拉取用户和卡信息
/// </summary>
public static string PullUserAndCardInfo = DataBus.SaasRoute + "api/member-helper/membercardinfo/";
public static string PullUserAndCardInfo = DataBus.SaasRoute + "api/member-helper/membercardinfo";
/// <summary>
/// 推送充值到服务器
/// </summary>
@@ -29,6 +29,6 @@ namespace HKCardIN.Helper
/// <summary>
/// 根据会员手机获取卡号
/// </summary>
public static string GetCardNoByPhone = DataBus.SaasRoute + "api/";
public static string GetCardNoByPhone = DataBus.SaasRoute + "api/member-helper/membercardinfo";
}
}

+ 9
- 4
HKCardIN/Logic/BaseLogic.cs Parādīt failu

@@ -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<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
}
/// <summary>
@@ -46,11 +49,13 @@ namespace HKCardIN.Logic
/// </summary>
/// <param name="Phone"></param>
/// <returns></returns>
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<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
return data;
}
}


+ 9
- 4
HKCardIN/Views/CardView.xaml.cs Parādīt failu

@@ -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
/// </summary>
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();


Notiek ielāde…
Atcelt
Saglabāt