您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

70 行
2.4 KiB

  1. using HKCardOUT.Helper;
  2. using Logic.RemoteModel;
  3. using Newtonsoft.Json.Linq;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Markup;
  10. using UHFHelper;
  11. using XExten.Advance.HttpFramework.MultiCommon;
  12. using XExten.Advance.HttpFramework.MultiFactory;
  13. using XExten.Advance.LinqFramework;
  14. namespace HKCardOUT.Logic
  15. {
  16. public class RemoteService
  17. {
  18. /// <summary>
  19. /// 判断卡状态
  20. /// </summary>
  21. /// <param name="input"></param>
  22. public static int CheckCardStuatas(string CardNo)
  23. {
  24. var data = IHttpMultiClient.HttpMulti.AddNode(t =>
  25. {
  26. t.NodePath = ApiRoute.CheckCardStatus;
  27. t.ReqType = MultiType.POST;
  28. t.JsonParam = (new { cardNum = CardNo }).ToJson();
  29. }).Build().RunStringFirst().ToModel<JObject>()["data"]["cardState"];
  30. return data != null ? data.ToString().AsInt() : 0;
  31. }
  32. /// <summary>
  33. /// 同步消费记录
  34. /// </summary>
  35. /// <param name="CardNo"></param>
  36. /// <param name="Money"></param>
  37. public static bool SyncSaleLog(string CardNo, string StallId)
  38. {
  39. var GateId = DataBus.StoreInfo.Devices.FirstOrDefault(t => t.Address.AsInt() == StallId.AsInt())?.GateId;
  40. var data = IHttpMultiClient.HttpMulti.AddNode(t =>
  41. {
  42. t.ReqType = MultiType.POST;
  43. t.JsonParam = (new { GateId = GateId, Type = -1, CardNum = CardNo }).ToJson();
  44. t.NodePath = ApiRoute.SyncSaleLog;
  45. }).Build().RunStringFirst();
  46. HKLog.HKLogImport.WriteInfo($"同步消费时候调用:{data}");
  47. var m = bool.Parse(data.ToModel<JObject>()["data"].ToString());
  48. if (m)
  49. {
  50. UHF_RS485_Helper.GetInstance().OpenBeep(StallId.AsInt());
  51. return m;
  52. }
  53. else return false;
  54. }
  55. /// <summary>
  56. /// 获取店铺信息
  57. /// </summary>
  58. public static void PullShopInfo()
  59. {
  60. var data = IHttpMultiClient.HttpMulti.AddNode(t =>
  61. {
  62. t.NodePath = ApiRoute.PullShopInfo;
  63. }).Build().RunStringFirst()
  64. .ToModel<JObject>()["data"].ToJson().ToModel<StoreInfoResponse>();
  65. DataBus.StoreInfo = data;
  66. }
  67. }
  68. }