123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- 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<HomeController> _logger;
- public HomeController(ILogger<HomeController> 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<string> MakerCodes = new List<string>();
- MakerCodes.Add("K0000000");
- WebCMSEntities db = new WebCMSEntities();
- string html = "<table>";
- List<Users> 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 += "<tr>";
- html += "<td>" + user.MakerCode + "</td>";
- html += "<td>" + user.RealName + "</td>";
- html += "<td>" + topUser.MakerCode + "</td>";
- html += "<td>" + topUser.RealName + "</td>";
- html += "</tr>";
- }
- html += "</table>";
- return html;
- }
- public string merinfo()
- {
- List<string> mernos = new List<string>();
- mernos.Add("M900064131K7muih89");
- WebCMSEntities db = new WebCMSEntities();
- string html = "<table>";
- List<PosMerchantInfo> 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 += "<tr>";
- html += "<td>`" + mer.KqMerNo + "</td>";
- html += "<td>`" + pos.PosSn + "</td>";
- html += "<td>" + user.MakerCode + "</td>";
- html += "<td>" + user.RealName + "</td>";
- html += "<td>" + topUser.MakerCode + "</td>";
- html += "<td>" + topUser.RealName + "</td>";
- html += "</tr>";
- }
- html += "</table>";
- return html;
- }
- public string queryusers()
- {
- List<int> uids = new List<int>();
- uids.Add(3136);
- WebCMSEntities db = new WebCMSEntities();
- string html = "<table>";
- 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 += "<tr>";
- html += "<td>" + uid + "</td>";
- html += "<td>" + MakerCode5 + "</td>";
- html += "<td>" + RealName5 + "</td>";
- html += "<td>" + MakerCode9 + "</td>";
- html += "<td>" + RealName9 + "</td>";
- html += "</tr>";
- }
- html += "</table>";
- db.Dispose();
- return html;
- }
- public string test(int m, int b)
- {
- return PublicImportDataService.Instance.QueryActiveForBrandHK(m, b);
- }
-
-
- public string setjkfee()
- {
- List<string> posList = new List<string>();
- 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<string> PosSnList = new List<string>();
- 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<string> PosSnList = new List<string>();
- 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<string> PosSnList = new List<string>();
- 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;
- }
- }
- }
|