HomeController.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.PxcModels;
  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 = "";
  49. //{"id":"dc4512b7-83cd-5fa5-91e9-a80fc8562e96","create_time":"2023-06-01T13:42:42+08:00","resource_type":"encrypt-resource","event_type":"TRANSACTION.SUCCESS","summary":"支付成功","resource":{"original_type":"transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"n/mRI+vnpUsIoNPM9dCsQvcbqOkhQkpoeWAPsdenYw/FvyDmg9Cc4N8yRa6nFxVYpQR7pbjxYLQcZk8bf2Us4mo6ZCUN4B/JH0NT4ja1eSyy7no6n2mJyufpf2oig9KbqabTjiFk84zIyxdg3wtttEohdYZr1w8rPSF0+7MR5LAdx73g+v5f/gbu0r3AzwErbO7fF9vOoJqNgqcc3VgpAhoH9xwed+PNCUmgGH+YjO0lvdurztJL0iXT9P6kiy+36Tcsp6wT2SdVXCzxS65wNhPI2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nT18XYcu6rYQhvjoyoW41ATVFDZtV3Xh/y7n14foLT5qXfkG21SABCviVL79N+36koa8rQB5yJQ==";
  51. // string txt = WeChatFunction.Instance.AesGcmDecrypt("transaction", "ACgp5LfxJ2Pl", content);
  52. // Dictionary<string, string> result = WeChatFunction.Instance.Refund("1645266943", 0.01M, 0.1M, "2023060214014405449699901", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8));
  53. // txt = Newtonsoft.Json.JsonConvert.SerializeObject(result);
  54. // txt = Newtonsoft.Json.JsonConvert.SerializeObject(WeChatFunction.Instance.QueryMerchant("KXS2023060213554647660112"));
  55. return txt;
  56. }
  57. }
  58. }