UsersController.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.Extensions.Logging;
  7. using Microsoft.Extensions.Options;
  8. using Microsoft.AspNetCore.Authorization;
  9. using System.Web;
  10. using MySystem.Models.Main1;
  11. using MySystem.Service.Main1;
  12. using LitJson;
  13. using Library;
  14. using MySystem.Service.KxsMain;
  15. namespace MySystem.Areas.Api.Controllers.v1.Main1
  16. {
  17. [Area("Api")]
  18. [Route("/v1/QrCodePlateMain/[controller]/[action]")]
  19. public class UsersController : BaseController
  20. {
  21. public UsersController(IHttpContextAccessor accessor) : base(accessor)
  22. {
  23. }
  24. #region 重置交易额-直连重置创客个人交易额
  25. [Authorize]
  26. public JsonResult DirectResetUserPersonalAmount(string value)
  27. {
  28. value = PublicFunction.DesDecrypt(value); ;
  29. JsonData data = JsonMapper.ToObject(value);
  30. AppResultJson result = DirectResetUserPersonalAmountDo(value);
  31. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  32. }
  33. private AppResultJson DirectResetUserPersonalAmountDo(string value)
  34. {
  35. JsonData data = JsonMapper.ToObject(value);
  36. string MakerCode = data["MakerCode"].ToString(); //创客编号
  37. string TradeDate = data["TradeDate"].ToString(); //交易时间
  38. if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
  39. {
  40. return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
  41. }
  42. var user = UsersService.QueryByMakerCode(MakerCode);
  43. if (user.Id == 0)
  44. {
  45. return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
  46. }
  47. string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
  48. string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
  49. string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
  50. string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
  51. RedisDbconn.Instance.AddList("ResetUserSelfStatDataQueue", info);
  52. Dictionary<string, object> Obj = new Dictionary<string, object>();
  53. return new AppResultJson() { Status = "1", Info = "", Data = Obj };
  54. }
  55. #endregion
  56. #region 重置交易额-银联重置创客个人交易额
  57. [Authorize]
  58. public JsonResult UnionPayResetUserPersonalAmount(string value)
  59. {
  60. value = PublicFunction.DesDecrypt(value); ;
  61. JsonData data = JsonMapper.ToObject(value);
  62. AppResultJson result = UnionPayResetUserPersonalAmountDo(value);
  63. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  64. }
  65. private AppResultJson UnionPayResetUserPersonalAmountDo(string value)
  66. {
  67. JsonData data = JsonMapper.ToObject(value);
  68. string MakerCode = data["MakerCode"].ToString(); //创客编号
  69. string TradeDate = data["TradeDate"].ToString(); //交易时间
  70. if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
  71. {
  72. return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
  73. }
  74. var user = UsersService.QueryByMakerCode(MakerCode);
  75. if (user.Id == 0)
  76. {
  77. return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
  78. }
  79. string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
  80. string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
  81. string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
  82. string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
  83. RedisDbconn.Instance.AddList("ResetUserSelfStatDataQueue2", info);
  84. Dictionary<string, object> Obj = new Dictionary<string, object>();
  85. return new AppResultJson() { Status = "1", Info = "", Data = Obj };
  86. }
  87. #endregion
  88. #region 重置交易额-直连重置创客团队交易额
  89. [Authorize]
  90. public JsonResult DirectResetUserTeamAmount(string value)
  91. {
  92. value = PublicFunction.DesDecrypt(value); ;
  93. JsonData data = JsonMapper.ToObject(value);
  94. AppResultJson result = DirectResetUserTeamAmountDo(value);
  95. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  96. }
  97. private AppResultJson DirectResetUserTeamAmountDo(string value)
  98. {
  99. JsonData data = JsonMapper.ToObject(value);
  100. string MakerCode = data["MakerCode"].ToString(); //创客编号
  101. string TradeDate = data["TradeDate"].ToString(); //交易时间
  102. if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
  103. {
  104. return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
  105. }
  106. var user = UsersService.QueryByMakerCode(MakerCode);
  107. if (user.Id == 0)
  108. {
  109. return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
  110. }
  111. string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
  112. string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
  113. string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
  114. string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
  115. RedisDbconn.Instance.AddList("ResetUserTeamStatDataQueue", info);
  116. Dictionary<string, object> Obj = new Dictionary<string, object>();
  117. return new AppResultJson() { Status = "1", Info = "", Data = Obj };
  118. }
  119. #endregion
  120. #region 重置交易额-银联重置创客团队交易额
  121. [Authorize]
  122. public JsonResult UnionPayResetUserTeamAmount(string value)
  123. {
  124. value = PublicFunction.DesDecrypt(value); ;
  125. JsonData data = JsonMapper.ToObject(value);
  126. AppResultJson result = UnionPayResetUserTeamAmountDo(value);
  127. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  128. }
  129. private AppResultJson UnionPayResetUserTeamAmountDo(string value)
  130. {
  131. JsonData data = JsonMapper.ToObject(value);
  132. string MakerCode = data["MakerCode"].ToString(); //创客编号
  133. string TradeDate = data["TradeDate"].ToString(); //交易时间
  134. if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
  135. {
  136. return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
  137. }
  138. var user = UsersService.QueryByMakerCode(MakerCode);
  139. if (user.Id == 0)
  140. {
  141. return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
  142. }
  143. string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
  144. string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
  145. string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
  146. string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
  147. RedisDbconn.Instance.AddList("ResetUserTeamStatDataQueue2", info);
  148. Dictionary<string, object> Obj = new Dictionary<string, object>();
  149. return new AppResultJson() { Status = "1", Info = "", Data = Obj };
  150. }
  151. #endregion
  152. }
  153. }