123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- 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;
- 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 leaderflag()
- {
- WebCMSEntities db = new WebCMSEntities();
- List<int> ids = new List<int>();
- // List<PosCouponRecord> records = db.PosCouponRecord.Where(m => m.FromUserId == 597).ToList();
- // foreach(PosCouponRecord record in records)
- // {
- // ids.Add(record.PosCouponId);
- // }
- ids.Add(6843);
- List<PosCoupons> coupons = db.PosCoupons.Where(m => ids.Contains(m.Id) && m.IsUse == 1).ToList();
- foreach (PosCoupons coupon in coupons)
- {
- PosSns.Add(coupon.ExchangeCode);
- }
- foreach (PosCoupons coupon in coupons)
- {
- ChildNo(db, coupon.ExchangeCode, coupon.ExchangeCode, coupon.LeaderUserId);
- }
- // db.SaveChanges();
- db.Dispose();
- return "ok";
- }
- List<string> nos = new List<string>();
- private void ChildNo(WebCMSEntities db, string RootCheckNo, string CheckNo, int LeaderUserId)
- {
- MachineApply apply = db.MachineApply.FirstOrDefault(m => m.SwapSnExpand.Contains(CheckNo));
- if(apply != null)
- {
- int len = 0;
- string[] SnList = apply.SwapSnExpand.TrimEnd('\n').Split('\n');
- foreach(string sn in SnList)
- {
- if(PosSns.Contains(sn.Split(':')[0]) || nos.Contains(sn.Split(':')[0]))
- {
- len += 1;
- }
- }
- Orders order = db.Orders.FirstOrDefault(m => m.Id == apply.QueryCount);
- if(order != null)
- {
- if(!string.IsNullOrEmpty(order.SnNos))
- {
- if(order.SnNos.Contains(","))
- {
- string[] SwapSnExpands = order.SnNos.TrimEnd(',').Split(',');
- int index = 0;
- foreach(string no in SwapSnExpands)
- {
- if(!nos.Contains(no) && index < len)
- {
- index += 1;
- nos.Add(no);
- ChildNo(db, RootCheckNo, no, LeaderUserId);
- }
- }
- }
- else
- {
- string[] SwapSnExpands = order.SnNos.TrimEnd('\n').Split('\n');
- int index = 0;
- foreach(string no in SwapSnExpands)
- {
- if(!nos.Contains(no) && index < len)
- {
- index += 1;
- nos.Add(no);
- ChildNo(db, RootCheckNo, no, LeaderUserId);
- }
- }
- }
- }
- else
- {
- MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == CheckNo) ?? new MachineForSnNo();
- PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId);
- if(pos != null)
- {
- // pos.LeaderUserId = LeaderUserId;
- // Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn + ":" + apply.SwapSnExpand.TrimEnd('\n').Split('\n').Length, "大盟主奖励标记机具");
- Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
- Library.function.WriteLog(pos.PosSn + ":" + RootCheckNo + ":" + user.MakerCode + ":" + user.RealName, "大盟主奖励标记机具");
- }
- }
- }
- }
- else
- {
- MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == CheckNo) ?? new MachineForSnNo();
- PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m=>m.Id == forSnNo.SnId);
- if(pos != null)
- {
- // pos.LeaderUserId = LeaderUserId;
- // Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn, "大盟主奖励标记机具");
- Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
- Library.function.WriteLog(pos.PosSn + ":" + RootCheckNo + ":" + user.MakerCode + ":" + user.RealName, "大盟主奖励标记机具");
- }
- }
- }
- List<string> PosSns = new List<string>();
- public string ScanNos()
- {
- PosSns = new List<string>();
- PosSns.Add("00005002681889125851");
- WebCMSEntities db = new WebCMSEntities();
- foreach(string PosSn in PosSns)
- {
- ChildNo(db, PosSn, PosSn, 0);
- }
- db.Dispose();
- return "ok";
- }
-
- public string test()
- {
- // WebCMSEntities db = new WebCMSEntities();
- // AlipayPayBack2Service.Instance.DoOrderV2(db, 269424);
- // db.Dispose();
- // List<int> ids = new List<int>();
- // foreach(int id in ids)
- // {
- // TradeChangeService.Instance.StatTradeAmount(id, 2, 1);
- // }
- WebCMSEntities db = new WebCMSEntities();
- PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == "8610086012" && m.ActivationState == 0 && !string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0" && (m.CreditTrade >= 1000 || m.BrandId == 14));
- if(pos != null)
- {
- SycnSpTradeService.Instance.ActPos(db, pos, 0, 30);
- }
- db.Dispose();
- return "ok";
- }
- public string setlee()
- {
- WebCMSEntities db = new WebCMSEntities();
- List<string> poslist = new List<string>();
- poslist.Add("00003102722201179816714");
- foreach(string PosSn in poslist)
- {
- PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
- if(pos != null)
- {
- string info = "{\"RecordId\":\"\",\"PosId\":\"" + pos.Id + "\",\"Fee\": \"0.6\",\"Kind\": \"2\",\"OpMan\": \"系统\"}";
- RedisDbconn.Instance.AddList("SetDepositPostQueue", info);
- }
- }
- db.Dispose();
- return "ok";
- }
- public string lsprize(int id = 0)
- {
- // StatService.Instance.activePrizeWithoutDeposit6(id);
- // WebCMSEntities db = new WebCMSEntities();
- // List<string> poslist = new List<string>();
- // poslist.Add("N6220Y02004331");
- // poslist.Add("N6220Y02004411");
- // poslist.Add("N6220Y02006392");
- // poslist.Add("N6220Y02008090");
- // poslist.Add("N6220Y02014659");
- // poslist.Add("N6220Y02016352");
- // poslist.Add("N6220Y02018426");
- // poslist.Add("N6220Y02009475");
- // poslist.Add("N6220Y02009601");
- // poslist.Add("N6220Y02009630");
- // poslist.Add("N6220Y02010111");
- // poslist.Add("N6220Y02010795");
- // poslist.Add("N6220Y02011199");
- // poslist.Add("N6220Y02011405");
- // poslist.Add("N6220Y02011946");
- // poslist.Add("N6220Y02172467");
- // poslist.Add("N6220Y02172563");
- // poslist.Add("N6220Y02172658");
- // poslist.Add("N6220Y02172658");
- // poslist.Add("N6220Y02007603");
- // foreach(string PosSn in poslist)
- // {
- // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
- // if(pos != null)
- // {
- // // SycnSpTradeService.Instance.LiShuaActPrize(db, pos, 50);
- // StatService.Instance.activePrizeWithoutDeposit6(pos.Id);
- // }
- // }
- // db.Dispose();
-
- return "ok";
- }
- }
- }
|