HomeController.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. }
  39. return View();
  40. }
  41. public string setFee(string merNo, string sn, decimal fee, int addRate = 0)
  42. {
  43. string content = PublicImportDataService.Instance.SetFee(merNo, sn, fee, addRate);
  44. JsonData obj = JsonMapper.ToObject(content);
  45. if (obj["code"].ToString() == "000000")
  46. {
  47. content += "|" + PublicImportDataService.Instance.Decrypt(obj["data"].ToString());
  48. }
  49. return content;
  50. }
  51. public string test()
  52. {
  53. List<string> list = new List<string>();
  54. foreach(string sub in list)
  55. {
  56. string url = "https://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_MACHINE_PRIZE_CONFIG_DIVISION&m=" + sub + "&ids=3";
  57. string content = function.GetWebRequest(url);
  58. }
  59. return "ok";
  60. }
  61. }
  62. }