HomeController.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. namespace MySystem.Controllers
  9. {
  10. public class HomeController : Controller
  11. {
  12. private readonly ILogger<HomeController> _logger;
  13. public HomeController(ILogger<HomeController> logger)
  14. {
  15. _logger = logger;
  16. }
  17. public IActionResult Index()
  18. {
  19. return View();
  20. }
  21. public IActionResult Error()
  22. {
  23. string isapi = Request.Headers["Api"].ToString();
  24. if (isapi != "1")
  25. {
  26. if (Response.StatusCode == 500)
  27. {
  28. return Redirect("/public/errpage/pc/500.html");
  29. }
  30. else if (Response.StatusCode == 502)
  31. {
  32. return Redirect("/public/errpage/pc/502.html");
  33. }
  34. else if (Response.StatusCode == 404)
  35. {
  36. return Redirect("/public/errpage/pc/404.html");
  37. }
  38. else if (Response.StatusCode == 401)
  39. {
  40. return Content("401");
  41. }
  42. }
  43. return View();
  44. }
  45. public string test()
  46. {
  47. List<ReceiverList> Receivers = new List<ReceiverList>();
  48. Receivers.Add(new ReceiverList()
  49. {
  50. type = "MERCHANT_ID", //分账接收方类型
  51. account = "1611167423", //分账接收方账号
  52. amount = 1, //分账金额
  53. description = "服务费", //分账描述
  54. });
  55. string result = new WeChatFunction().ProfitShare("1645266943", "4200001833202306012813500432", "2023060113423544310448679", Receivers);
  56. return result;
  57. }
  58. }
  59. }