HomeController.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. // db.Dispose();
  76. // string content = function.ReadInstance("/wx.log");
  77. // string[] contents = content.Split('\n');
  78. // foreach(string sub in contents)
  79. // {
  80. // RedisDbconn.Instance.AddList("WeChatPayBack", sub);
  81. // }
  82. return txt;
  83. }
  84. public string testAlipay()
  85. {
  86. // string content = AlipayFunction.Instance.QuerySignStatus("2023061317351531100060045");
  87. // List<RoyaltyParameters> Parameters = new List<RoyaltyParameters>();
  88. // Parameters.Add(new RoyaltyParameters()
  89. // {
  90. // Account = "2088141704579033",
  91. // Amount = "0.01",
  92. // });
  93. // string content = AlipayFunction.Instance.Settle("2023061615441556447868073", "2023061622001451251436120885", Parameters);
  94. // string content = AlipayFunction.Instance.BindSettleRelation(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "2088141704579033");
  95. // string content = AlipayFunction.Instance.Refund("2023061622001451251436120885", "0.01", "门店消费补贴");
  96. // string content = AlipayFunction.Instance.QuerySettle("2023071214274372011988068", "2023071222001457121457238496", "202307BB6d61386d17104395831e3ea6309f0X57");
  97. // MerchantConfirmService.Instance.StartDo(68, 2);
  98. // string content = AlipayFunction.Instance.BindSettleRelation(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), AlipayFunction.Instance.Pid, "202307BB6d61386d17104395831e3ea6309f0X57");
  99. List<string> oids = new List<string>();
  100. oids.Add("157404");
  101. foreach(string oid in oids)
  102. {
  103. RedisDbconn.Instance.AddList("AddWeChatDiviQueue", oid);
  104. }
  105. return "ok";
  106. }
  107. public string test1()
  108. {
  109. // ProfitHelper.Instance.DoProfit();
  110. List<string> list = new List<string>();
  111. list.Add("LKB01230900199998516");
  112. WebCMSEntities db = new WebCMSEntities();
  113. foreach(string sub in list)
  114. {
  115. bool op = db.PosMachinesTwo.Any(m => m.PosSn == sub);
  116. if(!op)
  117. {
  118. //insert into PosMachinesTwo (CreateDate,SourceStoreId,StoreId,PosSn,SourcePosSn) values (now(),2,2,'
  119. db.PosMachinesTwo.Add(new PosMachinesTwo()
  120. {
  121. CreateDate = DateTime.Now,
  122. SourceStoreId = 2,
  123. StoreId = 2,
  124. PosSn = sub,
  125. SourcePosSn = sub,
  126. });
  127. db.SaveChanges();
  128. }
  129. }
  130. db.Dispose();
  131. return "ok";
  132. }
  133. }
  134. }