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.

91 lines
2.8 KiB

  1. using BPA.Helper;
  2. using HandyControl.Controls;
  3. using HKCardIN.Helper;
  4. using HKCardIN.Logic.Model;
  5. using HKLog;
  6. using Newtonsoft.Json.Linq;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Security.Policy;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using XExten.Advance.HttpFramework.MultiCommon;
  14. using XExten.Advance.HttpFramework.MultiFactory;
  15. using XExten.Advance.LinqFramework;
  16. namespace HKCardIN.Logic
  17. {
  18. public class BaseLogic : Singleton<BaseLogic>
  19. {
  20. /// <summary>
  21. /// 同步用户和卡信息
  22. /// </summary>
  23. /// <returns></returns>
  24. public UserAndCardInfo PullUserAndCardInfo(string CardNo)
  25. {
  26. try
  27. {
  28. return IHttpMultiClient.HttpMulti.AddNode(t =>
  29. {
  30. t.NodePath = ApiRoute.PullUserAndCardInfo;
  31. t.ReqType = MultiType.POST;
  32. t.JsonParam = (new { cardNum = CardNo }).ToJson();
  33. }).Build().RunStringFirst().ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
  34. }
  35. catch (Exception ex)
  36. {
  37. HKLogImport.WriteError(ex);
  38. return null;
  39. }
  40. }
  41. /// <summary>
  42. /// 同步充值记录
  43. /// </summary>
  44. /// <param name="input"></param>
  45. /// <returns></returns>
  46. public bool PushMoneyToServer(string CardNo, decimal Money)
  47. {
  48. try
  49. {
  50. var data = IHttpMultiClient.HttpMulti.AddNode(t =>
  51. {
  52. t.NodePath = ApiRoute.PushMoneyToServer;
  53. t.ReqType = MultiType.POST;
  54. t.JsonParam = (new { Money, Type = 1, CardNum = CardNo }).ToJson();
  55. }).Build().RunStringFirst();
  56. return bool.Parse(data.ToModel<JObject>()["data"].ToString());
  57. }
  58. catch (Exception ex)
  59. {
  60. HKLogImport.WriteError(ex);
  61. return false;
  62. }
  63. }
  64. /// <summary>
  65. /// 根据会员手机获取卡号
  66. /// </summary>
  67. /// <param name="Phone"></param>
  68. /// <returns></returns>
  69. public UserAndCardInfo GetCardNoByPhone(string Phone)
  70. {
  71. try
  72. {
  73. var data = IHttpMultiClient.HttpMulti.AddNode(t =>
  74. {
  75. t.NodePath = ApiRoute.GetCardNoByPhone;
  76. t.ReqType = MultiType.POST;
  77. t.JsonParam = (new { phone = Phone }).ToJson();
  78. }).Build().RunStringFirst();
  79. return data.ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>();
  80. }
  81. catch (Exception ex)
  82. {
  83. HKLogImport.WriteError(ex);
  84. return null;
  85. }
  86. }
  87. }
  88. }