ChangePosFeeQueue.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4. using System.Linq;
  5. using System.Data;
  6. using MySystem;
  7. using MySystem.Models;
  8. using Library;
  9. using LitJson;
  10. public class ChangePosFeeQueue
  11. {
  12. public readonly static ChangePosFeeQueue Instance = new ChangePosFeeQueue();
  13. private ChangePosFeeQueue()
  14. {
  15. }
  16. public void StartEverTime()
  17. {
  18. Thread th = new Thread(ChangePosFeeQueueDo);
  19. th.IsBackground = true;
  20. th.Start();
  21. }
  22. private void ChangePosFeeQueueDo()
  23. {
  24. while (true)
  25. {
  26. WebCMSEntities db = new WebCMSEntities();
  27. try
  28. {
  29. string data = RedisDbconn.Instance.RPop<string>("ChangePosFeeQueue");
  30. if (!string.IsNullOrEmpty(data))
  31. {
  32. function.WriteLog("data:" + data, "金控机具服务费调整日志");
  33. JsonData Info = JsonMapper.ToObject(data);
  34. string PosSnId = Info["PosSnId"].ToString(); //机具Id
  35. string BrandId = Info["BrandId"].ToString(); //品牌Id
  36. string Deposit = Info["Deposit"].ToString(); //服务费
  37. int bId = int.Parse(BrandId);
  38. //金控
  39. if (bId == 1 || bId == 3)
  40. {
  41. if (Deposit == "0") Deposit = "0";
  42. else if (Deposit == "99") Deposit = "99";
  43. else if (Deposit == "199") Deposit = "199";
  44. else if (Deposit == "299") Deposit = "299";
  45. ChangePosFeeUtil.SetJKDeposit(PosSnId.ToString(), Deposit);
  46. }
  47. //开店宝
  48. if (bId == 2)
  49. {
  50. if (Deposit == "0") Deposit = "470";
  51. else if (Deposit == "99") Deposit = "471";
  52. else if (Deposit == "199") Deposit = "472";
  53. else if (Deposit == "299") Deposit = "473";
  54. ChangePosFeeUtil.SetKDBDeposit(PosSnId.ToString(), Deposit);
  55. }
  56. //乐刷
  57. if (bId == 4 || bId == 5)
  58. {
  59. if (Deposit == "99") Deposit = "100";
  60. else if (Deposit == "199") Deposit = "200";
  61. else if (Deposit == "299") Deposit = "300";
  62. ChangePosFeeUtil.SetLSDeposit(PosSnId.ToString(), Deposit);
  63. }
  64. //立刷
  65. if (bId == 6)
  66. {
  67. if (Deposit == "0") Deposit = "0";
  68. else if (Deposit == "99") Deposit = "99";
  69. else if (Deposit == "199") Deposit = "199";
  70. else if (Deposit == "299") Deposit = "299";
  71. ChangePosFeeUtil.SetLISDeposit(PosSnId.ToString(), Deposit);
  72. }
  73. //立刷微电签
  74. if (bId == 22)
  75. {
  76. if (Deposit == "0") Deposit = "0";
  77. else if (Deposit == "99") Deposit = "99";
  78. else if (Deposit == "199") Deposit = "199";
  79. else if (Deposit == "299") Deposit = "299";
  80. ChangePosFeeUtil.SetLISDeposit(PosSnId.ToString(), Deposit);
  81. }
  82. //盛付通
  83. if (bId == 7)
  84. {
  85. if (Deposit == "0") Deposit = "0";
  86. else if (Deposit == "99") Deposit = "99";
  87. else if (Deposit == "199") Deposit = "199";
  88. else if (Deposit == "299") Deposit = "299";
  89. ChangePosFeeUtil.SetSFTDeposit(PosSnId.ToString(), Deposit);
  90. }
  91. //海科
  92. if (bId == 8 || bId == 9)
  93. {
  94. if (Deposit == "99") Deposit = "100";
  95. else if (Deposit == "199") Deposit = "200";
  96. else if (Deposit == "299") Deposit = "300";
  97. ChangePosFeeUtil.SetHKDeposit(PosSnId.ToString(), Deposit);
  98. }
  99. //联动
  100. if (bId == 10 || bId == 11)
  101. {
  102. if (Deposit == "0") Deposit = "0";
  103. else if (Deposit == "99") Deposit = "99";
  104. else if (Deposit == "199") Deposit = "199";
  105. else if (Deposit == "299") Deposit = "299";
  106. ChangePosFeeUtil.SetLDDeposit(PosSnId.ToString(), Deposit);
  107. }
  108. //盒易付
  109. if (bId == 12 || bId == 13)
  110. {
  111. if (Deposit == "0") Deposit = "0";
  112. else if (Deposit == "99") Deposit = "99";
  113. else if (Deposit == "199") Deposit = "199";
  114. else if (Deposit == "299") Deposit = "299";
  115. ChangePosFeeUtil.SetHYFDeposit(PosSnId.ToString(), Deposit);
  116. }
  117. //联客宝
  118. if (bId == 15 || bId == 16)
  119. {
  120. if (Deposit == "0") Deposit = "0";
  121. else if (Deposit == "99") Deposit = "99";
  122. else if (Deposit == "199") Deposit = "199";
  123. else if (Deposit == "299") Deposit = "299";
  124. ChangePosFeeUtil.SetPosPDeposit(PosSnId.ToString(), Deposit);
  125. }
  126. //拉卡拉
  127. if (bId == 30 || bId == 31)
  128. {
  129. if (Deposit == "0") Deposit = "0";
  130. else if (Deposit == "99") Deposit = "99";
  131. else if (Deposit == "199") Deposit = "199";
  132. else if (Deposit == "299") Deposit = "299";
  133. ChangePosFeeUtil.SetLKLDeposit(PosSnId.ToString(), Deposit);
  134. }
  135. }
  136. else
  137. {
  138. Thread.Sleep(5000);
  139. }
  140. }
  141. catch (Exception ex)
  142. {
  143. function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "机具服务费调整线程异常");
  144. }
  145. db.Dispose();
  146. }
  147. }
  148. }