MerchantDepositOrderController.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. namespace MySystem.Areas.Api.Controllers.v1.Main1
  15. {
  16. [Area("Api")]
  17. [Route("/v1/QrCodePlateMain/[controller]/[action]")]
  18. public class MerchantDepositOrderController : BaseController
  19. {
  20. public MerchantDepositOrderController(IHttpContextAccessor accessor) : base(accessor)
  21. {
  22. }
  23. #region 商户激活-直连激活商户记录
  24. [Authorize]
  25. public JsonResult DirectActRecord(string value)
  26. {
  27. value = PublicFunction.DesDecrypt(value);
  28. JsonData data = JsonMapper.ToObject(value);
  29. Dictionary<string, object> Other = new Dictionary<string, object>();
  30. List<Dictionary<string, object>> dataList = DirectActRecordDo(value, out Other);
  31. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
  32. }
  33. private List<Dictionary<string, object>> DirectActRecordDo(string value, out Dictionary<string, object> Other)
  34. {
  35. JsonData data = JsonMapper.ToObject(value);
  36. string MerchantName = data["MerchantName"].ToString(); //商户名称
  37. string AliPID = data["AliPID"].ToString(); //支付宝PID
  38. string WeChatNo = data["WeChatNo"].ToString(); //微信商户号
  39. string UpdateDate = data["UpdateDate"].ToString(); //激活时间
  40. string PayMode = data["PayMode"].ToString(); //支付方式(1 支付宝 2 微信)
  41. int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
  42. int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
  43. string condition = "";
  44. if (!string.IsNullOrEmpty(MerchantName))
  45. {
  46. var query = MerchantAddInfoService.Query(" and CertMerchantName='" + MerchantName + "'");
  47. condition += " and MerchantId='" + query.Id + "'";
  48. }
  49. if (!string.IsNullOrEmpty(AliPID))
  50. {
  51. condition += " and AlipayPid='" + AliPID + "'";
  52. }
  53. if (!string.IsNullOrEmpty(WeChatNo))
  54. {
  55. condition += " and SubMchid='" + WeChatNo + "'";
  56. }
  57. if (!string.IsNullOrEmpty(data["UpdateDate"].ToString()))
  58. {
  59. string[] datelist = UpdateDate.Split(new string[] { " - " }, StringSplitOptions.None);
  60. string start = datelist[0];
  61. string end = datelist[1];
  62. condition += " and UpdateDate>='" + start + " 00:00:00' and UpdateDate<='" + end + " 23:59:59'";
  63. }
  64. if (!string.IsNullOrEmpty(data["PayMode"].ToString()))
  65. {
  66. condition += " and Sort='" + PayMode + "'";
  67. }
  68. List<RelationData> relationData = new List<RelationData>();
  69. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  70. Other = new Dictionary<string, object>();
  71. int count = 0;
  72. List<Dictionary<string, object>> source = MerchantDepositOrderService.List(relationData, condition, out count, pageNum, pageSize);
  73. foreach (Dictionary<string, object> subdata in source)
  74. {
  75. Dictionary<string, object> curData = new Dictionary<string, object>();
  76. var query = MerchantAddInfoService.Query(int.Parse(subdata["MerchantId"].ToString()));
  77. curData.Add("Id", subdata["Id"].ToString()); //Id
  78. curData.Add("MerchantName", query.CertMerchantName); //交易商户
  79. curData.Add("AliPID", query.AlipayPid); //支付宝PID
  80. curData.Add("WeChatNo", query.SubMchid); //微信商户号
  81. curData.Add("UpdateDate", subdata["UpdateDate"].ToString() == null ? "" : DateTime.Parse(subdata["UpdateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
  82. curData.Add("PayMode", int.Parse(subdata["Sort"].ToString())); //支付方式(1 支付宝 2 微信)
  83. curData.Add("ActPayPrice", decimal.Parse(subdata["ActPayPrice"].ToString())); //支付金额
  84. dataList.Add(curData);
  85. }
  86. return dataList;
  87. }
  88. #endregion
  89. }
  90. }