From d2ebfbc00cf45bcbbf4a9262237f3707b6cb3107 Mon Sep 17 00:00:00 2001 From: xxe Date: Tue, 13 Sep 2022 15:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardIN/Helper/DataBus.cs | 2 +- HKCardIN/Logic/BaseLogic.cs | 17 ++++++++++++----- HKCardIN/ViewModels/RootViewModel.cs | 11 ++++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/HKCardIN/Helper/DataBus.cs b/HKCardIN/Helper/DataBus.cs index 10a69fa..7c1611a 100644 --- a/HKCardIN/Helper/DataBus.cs +++ b/HKCardIN/Helper/DataBus.cs @@ -25,6 +25,6 @@ namespace HKCardIN.Helper /// /// 推送充值到服务器 /// - public static string PushMoneyToServer = DataBus.SaasRoute + ""; + public static string PushMoneyToServer = DataBus.SaasRoute + "api/member-helper/memberconsumptionorrecharge"; } } diff --git a/HKCardIN/Logic/BaseLogic.cs b/HKCardIN/Logic/BaseLogic.cs index c2ac0cd..0105333 100644 --- a/HKCardIN/Logic/BaseLogic.cs +++ b/HKCardIN/Logic/BaseLogic.cs @@ -1,10 +1,14 @@ using HKCardIN.Helper; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; +using System.Security.Policy; using System.Text; using System.Threading.Tasks; +using XExten.Advance.HttpFramework.MultiCommon; using XExten.Advance.HttpFramework.MultiFactory; +using XExten.Advance.LinqFramework; namespace HKCardIN.Logic { @@ -14,11 +18,11 @@ namespace HKCardIN.Logic /// 同步用户和卡信息 /// /// - public async Task PullUserAndCardInfo() + public async Task PullUserAndCardInfo(string CardNo) { return await IHttpMultiClient.HttpMulti.AddNode(t => { - t.NodePath = ApiRoute.PullUserAndCardInfo; + t.NodePath = ApiRoute.PullUserAndCardInfo; }).Build().RunStringFirstAsync(); } /// @@ -26,12 +30,15 @@ namespace HKCardIN.Logic /// /// /// - public async Task PushMoneyToServer(dynamic input) + public bool PushMoneyToServer(string CardNo, decimal Money) { - return await IHttpMultiClient.HttpMulti.AddNode(t => + var data = IHttpMultiClient.HttpMulti.AddNode(t => { t.NodePath = ApiRoute.PushMoneyToServer; - }).Build().RunStringFirstAsync(); + t.ReqType = MultiType.POST; + t.JsonParam = (new { Money, Type = 1, No = CardNo }).ToJson(); + }).Build().RunStringFirst(); + return bool.Parse(data.ToModel()["data"].ToString()); } } } diff --git a/HKCardIN/ViewModels/RootViewModel.cs b/HKCardIN/ViewModels/RootViewModel.cs index 49a1530..39b02d0 100644 --- a/HKCardIN/ViewModels/RootViewModel.cs +++ b/HKCardIN/ViewModels/RootViewModel.cs @@ -1,4 +1,5 @@ using HKCardIN.Helper; +using HKCardIN.Logic; using Stylet; using System; using System.Threading; @@ -78,18 +79,22 @@ namespace HKCardIN.ViewModels } public void SaveAction() { - var c = CardNo; - var m = ShowMoney; if (!DataBus.NetWordState) { HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!"); return; } + + if (BaseLogic.GetInstance().PushMoneyToServer(CardNo, ShowMoney)) + HandyControl.Controls.Growl.SuccessGlobal($"【{CardNo}】充值成功"); + else + HandyControl.Controls.Growl.InfoGlobal($"【{CardNo}】充值失败"); } #endregion #region 方法 - private void MainThread() { + private void MainThread() + { ThreadManage.GetInstance().StartLong(new Action(() => { try