HomeController.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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 usertop()
  46. {
  47. List<string> MakerCodes = new List<string>();
  48. MakerCodes.Add("K0000000");
  49. WebCMSEntities db = new WebCMSEntities();
  50. string html = "<table>";
  51. List<Users> users = db.Users.Where(m => MakerCodes.Contains(m.MakerCode)).ToList();
  52. foreach (Users user in users)
  53. {
  54. string ParentNav = function.CheckNull(user.ParentNav).Trim(',').Replace(",,", ",");
  55. if (string.IsNullOrEmpty(ParentNav))
  56. {
  57. ParentNav = ",1,";
  58. }
  59. string[] ParentNavList = ParentNav.Split(',');
  60. int TopUserId = 0;
  61. if (ParentNavList.Length > 1)
  62. {
  63. TopUserId = int.Parse(ParentNavList[1]);
  64. }
  65. else
  66. {
  67. TopUserId = int.Parse(ParentNavList[0]);
  68. }
  69. Users topUser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
  70. html += "<tr>";
  71. html += "<td>" + user.MakerCode + "</td>";
  72. html += "<td>" + user.RealName + "</td>";
  73. html += "<td>" + topUser.MakerCode + "</td>";
  74. html += "<td>" + topUser.RealName + "</td>";
  75. html += "</tr>";
  76. }
  77. html += "</table>";
  78. return html;
  79. }
  80. public string merinfo()
  81. {
  82. List<string> mernos = new List<string>();
  83. mernos.Add("M900064131K7muih89");
  84. WebCMSEntities db = new WebCMSEntities();
  85. string html = "<table>";
  86. List<PosMerchantInfo> mers = db.PosMerchantInfo.Where(m => mernos.Contains(m.KqMerNo)).ToList();
  87. foreach (PosMerchantInfo mer in mers)
  88. {
  89. MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == mer.KqSnNo) ?? new MachineForSnNo();
  90. PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
  91. Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
  92. string ParentNav = function.CheckNull(user.ParentNav).Trim(',').Replace(",,", ",");
  93. if (string.IsNullOrEmpty(ParentNav))
  94. {
  95. ParentNav = ",1,";
  96. }
  97. string[] ParentNavList = ParentNav.Split(',');
  98. int TopUserId = 0;
  99. if (ParentNavList.Length > 1)
  100. {
  101. TopUserId = int.Parse(ParentNavList[1]);
  102. }
  103. else
  104. {
  105. TopUserId = int.Parse(ParentNavList[0]);
  106. }
  107. Users topUser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
  108. html += "<tr>";
  109. html += "<td>`" + mer.KqMerNo + "</td>";
  110. html += "<td>`" + pos.PosSn + "</td>";
  111. html += "<td>" + user.MakerCode + "</td>";
  112. html += "<td>" + user.RealName + "</td>";
  113. html += "<td>" + topUser.MakerCode + "</td>";
  114. html += "<td>" + topUser.RealName + "</td>";
  115. html += "</tr>";
  116. }
  117. html += "</table>";
  118. return html;
  119. }
  120. public string queryusers()
  121. {
  122. List<int> uids = new List<int>();
  123. uids.Add(3136);
  124. WebCMSEntities db = new WebCMSEntities();
  125. string html = "<table>";
  126. foreach (int uid in uids)
  127. {
  128. Users user = db.Users.FirstOrDefault(m => m.Id == uid) ?? new Users();
  129. string ParentNav = user.ParentNav;
  130. string MakerCode5 = "";
  131. string RealName5 = "";
  132. string MakerCode9 = "";
  133. string RealName9 = "";
  134. if (!string.IsNullOrEmpty(ParentNav))
  135. {
  136. string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
  137. System.Array.Reverse(ParentNavList);
  138. foreach (string puidString in ParentNavList)
  139. {
  140. int puid = int.Parse(puidString);
  141. Users puser = db.Users.FirstOrDefault(m => m.Id == puid) ?? new Users();
  142. if (puser.UserLevel == 5 && string.IsNullOrEmpty(MakerCode5))
  143. {
  144. MakerCode5 = puser.MakerCode;
  145. RealName5 = puser.RealName;
  146. }
  147. else if (puser.UserLevel == 9 && string.IsNullOrEmpty(MakerCode9))
  148. {
  149. MakerCode9 = puser.MakerCode;
  150. RealName9 = puser.RealName;
  151. break;
  152. }
  153. }
  154. }
  155. html += "<tr>";
  156. html += "<td>" + uid + "</td>";
  157. html += "<td>" + MakerCode5 + "</td>";
  158. html += "<td>" + RealName5 + "</td>";
  159. html += "<td>" + MakerCode9 + "</td>";
  160. html += "<td>" + RealName9 + "</td>";
  161. html += "</tr>";
  162. }
  163. html += "</table>";
  164. db.Dispose();
  165. return html;
  166. }
  167. public string test(int m, int b)
  168. {
  169. return PublicImportDataService.Instance.QueryActiveForBrandHK(m, b);
  170. }
  171. public string setjkfee()
  172. {
  173. List<string> posList = new List<string>();
  174. posList.Add("M700046861MmMvOOv2,00003102722201179809510");
  175. string content = "";
  176. foreach(string data in posList)
  177. {
  178. string[] datalist = data.Split(',');
  179. content += function.GetWebRequest("http://connect.kexiaoshuang.com/home/setfee?merNo=" + datalist[0] + "&sn=" + datalist[1] + "&fee=0.60") + "\r\n\r\n";
  180. }
  181. return content;
  182. }
  183. public string setlsdeposit()
  184. {
  185. string result = "";
  186. List<string> PosSnList = new List<string>();
  187. PosSnList.Add("000006026215741687,4");
  188. foreach(string PosItem in PosSnList)
  189. {
  190. string[] PosItemList = PosItem.Split(',');
  191. string PosSn = PosItemList[0];
  192. int BrandId = int.Parse(PosItemList[1]);
  193. result += PosSn +"\n";
  194. string NewId = "709820390742437888", OldId = "";
  195. string content = PublicImportDataService.Instance.QueryActiveForConfig(PosSn, BrandId);
  196. JsonData jsonObj = JsonMapper.ToObject(content);
  197. if (jsonObj["code"].ToString() == "0")
  198. {
  199. OldId = jsonObj["data"]["posMarket"]["id"].ToString();
  200. }
  201. jsonObj = JsonMapper.ToObject(content);
  202. content = PublicImportDataService.Instance.SetDepositForLS(PosSn, OldId, NewId, BrandId);
  203. result += content +"\n\n";
  204. }
  205. return result;
  206. }
  207. public string setlisdeposit()
  208. {
  209. string result = "";
  210. List<string> PosSnList = new List<string>();
  211. PosSnList.Add("N6220Y02012227");
  212. foreach(string PosSn in PosSnList)
  213. {
  214. result += PosSn +"\n";
  215. string content = PublicImportDataService.Instance.SetLiSDeposit(PosSn, 249);
  216. result += content +"\n\n";
  217. }
  218. return result;
  219. }
  220. public string setkdbdeposit()
  221. {
  222. string result = "";
  223. List<string> PosSnList = new List<string>();
  224. PosSnList.Add("00005002681889126256");
  225. foreach(string PosSn in PosSnList)
  226. {
  227. result += PosSn +"\n";
  228. string content = PublicImportDataService.Instance.ModifyDeposit(PosSn, "473");
  229. result += content +"\n\n";
  230. }
  231. return result;
  232. }
  233. public string setkdbfee()
  234. {
  235. string PosSn = "00005002681889119261";
  236. string content = PublicImportDataService.Instance.ModifyFee(PosSn, "0.0063");
  237. // {"orderNo":22509}
  238. // string content = PublicImportDataService.Instance.QueryFee("22509");
  239. // {"posSn":"00005702231071300130","type":"贷记卡刷卡","rate":0.0063000,"d0Fee":0.00,"status":"HANDLE_STATUS_COMPLETE"}
  240. return content;
  241. }
  242. public string setlsfee()
  243. {
  244. // string content = PublicImportDataService.Instance.QueryFeeTmpForBrand("100", "300", 4);
  245. // string content = PublicImportDataService.Instance.QueryFeeForBrand("000006026215739921", 4);
  246. // string content = PublicImportDataService.Instance.SetFeeForBrand("000006026215739921", "712391426860134400", "712391668250718208", "696339175297294336", 4);
  247. string content = PublicImportDataService.Instance.LDServiceFee("0000320226624650381480", 0, 10);
  248. return content;
  249. }
  250. }
  251. }