|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using BPA.Helper;
- using HandyControl.Controls;
- using HKCardIN.Helper;
- using HKCardIN.Logic.Model;
- using HKLog;
- 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
- {
- public class BaseLogic : Singleton<BaseLogic>
- {
- /// <summary>
- /// 同步用户和卡信息
- /// </summary>
- /// <returns></returns>
- public UserAndCardInfo PullUserAndCardInfo(string CardNo)
- {
- 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>
- /// 同步充值记录
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- public bool PushMoneyToServer(string CardNo, decimal Money)
- {
- 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)
- {
- HKLogImport.WriteError(ex);
- return false;
- }
-
- }
- /// <summary>
- /// 根据会员手机获取卡号
- /// </summary>
- /// <param name="Phone"></param>
- /// <returns></returns>
- public UserAndCardInfo GetCardNoByPhone(string Phone)
- {
- 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;
- }
- }
- }
- }
|