MySelfController.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.Main;
  11. using LitJson;
  12. using Library;
  13. using System.Data;
  14. using MySystem.Service.Main;
  15. namespace MySystem.Areas.Api.Controllers.v1
  16. {
  17. [Area("Api")]
  18. [Route("Api/v1/[controller]/[action]")]
  19. public class MySelfController : BaseController
  20. {
  21. public MySelfController(IHttpContextAccessor accessor) : base(accessor)
  22. {
  23. }
  24. #region 我的-到账记录-到账记录列表
  25. // [Authorize]
  26. public JsonResult CardInComeRecordList(string value)
  27. {
  28. value = DesDecrypt(value);
  29. JsonData data = JsonMapper.ToObject(value);
  30. List<Dictionary<string, object>> dataList = CardInComeRecordListDo(value);
  31. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
  32. }
  33. private List<Dictionary<string, object>> CardInComeRecordListDo(string value)
  34. {
  35. JsonData data = JsonMapper.ToObject(value);
  36. int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
  37. string TradeMonth = data["TradeMonth"].ToString(); //交易月份
  38. string pageSize = data["PageSize"].ToString();
  39. string pageNum = data["PageNum"].ToString();
  40. var dataList = MySelfUtil.CardInComeRecordList(MerchantId, TradeMonth, pageSize, pageNum);
  41. return dataList;
  42. }
  43. #endregion
  44. #region 我的-到账记录-到账记录详情
  45. // [Authorize]
  46. public JsonResult CardInComeRecordDetail(string value)
  47. {
  48. value = DesDecrypt(value);
  49. JsonData data = JsonMapper.ToObject(value);
  50. Dictionary<string, object> obj = CardInComeRecordDetailDo(value);
  51. return Json(new AppResultJson() { Status = "1", Info = "", Data = obj });
  52. }
  53. private Dictionary<string, object> CardInComeRecordDetailDo(string value)
  54. {
  55. JsonData data = JsonMapper.ToObject(value);
  56. int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
  57. string OrderId = data["OrderId"].ToString(); //记录Id
  58. var obj = MySelfUtil.CardInComeRecordDetail(MerchantId, OrderId);
  59. return obj;
  60. }
  61. #endregion
  62. #region 我的-设置-修改登录手机号(原手机验证)
  63. // [Authorize]
  64. public JsonResult OldMobileCheck(string value)
  65. {
  66. value = DesDecrypt(value);
  67. JsonData data = JsonMapper.ToObject(value);
  68. AppResultJson result = OldMobileCheckDo(value);
  69. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  70. }
  71. private AppResultJson OldMobileCheckDo(string value)
  72. {
  73. JsonData data = JsonMapper.ToObject(value);
  74. string MobileCode = data["MobileCode"].ToString(); //短信验证码
  75. string Mobile = data["Mobile"].ToString(); //手机号
  76. MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + Mobile);
  77. if (mobilecheck == null)
  78. {
  79. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  80. }
  81. if (mobilecheck.CheckCode != MobileCode)
  82. {
  83. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  84. }
  85. RedisDbconn.Instance.Clear("MobileCodeCheck:手机号");
  86. Dictionary<string, object> Obj = new Dictionary<string, object>();
  87. return new AppResultJson() { Status = "1", Info = "", Data = Obj };
  88. }
  89. #endregion
  90. #region 我的-设置-修改登录手机号(新手机验证)
  91. // [Authorize]
  92. public JsonResult ChangeLoginMobile(string value)
  93. {
  94. value = DesDecrypt(value);
  95. JsonData data = JsonMapper.ToObject(value);
  96. AppResultJson result = ChangeLoginMobileDo(value);
  97. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  98. }
  99. private AppResultJson ChangeLoginMobileDo(string value)
  100. {
  101. JsonData data = JsonMapper.ToObject(value);
  102. string LoginMobile = data["LoginMobile"].ToString(); //原手机号
  103. string Mobile = data["Mobile"].ToString(); //手机号
  104. string MobileCode = data["MobileCode"].ToString(); //短信验证码
  105. MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + Mobile);
  106. if (mobilecheck == null)
  107. {
  108. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  109. }
  110. if (mobilecheck.CheckCode != MobileCode)
  111. {
  112. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  113. }
  114. RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
  115. var info = MySelfUtil.ChangeLoginMobile(LoginMobile, Mobile);
  116. return new AppResultJson() { Status = "1", Info = "", Data = info };
  117. }
  118. #endregion
  119. #region 我的-商户统计数据(个人中心主界面)
  120. // [Authorize]
  121. public JsonResult StatData(string value)
  122. {
  123. value = DesDecrypt(value);
  124. JsonData data = JsonMapper.ToObject(value);
  125. Dictionary<string, object> Obj = StatDataDo(value);
  126. return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
  127. }
  128. public Dictionary<string, object> StatDataDo(string value)
  129. {
  130. JsonData data = JsonMapper.ToObject(value);
  131. Dictionary<string, object> Obj = new Dictionary<string, object>();
  132. int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString()));
  133. var Info = MySelfUtil.StatData(MerchantId);
  134. return Obj;
  135. }
  136. #endregion
  137. }
  138. }