| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- using System.Collections.Generic;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- using MySystem.MainModels;
- using System.Linq;
- using Library;
- using LitJson;
- using System.Threading.Tasks;
- using System;
- 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");
- }
- }
- return View();
- }
- public string setFee(string merNo, string sn, decimal fee, int addRate = 0)
- {
- string content = PublicImportDataService.Instance.SetFee(merNo, sn, fee, addRate);
- JsonData obj = JsonMapper.ToObject(content);
- if (obj["code"].ToString() == "000000")
- {
- content += "|" + PublicImportDataService.Instance.Decrypt(obj["data"].ToString());
- }
- return content;
- }
- public string test()
- {
- // List<string> list = new List<string>();
- // foreach(string sub in list)
- // {
- // string url = "https://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_MACHINE_PRIZE_CONFIG_DIVISION&m=" + sub + "&ids=3";
- // string content = function.GetWebRequest(url);
- // }
- // return "ok";
- return PublicImportDataService.Instance.LePassGetExpiredIdCardUrl("5546616071");
- // string content = "MzdEcXp6ZkcvODlXL1NNWDhrRVAzemRTZC9zTityQlpXRHVxcGdLQlpRZz0=";
- // return PublicImportDataService.Instance.AesDecryptForIv(content);
- }
- public ActionResult LogSelect()
- {
- return View();
- }
- public async Task<string> LogSelectResult(string condi)
- {
- string result = "";
- string[] condiList = condi.Split('|');
- string logstore = "connect-log";
- string topic = condiList[0];
- string keyword = condiList[1];
- string month = condiList[2];
- if(topic.EndsWith("推送消息"))
- {
- logstore = "spserver";
- }
- IList<IDictionary<string, string>> logs = await SLS.GetLogs(logstore, topic, "* and content: " + keyword, DateTimeOffset.Now.AddMonths(-int.Parse(month)));
- foreach(IDictionary<string, string> log in logs)
- {
- result += log["__tag__:datetime"] + "\n";
- result += log["content"] + "\n";
- result += "\n--------------------------------------------------------------------------------------------------\n\n";
- }
- return result;
- }
- public async Task<string> SLSLog()
- {
- string logstore = "spserver";
- Dictionary<string, string> brands = new Dictionary<string, string>();
- brands.Add("开店宝", "2");
- brands.Add("乐刷", "4");
- brands.Add("立刷", "6");
- brands.Add("立刷微电签", "22");
- brands.Add("盛付通", "7");
- brands.Add("海科电签", "8");
- brands.Add("海科大POS", "9");
- brands.Add("联动", "10");
- brands.Add("盒易付电签", "12");
- brands.Add("联客宝", "15");
- brands.Add("拉卡拉", "30");
- brands.Add("联动掌中宝", "34");
- brands.Add("国通星驿付", "38");
- brands.Add("金控", "27");
- foreach(var topic in brands.Keys)
- {
- int page = 0;
- bool op = true;
- while(op)
- {
- int skip = page * 50;
- IList<IDictionary<string, string>> logs = await SLS.GetLogs(logstore, topic + "交易推送消息", "", DateTimeOffset.Parse("2026-01-23 00:00:00"), skip, 50);
- if(logs.Count > 0)
- {
- foreach(IDictionary<string, string> log in logs)
- {
- DateTime time = DateTime.Parse(log["__tag__:datetime"]);
- if(time < DateTime.Parse("2026-01-23 11:30:00"))
- {
- string content = log["content"];
- if(content.IndexOf("{") > 0)
- {
- content = content.Substring(content.IndexOf("{"));
- }
- RedisDbconn.Instance.AddList("kxs_trade_list_" + brands[topic], content);
- }
- }
- page += 1;
- }
- else
- {
- op = false;
- }
- }
- }
- return "ok";
- }
- public ActionResult SourceDataToDb()
- {
- WebCMSEntities db = new WebCMSEntities();
- var list = db.KqProducts.Select(m => new { m.SpProductType, m.Name }).ToList();
- List<string> strlist = new List<string>();
- foreach(var sub in list)
- {
- strlist.Add(sub.SpProductType + "|" + sub.Name);
- }
- db.Dispose();
- ViewBag.dic = strlist;
- return View();
- }
- public string SourceDataToDbResult(string content)
- {
- RedisDbconn.Instance.AddList("DataToDbQueue", content);
- return "ok";
- }
- public string prize()
- {
- // List<string> list = new List<string>();
- // list.Add("LDN7HDQM024100912776|252167");
- // foreach(string sub in list)
- // {
- // string[] data = sub.Split('|');
- // function.GetWebRequest("http://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_HAODA_PRIZE_CONFIG_DIVISION&m={\"brand_id\":29,\"ext_field\":\"830_01\",\"pos_sn\":\"" + data[0] + "\",\"user_id\":" + data[1] + "}&ids=67");
- // }
- // list = new List<string>();
- // list.Add("LDN7HDQM024100912625|297660");
- // foreach(string sub in list)
- // {
- // string[] data = sub.Split('|');
- // function.GetWebRequest("http://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_HAODA_PRIZE_CONFIG_DIVISION&m={\"brand_id\":29,\"ext_field\":\"830_01\",\"pos_sn\":\"" + data[0] + "\",\"user_id\":" + data[1] + "}&ids=67");
- // }
- // string[] data = function.ReadInstance("1.txt").Split('\n');
- // foreach(string sub in data)
- // {
- // function.GetWebRequest("http://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_LKB_PRO_PRIZE_CONFIG_DIVISION&m=" + sub + "&ids=69");
- // }
- // string[] data = function.ReadInstance("tmp/1.txt").Split('\n');
- // Dictionary<string, string> sn = new Dictionary<string, string>();
- // foreach(string sub in data)
- // {
- // string[] subdata = sub.Split(',');
- // sn.Add(subdata[0], subdata[1]);
- // }
- string[] data = function.ReadInstance("tmp/1.txt").Split('\n');
- foreach(string sub in data)
- {
- // string[] subdata = sub.Split(',');
- // if(sn.ContainsKey(subdata[0]))
- // {
- // string pos = subdata[0];
- // string userId = sn[subdata[0]];
- // string kind = subdata[2];
- // string amount = subdata[1];
- // string listId = "";
- // if(kind == "833_01") listId = "81";
- // if(kind == "833_02") listId = "82";
- // listId += ",83";
- // string m = "{\"brand_id\":36,\"ext_field\":\"" + kind + "\",\"pos_sn\":\"" + pos + "\",\"user_id\":" + userId + ",\"prize\":\"" + amount + "\"}";
- // function.GetWebRequest("http://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_HAODA_PRIZE_CONFIG_DIVISION&m=" + m + "&ids=" + listId);
- // }
- string s = function.GetWebRequest("http://logic-executor-api.kexiaoshuang.com/noauth/prize/pushbyone?n=QUEUE_KXS_LKB_PRO_PRIZE_CONFIG_DIVISION&m=" + sub + "&ids=72,73,75");
- }
- return "ok";
- }
- }
- }
|