MerchantDepositBackController.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. /// <summary>
  16. /// 商户服务费退还
  17. /// </summary>
  18. namespace MySystem.Areas.Api.Controllers.v1
  19. {
  20. [Area("Api")]
  21. [Route("/v1/qrcodeplatemain/[controller]/[action]")]
  22. public class MerchantDepositBackController : BaseController
  23. {
  24. public MerchantDepositBackController(IHttpContextAccessor accessor) : base(accessor)
  25. {
  26. }
  27. #region 商户激活—商户服务费退还
  28. // [Authorize]
  29. public JsonResult AddMerchantDepositBack(string value)
  30. {
  31. value = DesDecrypt(value);
  32. JsonData data = JsonMapper.ToObject(value);
  33. AppResultJson result = AddMerchantDepositBackDo(value);
  34. return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
  35. }
  36. private AppResultJson AddMerchantDepositBackDo(string value)
  37. {
  38. JsonData data = JsonMapper.ToObject(value);
  39. int MerchantId = int.Parse(function.CheckInt(data.getItem("MerchantId").ToString())); //商户Id
  40. int ReturnWay = int.Parse(function.CheckInt(data.getItem("ReturnWay").ToString())); //退还方式
  41. string MobileCode = data["MobileCode"].ToString(); //短信验证码
  42. string ReturnNo = data["ReturnNo"].ToString(); //退还账号
  43. var info = MerchantDepositBackUtil.AddMerchantDepositBackDo(MerchantId, ReturnWay, MobileCode, ReturnNo);
  44. if (info == "success")
  45. {
  46. return new AppResultJson() { Status = "1", Info = info, Data = info };
  47. }
  48. else
  49. {
  50. return new AppResultJson() { Status = "-1", Info = info, Data = info };
  51. }
  52. }
  53. #endregion
  54. #region 商户激活-银行选项名称
  55. // [Authorize]
  56. public JsonResult Options(string value)
  57. {
  58. value = DesDecrypt(value);
  59. JsonData data = JsonMapper.ToObject(value);
  60. List<Dictionary<string, object>> dataList = OptionsDo(value);
  61. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
  62. }
  63. private List<Dictionary<string, object>> OptionsDo(string value)
  64. {
  65. JsonData data = JsonMapper.ToObject(value);
  66. int PageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
  67. int PageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
  68. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  69. var query = GetBanks();
  70. foreach (string key in query.Keys)
  71. {
  72. Dictionary<string, object> curData = new Dictionary<string, object>();
  73. curData.Add("text", query[key]); //文本
  74. curData.Add("value", key); //值
  75. dataList.Add(curData);
  76. }
  77. return dataList;
  78. }
  79. #endregion
  80. private Dictionary<string, string> GetBanks()
  81. {
  82. Dictionary<string, string> dic = new Dictionary<string, string>();
  83. dic.Add("工商银行", "工商银行");
  84. dic.Add("农业银行", "农业银行");
  85. dic.Add("邮储银行", "邮储银行");
  86. dic.Add("建设银行", "建设银行");
  87. dic.Add("招商银行", "招商银行");
  88. dic.Add("中国银行", "中国银行");
  89. dic.Add("交通银行", "交通银行");
  90. dic.Add("浦发银行", "浦发银行");
  91. dic.Add("广发银行", "广发银行");
  92. dic.Add("民生银行", "民生银行");
  93. dic.Add("平安银行", "平安银行");
  94. dic.Add("光大银行", "光大银行");
  95. dic.Add("兴业银行", "兴业银行");
  96. dic.Add("中信银行", "中信银行");
  97. dic.Add("上海银行", "上海银行");
  98. dic.Add("其他银行", "其他银行");
  99. return dic;
  100. }
  101. }
  102. }