選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

89 行
2.8 KiB

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