You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemoteService.cs 2.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. var m = bool.Parse(data.ToModel<JObject>()["data"].ToString());
  47. if (m)
  48. {
  49. UHF_RS485_Helper.GetInstance().OpenBeep(StallId.AsInt());
  50. return m;
  51. }
  52. else return false;
  53. }
  54. /// <summary>
  55. /// 获取店铺信息
  56. /// </summary>
  57. public static void PullShopInfo()
  58. {
  59. var data = IHttpMultiClient.HttpMulti.AddNode(t =>
  60. {
  61. t.NodePath = ApiRoute.PullShopInfo;
  62. }).Build().RunStringFirst()
  63. .ToModel<JObject>()["data"].ToJson().ToModel<StoreInfoResponse>();
  64. DataBus.StoreInfo = data;
  65. }
  66. }
  67. }