using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using MySystem.MainModels; using System.Linq; using Library; using LitJson; 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"); } else if (Response.StatusCode == 401) { return Content("401"); } } return View(); } public string usertop() { List MakerCodes = new List(); MakerCodes.Add("K0000000"); WebCMSEntities db = new WebCMSEntities(); string html = ""; List users = db.Users.Where(m => MakerCodes.Contains(m.MakerCode)).ToList(); foreach (Users user in users) { string ParentNav = function.CheckNull(user.ParentNav).Trim(',').Replace(",,", ","); if (string.IsNullOrEmpty(ParentNav)) { ParentNav = ",1,"; } string[] ParentNavList = ParentNav.Split(','); int TopUserId = 0; if (ParentNavList.Length > 1) { TopUserId = int.Parse(ParentNavList[1]); } else { TopUserId = int.Parse(ParentNavList[0]); } Users topUser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users(); html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; } html += "
" + user.MakerCode + "" + user.RealName + "" + topUser.MakerCode + "" + topUser.RealName + "
"; return html; } public string merinfo() { List mernos = new List(); mernos.Add("M900064131K7muih89"); WebCMSEntities db = new WebCMSEntities(); string html = ""; List mers = db.PosMerchantInfo.Where(m => mernos.Contains(m.KqMerNo)).ToList(); foreach (PosMerchantInfo mer in mers) { MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == mer.KqSnNo) ?? new MachineForSnNo(); PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forSnNo.SnId) ?? new PosMachinesTwo(); Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users(); string ParentNav = function.CheckNull(user.ParentNav).Trim(',').Replace(",,", ","); if (string.IsNullOrEmpty(ParentNav)) { ParentNav = ",1,"; } string[] ParentNavList = ParentNav.Split(','); int TopUserId = 0; if (ParentNavList.Length > 1) { TopUserId = int.Parse(ParentNavList[1]); } else { TopUserId = int.Parse(ParentNavList[0]); } Users topUser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users(); html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; } html += "
`" + mer.KqMerNo + "`" + pos.PosSn + "" + user.MakerCode + "" + user.RealName + "" + topUser.MakerCode + "" + topUser.RealName + "
"; return html; } public string queryusers() { List uids = new List(); uids.Add(3136); WebCMSEntities db = new WebCMSEntities(); string html = ""; foreach (int uid in uids) { Users user = db.Users.FirstOrDefault(m => m.Id == uid) ?? new Users(); string ParentNav = user.ParentNav; string MakerCode5 = ""; string RealName5 = ""; string MakerCode9 = ""; string RealName9 = ""; if (!string.IsNullOrEmpty(ParentNav)) { string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(','); System.Array.Reverse(ParentNavList); foreach (string puidString in ParentNavList) { int puid = int.Parse(puidString); Users puser = db.Users.FirstOrDefault(m => m.Id == puid) ?? new Users(); if (puser.UserLevel == 5 && string.IsNullOrEmpty(MakerCode5)) { MakerCode5 = puser.MakerCode; RealName5 = puser.RealName; } else if (puser.UserLevel == 9 && string.IsNullOrEmpty(MakerCode9)) { MakerCode9 = puser.MakerCode; RealName9 = puser.RealName; break; } } } html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; } html += "
" + uid + "" + MakerCode5 + "" + RealName5 + "" + MakerCode9 + "" + RealName9 + "
"; db.Dispose(); return html; } public string test(int m, int b) { return PublicImportDataService.Instance.QueryActiveForBrandHK(m, b); } public string setjkfee() { List posList = new List(); posList.Add("M700046861MmMvOOv2,00003102722201179809510"); string content = ""; foreach(string data in posList) { string[] datalist = data.Split(','); content += function.GetWebRequest("http://connect.kexiaoshuang.com/home/setfee?merNo=" + datalist[0] + "&sn=" + datalist[1] + "&fee=0.60") + "\r\n\r\n"; } return content; } public string setlsdeposit() { string result = ""; List PosSnList = new List(); PosSnList.Add("000006026215741687,4"); foreach(string PosItem in PosSnList) { string[] PosItemList = PosItem.Split(','); string PosSn = PosItemList[0]; int BrandId = int.Parse(PosItemList[1]); result += PosSn +"\n"; string NewId = "709820390742437888", OldId = ""; string content = PublicImportDataService.Instance.QueryActiveForConfig(PosSn, BrandId); JsonData jsonObj = JsonMapper.ToObject(content); if (jsonObj["code"].ToString() == "0") { OldId = jsonObj["data"]["posMarket"]["id"].ToString(); } jsonObj = JsonMapper.ToObject(content); content = PublicImportDataService.Instance.SetDepositForLS(PosSn, OldId, NewId, BrandId); result += content +"\n\n"; } return result; } public string setlisdeposit() { string result = ""; List PosSnList = new List(); PosSnList.Add("N6220Y02012227"); foreach(string PosSn in PosSnList) { result += PosSn +"\n"; string content = PublicImportDataService.Instance.SetLiSDeposit(PosSn, 249); result += content +"\n\n"; } return result; } public string setkdbdeposit() { string result = ""; List PosSnList = new List(); PosSnList.Add("00005002681889126256"); foreach(string PosSn in PosSnList) { result += PosSn +"\n"; string content = PublicImportDataService.Instance.ModifyDeposit(PosSn, "473"); result += content +"\n\n"; } return result; } public string setkdbfee() { string PosSn = "00005002681889119261"; string content = PublicImportDataService.Instance.ModifyFee(PosSn, "0.0063"); // {"orderNo":22509} // string content = PublicImportDataService.Instance.QueryFee("22509"); // {"posSn":"00005702231071300130","type":"贷记卡刷卡","rate":0.0063000,"d0Fee":0.00,"status":"HANDLE_STATUS_COMPLETE"} return content; } public string setlsfee() { // string content = PublicImportDataService.Instance.QueryFeeTmpForBrand("100", "300", 4); // string content = PublicImportDataService.Instance.QueryFeeForBrand("000006026215739921", 4); // string content = PublicImportDataService.Instance.SetFeeForBrand("000006026215739921", "712391426860134400", "712391668250718208", "696339175297294336", 4); string content = PublicImportDataService.Instance.LDServiceFee("0000320226624650381480", 0, 10); return content; } } }