HomeController.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using System.Data;
  6. using System.Threading.Tasks;
  7. using Microsoft.AspNetCore.Mvc;
  8. using Microsoft.Extensions.Logging;
  9. using MySystem.Models;
  10. using System.Threading;
  11. using Library;
  12. using LitJson;
  13. namespace MySystem.Controllers
  14. {
  15. public class HomeController : Controller
  16. {
  17. private readonly ILogger<HomeController> _logger;
  18. public HomeController(ILogger<HomeController> logger)
  19. {
  20. _logger = logger;
  21. }
  22. public IActionResult Index()
  23. {
  24. return View();
  25. }
  26. public IActionResult Error()
  27. {
  28. string isapi = Request.Headers["Api"].ToString();
  29. if (isapi != "1")
  30. {
  31. if (Response.StatusCode == 500)
  32. {
  33. return Redirect("/public/errpage/pc/500.html");
  34. }
  35. else if (Response.StatusCode == 502)
  36. {
  37. return Redirect("/public/errpage/pc/502.html");
  38. }
  39. else if (Response.StatusCode == 404)
  40. {
  41. return Redirect("/public/errpage/pc/404.html");
  42. }
  43. }
  44. return View();
  45. }
  46. public string test()
  47. {
  48. string txt = "ok";
  49. // txt = WeChatFunction.Instance.QueryProfitShare("1646405429","4200001807202306098649105270","2023060910241258564572510");
  50. // ProfitHelper.Instance.ReturnStat(Id, 2);
  51. WebCMSEntities db = new WebCMSEntities();
  52. // List<int> oids = new List<int>();
  53. // if(id > 0)
  54. // {
  55. // oids.Add(id);
  56. // }
  57. // else
  58. // {
  59. // oids.Add(15);
  60. // oids.Add(16);
  61. // oids.Add(17);
  62. // oids.Add(18);
  63. // oids.Add(19);
  64. // oids.Add(20);
  65. // }
  66. // foreach(int oid in oids)
  67. // {
  68. // ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == oid);
  69. // if(order != null)
  70. // {
  71. // RedisDbconn.Instance.AddList("ConsumerOrders:Divi:2:List", order.Id.ToString());
  72. // // RedisDbconn.Instance.AddList("ConsumerOrders:Divi:2:" + order.MerchantId, order);
  73. // }
  74. // }
  75. // string content = function.ReadInstance("/wx.log");
  76. // string[] contents = content.Split('\n');
  77. // foreach(string sub in contents)
  78. // {
  79. // RedisDbconn.Instance.AddList("WeChatPayBack", sub);
  80. // }
  81. // DataTable dt = CustomerSqlConn.dtable("select Id from ConsumerProfit where CreateDate<='2024-01-26 11:25:00' and SeoDescription is not null order by Id desc limit 2000", MysqlConn.SqlConnStr);
  82. // foreach(DataRow dr in dt.Rows)
  83. // {
  84. // int Id = int.Parse(dr["Id"].ToString());
  85. // ConsumerProfit profit = db.ConsumerProfit.FirstOrDefault(m => m.Id == Id);
  86. // if(profit != null)
  87. // {
  88. // ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == profit.OrderId) ?? new ConsumerOrders();
  89. // MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == profit.MerchantId) ?? new MerchantAddInfo();
  90. // if(order.PayMode == 1)
  91. // {
  92. // string result = AlipayFunction.Instance.Refund(order.SeoTitle, profit.SeoDescription, profit.GetMoney.ToString(), "门店消费补贴", merchantAdd.AlipayAuthToken);
  93. // }
  94. // else
  95. // {
  96. // Dictionary<string, string> dic = WeChatFunction.Instance.Refund(merchantAdd.SubMchid, profit.GetMoney, order.PayMoney, order.OrderNo, profit.SeoDescription, "门店消费补贴");
  97. // }
  98. // }
  99. // }
  100. // db.Dispose();
  101. return txt;
  102. }
  103. public string testAlipay()
  104. {
  105. // string content = AlipayFunction.Instance.QuerySignStatus("2023061317351531100060045");
  106. // List<RoyaltyParameters> Parameters = new List<RoyaltyParameters>();
  107. // Parameters.Add(new RoyaltyParameters()
  108. // {
  109. // Account = "2088141704579033",
  110. // Amount = "0.01",
  111. // });
  112. // string content = AlipayFunction.Instance.Settle("2023061615441556447868073", "2023061622001451251436120885", Parameters);
  113. // string content = AlipayFunction.Instance.BindSettleRelation(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "2088141704579033");
  114. // string content = AlipayFunction.Instance.Refund("2023061622001451251436120885", "0.01", "门店消费补贴");
  115. // string content = AlipayFunction.Instance.QuerySettle("2023071214274372011988068", "2023071222001457121457238496", "202307BB6d61386d17104395831e3ea6309f0X57");
  116. // MerchantConfirmService.Instance.StartDo(68, 2);
  117. // string content = AlipayFunction.Instance.BindSettleRelation(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), AlipayFunction.Instance.Pid, "202307BB6d61386d17104395831e3ea6309f0X57");
  118. List<string> oids = new List<string>();
  119. oids.Add("157404");
  120. foreach(string oid in oids)
  121. {
  122. RedisDbconn.Instance.AddList("AddWeChatDiviQueue", oid);
  123. }
  124. return "ok";
  125. }
  126. public string test1()
  127. {
  128. // ProfitHelper.Instance.DoProfit();
  129. List<string> list = new List<string>();
  130. list.Add("LKB01230900199998516");
  131. WebCMSEntities db = new WebCMSEntities();
  132. foreach(string sub in list)
  133. {
  134. bool op = db.PosMachinesTwo.Any(m => m.PosSn == sub);
  135. if(!op)
  136. {
  137. //insert into PosMachinesTwo (CreateDate,SourceStoreId,StoreId,PosSn,SourcePosSn) values (now(),2,2,'
  138. db.PosMachinesTwo.Add(new PosMachinesTwo()
  139. {
  140. CreateDate = DateTime.Now,
  141. SourceStoreId = 2,
  142. StoreId = 2,
  143. PosSn = sub,
  144. SourcePosSn = sub,
  145. });
  146. db.SaveChanges();
  147. }
  148. }
  149. db.Dispose();
  150. return "ok";
  151. }
  152. }
  153. }