HomeController.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System.Collections.Generic;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Microsoft.Extensions.Logging;
  4. using MySystem.MainModels;
  5. using System.Linq;
  6. using Library;
  7. using LitJson;
  8. using System;
  9. using System.IO;
  10. namespace MySystem.Controllers
  11. {
  12. public class HomeController : Controller
  13. {
  14. private readonly ILogger<HomeController> _logger;
  15. public HomeController(ILogger<HomeController> logger)
  16. {
  17. _logger = logger;
  18. }
  19. public IActionResult Index()
  20. {
  21. return View();
  22. }
  23. public IActionResult Error()
  24. {
  25. string isapi = Request.Headers["Api"].ToString();
  26. if (isapi != "1")
  27. {
  28. if (Response.StatusCode == 500)
  29. {
  30. return Redirect("/public/errpage/pc/500.html");
  31. }
  32. else if (Response.StatusCode == 502)
  33. {
  34. return Redirect("/public/errpage/pc/502.html");
  35. }
  36. else if (Response.StatusCode == 404)
  37. {
  38. return Redirect("/public/errpage/pc/404.html");
  39. }
  40. else if (Response.StatusCode == 401)
  41. {
  42. return Content("401");
  43. }
  44. }
  45. return View();
  46. }
  47. public string auth(string app_id, string source, string application_type, string app_auth_code, string state)
  48. {
  49. return app_id + "\n" + source + "\n" + application_type + "\n" + app_auth_code + "\n" + state + "\n" + Request.QueryString.ToString();
  50. }
  51. public string test()
  52. {
  53. string result = "";
  54. // List<ReceiverList> Receivers = new List<ReceiverList>();
  55. // Receivers.Add(new ReceiverList()
  56. // {
  57. // type = "MERCHANT_ID", //分账接收方类型
  58. // account = "1611167423", //分账接收方账号
  59. // amount = 1, //分账金额
  60. // description = "服务费", //分账描述
  61. // });
  62. // Receivers.Add(new ReceiverList()
  63. // {
  64. // type = "PERSONAL_OPENID", //分账接收方类型
  65. // account = "ooDpv5LkCKEguE-LMZO-rSV4TDpk", //分账接收方账号
  66. // amount = 1, //分账金额
  67. // description = "优惠", //分账描述
  68. // });
  69. // result = new WeChatFunction().ProfitShare("1645266943", "4200001846202306021274142861", "2023060214014405449699901", Receivers);
  70. // result = new WeChatFunction().AddReceive("1645266943", "PERSONAL_OPENID", "ooDpv5LkCKEguE-LMZO-rSV4TDpk", "", "USER");
  71. // result = new WeChatFunction().QueryProfitShare("1645266943", "4200001815202306025662773463", "2023060213335030713572885");
  72. // result += new WeChatFunction().Unfreeze("1647917209","4200001851202306296256433756","2023062914544345583469577", "结算");
  73. // result += new WeChatFunction().Unfreeze("1647917209","4200001871202306297971809063","2023062914503970424085049", "结算");
  74. // result += new WeChatFunction().Unfreeze("1647917209","4200001861202306299303626271","2023062914274571909443048", "结算");
  75. // result = new WeChatFunction().ProfitShareReturn("1646405429", "1611167423", "2023060810550382756164803", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), 0.02M);
  76. // result = new WeChatFunction().GetPublicKey();
  77. return result;
  78. }
  79. public string makeCode()
  80. {
  81. string code = "";
  82. List<string> list = new List<string>();
  83. string start = "LKB0123090019999";
  84. for(int i = 0;i<=9999;i++)
  85. {
  86. string num = i.ToString();
  87. for(int j = 0;j< 4 - i.ToString().Length;j++)
  88. {
  89. num = "0" + num;
  90. }
  91. string sn = dbconn.Encrypt3DES(start + num + function.get_Random(8), "l2k0b2#3");
  92. sn = sn.Substring(0, sn.Length - 1);
  93. code += System.Web.HttpUtility.UrlEncode(sn) + "\n";
  94. }
  95. return code;
  96. }
  97. }
  98. }