using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Data; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using MySystem.PxcModels; using System.Threading; using Library; using LitJson; using System.Security.Cryptography; namespace MySystem.Controllers { public class HomeController : Controller { private readonly ILogger _logger; public HomeController(ILogger logger) { _logger = logger; } public IActionResult Index() { return View(); } public IActionResult Error() { string isapi = Request.Headers["Api"].ToString(); if (isapi != "1") { if (Response.StatusCode == 500) { return Redirect("/public/errpage/pc/500.html"); } else if (Response.StatusCode == 502) { return Redirect("/public/errpage/pc/502.html"); } else if (Response.StatusCode == 404) { return Redirect("/public/errpage/pc/404.html"); } } return View(); } public string test() { WebCMSEntities db = new WebCMSEntities(); string content = function.ReadInstance("/txt/lkbsn.txt"); string[] list = content.Replace("\r", "").Split('\n'); foreach (string sub in list) { PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == sub); if (pos != null) { string info = "{\"RecordId\":\"\",\"PosId\":\"" + pos.Id + "\",\"Fee\": \"0.63\",\"Kind\": \"1\",\"OpMan\": \"" + "系统" + "\"}"; RedisDbconn.Instance.AddList("SetDepositPostQueue", info); } } db.Dispose(); return "ok"; } } }