MySelfController.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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("/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. value = value.Replace("null", "\"\"");
  30. JsonData data = JsonMapper.ToObject(value);
  31. List<Dictionary<string, object>> dataList = CardInComeRecordListDo(value);
  32. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
  33. }
  34. private List<Dictionary<string, object>> CardInComeRecordListDo(string value)
  35. {
  36. JsonData data = JsonMapper.ToObject(value);
  37. int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
  38. string TradeMonth = data["TradeMonth"].ToString(); //交易月份
  39. string pageSize = data["PageSize"].ToString();
  40. string pageNum = data["PageNum"].ToString();
  41. var dataList = MySelfUtil.CardInComeRecordList(MerchantId, TradeMonth, pageSize, pageNum);
  42. return dataList;
  43. }
  44. #endregion
  45. #region 我的-到账记录-到账记录详情
  46. // [Authorize]
  47. public JsonResult CardInComeRecordDetail(string value)
  48. {
  49. value = DesDecrypt(value);
  50. value = value.Replace("null", "\"\"");
  51. JsonData data = JsonMapper.ToObject(value);
  52. Dictionary<string, object> obj = CardInComeRecordDetailDo(value);
  53. return Json(new AppResultJson() { Status = "1", Info = "", Data = obj });
  54. }
  55. private Dictionary<string, object> CardInComeRecordDetailDo(string value)
  56. {
  57. JsonData data = JsonMapper.ToObject(value);
  58. int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
  59. string OrderId = data["OrderId"].ToString(); //记录Id
  60. var obj = MySelfUtil.CardInComeRecordDetail(MerchantId, OrderId);
  61. return obj;
  62. }
  63. #endregion
  64. #region 我的-设置-修改登录手机号(原手机验证)
  65. // [Authorize]
  66. public JsonResult OldMobileCheck(string value)
  67. {
  68. value = DesDecrypt(value);
  69. value = value.Replace("null", "\"\"");
  70. JsonData data = JsonMapper.ToObject(value);
  71. AppResultJson result = OldMobileCheckDo(value);
  72. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  73. }
  74. private AppResultJson OldMobileCheckDo(string value)
  75. {
  76. JsonData data = JsonMapper.ToObject(value);
  77. string MobileCode = data["MobileCode"].ToString(); //短信验证码
  78. string Mobile = data["Mobile"].ToString(); //手机号
  79. MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + Mobile);
  80. if (mobilecheck == null)
  81. {
  82. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  83. }
  84. if (mobilecheck.CheckCode != MobileCode)
  85. {
  86. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  87. }
  88. RedisDbconn.Instance.Clear("MobileCodeCheck:手机号");
  89. Dictionary<string, object> Obj = new Dictionary<string, object>();
  90. return new AppResultJson() { Status = "1", Info = "", Data = Obj };
  91. }
  92. #endregion
  93. #region 我的-设置-修改登录手机号(新手机验证)
  94. // [Authorize]
  95. public JsonResult ChangeLoginMobile(string value)
  96. {
  97. value = DesDecrypt(value);
  98. value = value.Replace("null", "\"\"");
  99. JsonData data = JsonMapper.ToObject(value);
  100. AppResultJson result = ChangeLoginMobileDo(value);
  101. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  102. }
  103. private AppResultJson ChangeLoginMobileDo(string value)
  104. {
  105. JsonData data = JsonMapper.ToObject(value);
  106. string LoginMobile = data["LoginMobile"].ToString(); //原手机号
  107. string Mobile = data["Mobile"].ToString(); //手机号
  108. string MobileCode = data["MobileCode"].ToString(); //短信验证码
  109. MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + Mobile);
  110. if (mobilecheck == null)
  111. {
  112. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  113. }
  114. if (mobilecheck.CheckCode != MobileCode)
  115. {
  116. return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
  117. }
  118. RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
  119. var info = MySelfUtil.ChangeLoginMobile(LoginMobile, Mobile);
  120. return new AppResultJson() { Status = "1", Info = "", Data = info };
  121. }
  122. #endregion
  123. }
  124. }