Ver a proveniência

添加try

Lishi
xxe há 2 anos
ascendente
cometimento
b590abad72
2 ficheiros alterados com 46 adições e 18 eliminações
  1. +44
    -18
      HKCardIN/Logic/BaseLogic.cs
  2. +2
    -0
      HKCardIN/ViewModels/RootViewModel.cs

+ 44
- 18
HKCardIN/Logic/BaseLogic.cs Ver ficheiro

@@ -1,6 +1,7 @@
using HandyControl.Controls;
using HKCardIN.Helper;
using HKCardIN.Logic.Model;
using HKLog;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -22,12 +23,20 @@ namespace HKCardIN.Logic
/// <returns></returns>
public UserAndCardInfo PullUserAndCardInfo(string CardNo)
{
return IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.PullUserAndCardInfo;
t.ReqType = MultiType.POST;
t.JsonParam = (new { cardNum = CardNo }).ToJson();
}).Build().RunStringFirst().ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
try
{
return IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.PullUserAndCardInfo;
t.ReqType = MultiType.POST;
t.JsonParam = (new { cardNum = CardNo }).ToJson();
}).Build().RunStringFirst().ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
}
catch (Exception ex)
{
HKLogImport.WriteError(ex);
return null;
}
}
/// <summary>
/// 同步充值记录
@@ -36,13 +45,22 @@ namespace HKCardIN.Logic
/// <returns></returns>
public bool PushMoneyToServer(string CardNo, decimal Money)
{
var data = IHttpMultiClient.HttpMulti.AddNode(t =>
try
{
var data = IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.PushMoneyToServer;
t.ReqType = MultiType.POST;
t.JsonParam = (new { Money, Type = 1, CardNum = CardNo }).ToJson();
}).Build().RunStringFirst();
return bool.Parse(data.ToModel<JObject>()["data"].ToString());
}
catch (Exception ex)
{
t.NodePath = ApiRoute.PushMoneyToServer;
t.ReqType = MultiType.POST;
t.JsonParam = (new { Money, Type = 1, CardNum = CardNo }).ToJson();
}).Build().RunStringFirst();
return bool.Parse(data.ToModel<JObject>()["data"].ToString());
HKLogImport.WriteError(ex);
return false;
}
}
/// <summary>
/// 根据会员手机获取卡号
@@ -51,12 +69,20 @@ namespace HKCardIN.Logic
/// <returns></returns>
public UserAndCardInfo GetCardNoByPhone(string Phone)
{
var data = IHttpMultiClient.HttpMulti.AddNode(t => {
t.NodePath = ApiRoute.GetCardNoByPhone;
t.ReqType = MultiType.POST;
t.JsonParam = (new { phone = Phone }).ToJson();
}).Build().RunStringFirst().ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
return data;
try
{
var data = IHttpMultiClient.HttpMulti.AddNode(t => {
t.NodePath = ApiRoute.GetCardNoByPhone;
t.ReqType = MultiType.POST;
t.JsonParam = (new { phone = Phone }).ToJson();
}).Build().RunStringFirst();
return data.ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
}
catch (Exception ex)
{
HKLogImport.WriteError(ex);
return null;
}
}
}
}

+ 2
- 0
HKCardIN/ViewModels/RootViewModel.cs Ver ficheiro

@@ -156,6 +156,8 @@ namespace HKCardIN.ViewModels
}
private void MainThread()
{
CardView view = new CardView();
view.Show();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
try


Carregando…
Cancelar
Guardar