|
@@ -1,698 +1,677 @@
|
|
|
-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();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static object o = new object();
|
|
|
- public string addmer(string mid, int k = 0)
|
|
|
- {
|
|
|
- MerchantConfirmService.Instance.Start(mid, k);
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string cleartrade()
|
|
|
- {
|
|
|
- StatService.Instance.clear();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string stattrade(string d)
|
|
|
- {
|
|
|
- StatService.Instance.dosomething2(d);
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string setqrcode(int uid = 0)
|
|
|
- {
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string userqrcode(int uid)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
- if (user != null)
|
|
|
- {
|
|
|
- MakeReferenceQrCodeService.Instance.Start(user.Id.ToString());
|
|
|
- return "ok";
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- return "fail";
|
|
|
- }
|
|
|
-
|
|
|
- public string getqrcode(int uid, int pid)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
- if (user != null)
|
|
|
- {
|
|
|
- return MakeReferenceQrCodeService.Instance.MergeQrCode(user, pid);
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- return "fail";
|
|
|
- }
|
|
|
-
|
|
|
- private void th1()
|
|
|
- {
|
|
|
- Thread th = new Thread(th1do);
|
|
|
- th.IsBackground = true;
|
|
|
- th.Start();
|
|
|
- }
|
|
|
- private void th1do()
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == 2);
|
|
|
- if (user != null)
|
|
|
- {
|
|
|
- user.SeoTitle = "111111";
|
|
|
- Thread.Sleep(5000);
|
|
|
- user.SeoDescription = "222222";
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
- private void th2()
|
|
|
- {
|
|
|
- Thread th = new Thread(th2do);
|
|
|
- th.IsBackground = true;
|
|
|
- th.Start();
|
|
|
- }
|
|
|
- private void th2do()
|
|
|
- {
|
|
|
- Thread.Sleep(2000);
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == 2);
|
|
|
- if (user != null)
|
|
|
- {
|
|
|
- user.SeoKeyword = "看看有没有值写入";
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
-
|
|
|
- // 补激活奖励
|
|
|
- public string setmeruser(string date)
|
|
|
- {
|
|
|
- StatService.Instance.dosomething1(date);
|
|
|
- return "ok";
|
|
|
- }
|
|
|
- public string chkactprize(int Id = 0)
|
|
|
- {
|
|
|
- if (Id > 0)
|
|
|
- {
|
|
|
- StatService.Instance.dosomething3(Id);
|
|
|
- }
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string mutilactprize()
|
|
|
- {
|
|
|
- List<int> ids = new List<int>();
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
- foreach (int id in ids)
|
|
|
- {
|
|
|
- PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == id);
|
|
|
- if (pos != null)
|
|
|
- {
|
|
|
- SpModels.ActivateRecord act = spdb.ActivateRecord.FirstOrDefault(m => m.SnNo == pos.PosSn && m.SeoTitle != "0" && !string.IsNullOrEmpty(m.SeoTitle));
|
|
|
- if (act != null)
|
|
|
- {
|
|
|
- pos.SeoKeyword = act.SeoTitle;
|
|
|
- db.SaveChanges();
|
|
|
- StatService.Instance.dosomething3(pos.Id);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- spdb.Dispose();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string checkOrder(int id)
|
|
|
- {
|
|
|
- AlipayPayBack2Service.Instance.checkOrder(id);
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string scanBind()
|
|
|
- {
|
|
|
- SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
- PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
- var Binds = spdb.BindRecord.Select(m => new { m.Id, m.CreateTime, m.Status, m.MerNo, m.MerSnNo }).OrderBy(m => m.Id).ToList();
|
|
|
- foreach (var Bind in Binds)
|
|
|
- {
|
|
|
- var tran = db.Database.BeginTransaction();
|
|
|
- try
|
|
|
- {
|
|
|
- PxcModels.MachineForSnNo posFor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == Bind.MerSnNo) ?? new PxcModels.MachineForSnNo();
|
|
|
- PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
|
|
|
- if (pos != null)
|
|
|
- {
|
|
|
- if (pos.BindingState == 0)
|
|
|
- {
|
|
|
- pos.BindingState = 1;
|
|
|
- pos.BindingTime = Bind.CreateTime;
|
|
|
- PxcModels.MachineForMerNo merFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Bind.MerNo);
|
|
|
- if (merFor == null)
|
|
|
- {
|
|
|
- merFor = db.MachineForMerNo.Add(new PxcModels.MachineForMerNo()
|
|
|
- {
|
|
|
- MerNo = Bind.MerNo,
|
|
|
- SnId = pos.Id,
|
|
|
- }).Entity;
|
|
|
- }
|
|
|
- db.SaveChanges();
|
|
|
- tran.Commit();
|
|
|
- function.WriteLog(pos.PosSn, "补充绑定数据");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- tran.Rollback();
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n" + Bind.Id, "同步SP绑定数据到MAIN异常");
|
|
|
- }
|
|
|
- tran.Dispose();
|
|
|
- }
|
|
|
- spdb.SaveChanges();
|
|
|
- spdb.Dispose();
|
|
|
- db.SaveChanges();
|
|
|
- db.Dispose();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string scanMerchant()
|
|
|
- {
|
|
|
- SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
- PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
- var Mers = spdb.Merchants.OrderBy(m => m.Id).ToList();
|
|
|
- foreach (var Mer in Mers)
|
|
|
- {
|
|
|
- var tran = db.Database.BeginTransaction();
|
|
|
- try
|
|
|
- {
|
|
|
- PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Mer.MerNo) ?? new PxcModels.MachineForMerNo();
|
|
|
- PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId) ?? new PxcModels.PosMachinesTwo();
|
|
|
- if (pos.BindingState == 1)
|
|
|
- {
|
|
|
- PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
|
|
|
- int TopUserId = 0;
|
|
|
- if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
- {
|
|
|
- TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
- }
|
|
|
- int BrandId = int.Parse(Mer.ProductType);
|
|
|
- if (Mer.MerNo.StartsWith("M900"))
|
|
|
- {
|
|
|
- BrandId = 3;
|
|
|
- }
|
|
|
- bool check = db.PosMerchantInfo.Any(m => m.KqMerNo == Mer.MerNo);
|
|
|
- if (!check)
|
|
|
- {
|
|
|
- PxcModels.PosMerchantInfo add = db.PosMerchantInfo.Add(new PxcModels.PosMerchantInfo()
|
|
|
- {
|
|
|
- CreateDate = Mer.CreateTime,
|
|
|
- UpdateDate = Mer.UpdateTime,
|
|
|
- TopUserId = TopUserId,
|
|
|
- MerUserType = user.MerchantType,
|
|
|
- BrandId = BrandId,
|
|
|
- SnStoreId = pos.StoreId,
|
|
|
- SnType = pos.PosSnType,
|
|
|
- UserId = pos.UserId,
|
|
|
- MgrName = Mer.AgentName,
|
|
|
- MerStatus = 1,
|
|
|
- KqSnNo = Mer.SnNo,
|
|
|
- KqMerNo = Mer.MerNo,
|
|
|
- MerIdcardNo = Mer.MerIdcardNo,
|
|
|
- MerRealName = Mer.MerRealName,
|
|
|
- MerchantMobile = Mer.MerMobile,
|
|
|
- MerchantName = Mer.MerName,
|
|
|
- MerchantNo = Mer.MerNo.Length > 16 ? Mer.MerNo.Substring(0, 16) : Mer.MerNo,
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- pos.BindMerchantId = add.Id;
|
|
|
- db.SaveChanges();
|
|
|
- tran.Commit();
|
|
|
- function.WriteLog(Mer.MerNo, "补充商户数据");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- tran.Rollback();
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n" + Mer.Id, "同步SP商户数据到MAIN异常");
|
|
|
- }
|
|
|
- tran.Dispose();
|
|
|
- }
|
|
|
- spdb.Dispose();
|
|
|
- db.Dispose();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string scanTrade()
|
|
|
- {
|
|
|
- SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
- PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
- IQueryable<SpModels.TradeRecord> trades = spdb.TradeRecord.OrderBy(m => m.Id);
|
|
|
- foreach (SpModels.TradeRecord trade in trades.ToList())
|
|
|
- {
|
|
|
- bool op = true;
|
|
|
- if (trade.SerEntryMode == "N")
|
|
|
- {
|
|
|
- if (trade.TradeAmount == 9900 || trade.TradeAmount == 19900 || trade.TradeAmount == 29900)
|
|
|
- {
|
|
|
- op = false;
|
|
|
- PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new PxcModels.MachineForMerNo();
|
|
|
- PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
|
|
|
- if (pos != null)
|
|
|
- {
|
|
|
- if (trade.SerEntryMode == "N" && trade.ProductType == "1")
|
|
|
- {
|
|
|
- pos.SeoKeyword = trade.TradeAmount.ToString("f2");
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (op)
|
|
|
- {
|
|
|
- PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new PxcModels.MachineForMerNo();
|
|
|
- PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
|
|
|
- if (pos != null)
|
|
|
- {
|
|
|
- if (pos.BindMerchantId > 0)
|
|
|
- {
|
|
|
- PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
|
|
|
- int TopUserId = 0;
|
|
|
- if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
- {
|
|
|
- TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
- }
|
|
|
- bool check = db.TradeRecord.Any(m => m.RecordNo == trade.TradeSerialNo);
|
|
|
- if (!check)
|
|
|
- {
|
|
|
- decimal TradeAmount = trade.TradeAmount;
|
|
|
- int BankCardType = -1;
|
|
|
- int QrPayFlag = 0;
|
|
|
- if (pos.BrandId == 1 || pos.BrandId == 3)
|
|
|
- {
|
|
|
- TradeAmount = TradeAmount / 100;
|
|
|
- BankCardType = int.Parse(trade.BankCardType);
|
|
|
- if(trade.TradeType == "02") QrPayFlag = 1;
|
|
|
- }
|
|
|
- else if (pos.BrandId == 2)
|
|
|
- {
|
|
|
- if (trade.TradeType == "CREDIT_BY_CARD")
|
|
|
- {
|
|
|
- BankCardType = 1;
|
|
|
- }
|
|
|
- else if (trade.TradeType == "DEBIT_BY_CARD")
|
|
|
- {
|
|
|
- BankCardType = 0;
|
|
|
- }
|
|
|
- if(trade.TradeType == "CLOUD_PAY") QrPayFlag = 1;
|
|
|
- }
|
|
|
- int BrandId = int.Parse(trade.ProductType);
|
|
|
- if (trade.MerNo.StartsWith("M900"))
|
|
|
- {
|
|
|
- BrandId = 3;
|
|
|
- }
|
|
|
- db.TradeRecord.Add(new PxcModels.TradeRecord()
|
|
|
- {
|
|
|
- CreateDate = trade.CreateDate,
|
|
|
- UpdateDate = trade.UpdateDate,
|
|
|
- RecordNo = trade.TradeSerialNo, //单号
|
|
|
- UserId = pos.UserId, //创客
|
|
|
- MerchantId = pos.BindMerchantId, //商户
|
|
|
- MerNo = trade.MerNo, //渠道商户编号
|
|
|
- MerHelpFlag = 0, //是否属于扶持周期内商户
|
|
|
- HelpMonthCount = 0, //扶持第几个月
|
|
|
- MerBuddyType = user.MerchantType, //商户创客类型
|
|
|
- SnNo = trade.TradeSnNo, //渠道SN号
|
|
|
- // TradeDate = DateTime.Parse(trade.TradeTime), //交易日期
|
|
|
- TradeSerialNo = trade.ChannelSerial, //交易流水号
|
|
|
- TradeAmount = TradeAmount, //交易金额
|
|
|
- BankCardType = BankCardType, //银行卡类型
|
|
|
- QrPayFlag = QrPayFlag, //云闪付标识
|
|
|
- BrandId = BrandId, //品牌
|
|
|
- Remark = trade.Remark, //备注
|
|
|
- TopUserId = TopUserId, //顶级创客
|
|
|
- MerUserId = pos.UserId, //商户直属创客
|
|
|
- });
|
|
|
- if (BankCardType == 1)
|
|
|
- {
|
|
|
- pos.CreditTrade += TradeAmount;
|
|
|
- }
|
|
|
- else if (BankCardType == 0)
|
|
|
- {
|
|
|
- pos.DebitCardTrade += TradeAmount;
|
|
|
- }
|
|
|
- if (pos.CreditTrade < 1000)
|
|
|
- {
|
|
|
- pos.IsPurchase = 99;
|
|
|
- }
|
|
|
- else if (pos.CreditTrade >= 1000 && pos.ActivationState == 0 && pos.BindingTime > DateTime.Now.AddDays(-20))
|
|
|
- {
|
|
|
- pos.IsPurchase = 0;
|
|
|
- pos.ActivationState = 1;
|
|
|
- pos.ActivationTime = DateTime.Now;
|
|
|
- PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
- if (merchant != null)
|
|
|
- {
|
|
|
- merchant.ActiveStatus = 1;
|
|
|
- merchant.MerStandardDate = DateTime.Now;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- }
|
|
|
- db.SaveChanges();
|
|
|
- function.WriteLog(trade.Id.ToString(), "补充交易数据");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- spdb.Dispose();
|
|
|
- db.Dispose();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- // public string add100()
|
|
|
- // {
|
|
|
- // WebCMSEntities db = new WebCMSEntities();
|
|
|
- // List<int> uids = new List<int>();
|
|
|
- // uids.Add(1053);
|
|
|
- // foreach (int uid in uids)
|
|
|
- // {
|
|
|
- // int ParentUserId = uid;
|
|
|
- // int machineCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.PosSnType == 0); //判断是否拥有3台购买机
|
|
|
- // int ActiveCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
|
|
|
- // if (machineCount + ActiveCount >= 3)
|
|
|
- // {
|
|
|
- // UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == ParentUserId);
|
|
|
- // if (account == null)
|
|
|
- // {
|
|
|
- // account = db.UserAccount.Add(new UserAccount()
|
|
|
- // {
|
|
|
- // Id = ParentUserId,
|
|
|
- // UserId = ParentUserId,
|
|
|
- // }).Entity;
|
|
|
- // db.SaveChanges();
|
|
|
- // }
|
|
|
- // decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
- // decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
- // decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
- // account.BalanceAmount += 100;
|
|
|
- // account.TotalAmount += 100;
|
|
|
- // decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
- // decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
- // decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
- // UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
- // {
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
- // UpdateDate = DateTime.Now,
|
|
|
- // UserId = ParentUserId, //创客
|
|
|
- // ChangeType = 112, //变动类型
|
|
|
- // ChangeAmount = 100, //变更金额
|
|
|
- // BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
- // AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
- // BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
- // AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
- // BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
- // AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
- // }).Entity;
|
|
|
- // db.SaveChanges();
|
|
|
- // RedisDbconn.Instance.Set("UserAccount:" + ParentUserId, account);
|
|
|
-
|
|
|
- // //推荐下单上级获得30天的机具循环天数
|
|
|
- // var posList = db.PosMachinesTwo.Select(m => new { m.Id, m.UserId, m.BindingState, m.RecycEndDate }).Where(m => m.UserId == ParentUserId && m.BindingState == 0 && m.RecycEndDate != null).ToList();
|
|
|
- // foreach (var subPos in posList)
|
|
|
- // {
|
|
|
- // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == subPos.Id);
|
|
|
- // if (pos != null)
|
|
|
- // {
|
|
|
- // pos.RecycEndDate = pos.RecycEndDate.Value.AddDays(30);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // db.SaveChanges();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // db.Dispose();
|
|
|
- // return "finish";
|
|
|
- // }
|
|
|
-
|
|
|
- //交易不到1000的机具,顶级姓名-代理姓名-客户姓名-客户电话-开机日期-SN // TODO:做到BS后台导出,按绑定时间查
|
|
|
- public IActionResult PosTable()
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- List<PosMachinesTwo> poses = db.PosMachinesTwo.Where(m => m.CreditTrade < 1000 && m.BindingState == 1).ToList();
|
|
|
- List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
|
|
|
- foreach (PosMachinesTwo pos in poses)
|
|
|
- {
|
|
|
- PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new Users();
|
|
|
- Users puser = db.Users.FirstOrDefault(m => m.Id == user.ParentUserId) ?? new Users();
|
|
|
- Users ppuser = db.Users.FirstOrDefault(m => m.Id == puser.ParentUserId) ?? new Users();
|
|
|
- Dictionary<string, string> item = new Dictionary<string, string>();
|
|
|
- string TopRealName = "";
|
|
|
- string TopMakerCode = "";
|
|
|
- string TopMobile = "";
|
|
|
- string ParentNav = user.ParentNav;
|
|
|
- if (!string.IsNullOrEmpty(ParentNav))
|
|
|
- {
|
|
|
- string[] navlist = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
- if (navlist.Length > 1)
|
|
|
- {
|
|
|
- int TopId = int.Parse(function.CheckInt(navlist[1]));
|
|
|
- Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
|
|
|
- TopRealName = tuser.RealName;
|
|
|
- TopMakerCode = tuser.MakerCode;
|
|
|
- TopMobile = tuser.Mobile;
|
|
|
- }
|
|
|
- }
|
|
|
- item.Add("TopRealName", TopRealName); //顶级姓名
|
|
|
- item.Add("TopMakerCode", TopMakerCode); //顶级编号
|
|
|
- item.Add("UpUpRealName", ppuser.RealName); //上上级姓名
|
|
|
- item.Add("UpRealName", puser.RealName); //上级姓名
|
|
|
- item.Add("RealName", user.RealName); //代理姓名
|
|
|
- item.Add("MakerCode", user.MakerCode); //代理编号
|
|
|
- item.Add("Mobile", user.Mobile); //代理手机号
|
|
|
- item.Add("MerchantName", merchant.MerchantName); //客户姓名
|
|
|
- item.Add("MerchantMobile", merchant.MerchantMobile); //客户电话
|
|
|
- item.Add("OpenTime", pos.BindingTime == null ? "" : pos.BindingTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //开机日期
|
|
|
- item.Add("Sn", pos.PosSn); //SN
|
|
|
- list.Add(item);
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- ViewBag.list = list;
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- public string resetall(int k = 0, int b = 1)
|
|
|
- {
|
|
|
- DataTable dt = dbconn.dtable("select Id from Users where AuthFlag=1");
|
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- if (k == 1)
|
|
|
- {
|
|
|
- reset(int.Parse(dr["Id"].ToString()));
|
|
|
- }
|
|
|
- else if (k == 2)
|
|
|
- {
|
|
|
- resetpos(int.Parse(dr["Id"].ToString()), b);
|
|
|
- }
|
|
|
- }
|
|
|
- return "ok";
|
|
|
- }
|
|
|
- public string reset(int uid)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- List<Users> users = db.Users.Where(m => m.ParentUserId == uid).OrderByDescending(m => m.AuthDate).ToList();
|
|
|
- RedisDbconn.Instance.Clear("MyMakerList:" + uid);
|
|
|
- RedisDbconn.Instance.Clear("MyMakerForNotAuth:" + uid);
|
|
|
- RedisDbconn.Instance.Clear("TotalUser:" + uid + "*");
|
|
|
- RedisDbconn.Instance.Clear("TotalUser:Auth:" + uid);
|
|
|
- foreach (Users user in users)
|
|
|
- {
|
|
|
- RedisDbconn.Instance.AddInt("TotalUser:" + uid);
|
|
|
- RedisDbconn.Instance.AddInt("TotalUser:" + uid + ":" + user.CreateDate.Value.ToString("yyyyMM"));
|
|
|
- RedisDbconn.Instance.AddInt("TotalUser:" + uid + ":" + user.CreateDate.Value.ToString("yyyyMMdd"));
|
|
|
- if (user.AuthFlag == 1)
|
|
|
- {
|
|
|
- RedisDbconn.Instance.AddList("MyMakerList:" + uid, new MyMakerItem()
|
|
|
- {
|
|
|
- UserId = user.Id,
|
|
|
- RealName = user.RealName,
|
|
|
- UserLevel = user.UserLevel,
|
|
|
- });
|
|
|
- RedisDbconn.Instance.AddInt("TotalUser:Auth:" + uid);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- RedisDbconn.Instance.AddList("MyMakerForNotAuth:" + uid, new MyMakerItem()
|
|
|
- {
|
|
|
- UserId = user.Id,
|
|
|
- RealName = user.RealName,
|
|
|
- UserLevel = user.UserLevel,
|
|
|
- });
|
|
|
- RedisDbconn.Instance.AddInt("TotalUser:NoAuth:" + uid);
|
|
|
- }
|
|
|
- RedisDbconn.Instance.Set("Users:" + user.Id, user);
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- return "finish";
|
|
|
- }
|
|
|
-
|
|
|
- public string resetpos(int uid, int kind)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- string IdBrand = uid + "_" + kind;
|
|
|
- UserMachineData machineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
- if (machineData == null)
|
|
|
- {
|
|
|
- machineData = db.UserMachineData.Add(new UserMachineData()
|
|
|
- {
|
|
|
- IdBrand = IdBrand
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- machineData.BindCount = db.PosMachinesTwo.Count(m => (m.UserId == uid && m.BuyUserId == uid) && m.BrandId == kind && m.BindingState == 1);
|
|
|
- machineData.UnBindCount = db.PosMachinesTwo.Count(m => (m.UserId == uid && m.BuyUserId == uid) && m.BrandId == kind && m.BindingState == 0);
|
|
|
- machineData.TotalMachineCount = machineData.BindCount + machineData.UnBindCount;
|
|
|
- db.SaveChanges();
|
|
|
- RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, machineData);
|
|
|
- RedisDbconn.Instance.SetExpire("UserMachineData:" + IdBrand, function.get_Random(1800, 5400));
|
|
|
- db.Dispose();
|
|
|
- return "finish";
|
|
|
- }
|
|
|
-
|
|
|
- // 更新分仓库存
|
|
|
- public string resetstorestock()
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- DataTable dt = dbconn.dtable("select s.Id,LaveNum,count(p.Id) as CurLaveNum from StoreHouse s left join PosMachinesTwo p on s.Id=p.StoreId and s.BrandId=p.BrandId and p.UserId=0 group by s.Id HAVING LaveNum!=count(p.Id)");
|
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- int Id = int.Parse(function.CheckInt(dr["Id"].ToString()));
|
|
|
- int CurLaveNum = int.Parse(function.CheckInt(dr["CurLaveNum"].ToString()));
|
|
|
- StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
|
|
|
- if (store != null)
|
|
|
- {
|
|
|
- store.LaveNum = CurLaveNum;
|
|
|
- db.SaveChanges();
|
|
|
- RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
|
|
|
- }
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
- public string resetstorestock2(int id)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- DataTable dt = dbconn.dtable("select Id,LaveNum,(select count(Id) from PosMachinesTwo where StoreId=s.Id and UserId=0) as CurLaveNum from StoreHouse s where Id=" + id);
|
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- int Id = int.Parse(function.CheckInt(dr["Id"].ToString()));
|
|
|
- int CurLaveNum = int.Parse(function.CheckInt(dr["CurLaveNum"].ToString()));
|
|
|
- StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
|
|
|
- if (store != null)
|
|
|
- {
|
|
|
- store.LaveNum = CurLaveNum;
|
|
|
- db.SaveChanges();
|
|
|
- RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
|
|
|
- }
|
|
|
- }
|
|
|
- db.Dispose();
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string chkpwd(string pwd)
|
|
|
- {
|
|
|
- return function.MD532(pwd);
|
|
|
- }
|
|
|
-
|
|
|
- //重置本月团队交易额
|
|
|
- public string resetMonthTrade()
|
|
|
- {
|
|
|
-
|
|
|
- return "";
|
|
|
- }
|
|
|
-
|
|
|
- public string traderecord(int kind, int id = 0)
|
|
|
- {
|
|
|
- OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
- if (kind == 1)
|
|
|
- {
|
|
|
- OtherMySqlConn.op("delete from TradeRecordTest;insert into TradeRecordTest (Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo) select Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo from TradeRecord order by CreateDate;");
|
|
|
- }
|
|
|
- else if (kind == 2)
|
|
|
- {
|
|
|
- OtherMySqlConn.op("delete from TradeRecord where Id<" + id + ";insert into TradeRecord (Id,Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo) select Id,Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo from TradeRecordTest order by Id;");
|
|
|
- }
|
|
|
- OtherMySqlConn.connstr = "";
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public string test()
|
|
|
- {
|
|
|
- string result = "ok";
|
|
|
- // result = CashBase.Instance.QuerySignStatus("523698138812123669");
|
|
|
- result = CashBase.Instance.CreateInfo("李春雷", "513001198312090419", "13880789833", function.imageToBase64String(function.getPath("/static/1.jpg")), function.imageToBase64String(function.getPath("/static/2.jpg")));
|
|
|
- //{"code":"000000","msg":"成功"}
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- public string test2()
|
|
|
- {
|
|
|
- string result = "ok";
|
|
|
- result = CashBase.Instance.ConfirmSign("513001198312090419");
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
+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();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static object o = new object();
|
|
|
+ public string addmer(string mid, int k = 0)
|
|
|
+ {
|
|
|
+ MerchantConfirmService.Instance.Start(mid, k);
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string setqrcode(int uid = 0)
|
|
|
+ {
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string userqrcode(int uid)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
+ if (user != null)
|
|
|
+ {
|
|
|
+ MakeReferenceQrCodeService.Instance.Start(user.Id.ToString());
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string getqrcode(int uid, int pid)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
+ if (user != null)
|
|
|
+ {
|
|
|
+ return MakeReferenceQrCodeService.Instance.MergeQrCode(user, pid);
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+
|
|
|
+ private void th1()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(th1do);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+ private void th1do()
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == 2);
|
|
|
+ if (user != null)
|
|
|
+ {
|
|
|
+ user.SeoTitle = "111111";
|
|
|
+ Thread.Sleep(5000);
|
|
|
+ user.SeoDescription = "222222";
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+ private void th2()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(th2do);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+ private void th2do()
|
|
|
+ {
|
|
|
+ Thread.Sleep(2000);
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == 2);
|
|
|
+ if (user != null)
|
|
|
+ {
|
|
|
+ user.SeoKeyword = "看看有没有值写入";
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 补激活奖励
|
|
|
+ public string setmeruser(string date)
|
|
|
+ {
|
|
|
+ StatService.Instance.dosomething1(date);
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+ public string chkactprize(int Id = 0)
|
|
|
+ {
|
|
|
+ if (Id > 0)
|
|
|
+ {
|
|
|
+ StatService.Instance.dosomething3(Id);
|
|
|
+ }
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string mutilactprize()
|
|
|
+ {
|
|
|
+ List<int> ids = new List<int>();
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
+ foreach (int id in ids)
|
|
|
+ {
|
|
|
+ PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == id);
|
|
|
+ if (pos != null)
|
|
|
+ {
|
|
|
+ SpModels.ActivateRecord act = spdb.ActivateRecord.FirstOrDefault(m => m.SnNo == pos.PosSn && m.SeoTitle != "0" && !string.IsNullOrEmpty(m.SeoTitle));
|
|
|
+ if (act != null)
|
|
|
+ {
|
|
|
+ pos.SeoKeyword = act.SeoTitle;
|
|
|
+ db.SaveChanges();
|
|
|
+ StatService.Instance.dosomething3(pos.Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ spdb.Dispose();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string checkOrder(int id)
|
|
|
+ {
|
|
|
+ AlipayPayBack2Service.Instance.checkOrder(id);
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string scanBind()
|
|
|
+ {
|
|
|
+ SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
+ PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
+ var Binds = spdb.BindRecord.Select(m => new { m.Id, m.CreateTime, m.Status, m.MerNo, m.MerSnNo }).OrderBy(m => m.Id).ToList();
|
|
|
+ foreach (var Bind in Binds)
|
|
|
+ {
|
|
|
+ var tran = db.Database.BeginTransaction();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ PxcModels.MachineForSnNo posFor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == Bind.MerSnNo) ?? new PxcModels.MachineForSnNo();
|
|
|
+ PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
|
|
|
+ if (pos != null)
|
|
|
+ {
|
|
|
+ if (pos.BindingState == 0)
|
|
|
+ {
|
|
|
+ pos.BindingState = 1;
|
|
|
+ pos.BindingTime = Bind.CreateTime;
|
|
|
+ PxcModels.MachineForMerNo merFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Bind.MerNo);
|
|
|
+ if (merFor == null)
|
|
|
+ {
|
|
|
+ merFor = db.MachineForMerNo.Add(new PxcModels.MachineForMerNo()
|
|
|
+ {
|
|
|
+ MerNo = Bind.MerNo,
|
|
|
+ SnId = pos.Id,
|
|
|
+ }).Entity;
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ tran.Commit();
|
|
|
+ function.WriteLog(pos.PosSn, "补充绑定数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ tran.Rollback();
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n" + Bind.Id, "同步SP绑定数据到MAIN异常");
|
|
|
+ }
|
|
|
+ tran.Dispose();
|
|
|
+ }
|
|
|
+ spdb.SaveChanges();
|
|
|
+ spdb.Dispose();
|
|
|
+ db.SaveChanges();
|
|
|
+ db.Dispose();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string scanMerchant()
|
|
|
+ {
|
|
|
+ SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
+ PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
+ var Mers = spdb.Merchants.OrderBy(m => m.Id).ToList();
|
|
|
+ foreach (var Mer in Mers)
|
|
|
+ {
|
|
|
+ var tran = db.Database.BeginTransaction();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Mer.MerNo) ?? new PxcModels.MachineForMerNo();
|
|
|
+ PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId) ?? new PxcModels.PosMachinesTwo();
|
|
|
+ if (pos.BindingState == 1)
|
|
|
+ {
|
|
|
+ PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
|
|
|
+ int TopUserId = 0;
|
|
|
+ if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
+ {
|
|
|
+ TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
+ }
|
|
|
+ int BrandId = int.Parse(Mer.ProductType);
|
|
|
+ if (Mer.MerNo.StartsWith("M900"))
|
|
|
+ {
|
|
|
+ BrandId = 3;
|
|
|
+ }
|
|
|
+ bool check = db.PosMerchantInfo.Any(m => m.KqMerNo == Mer.MerNo);
|
|
|
+ if (!check)
|
|
|
+ {
|
|
|
+ PxcModels.PosMerchantInfo add = db.PosMerchantInfo.Add(new PxcModels.PosMerchantInfo()
|
|
|
+ {
|
|
|
+ CreateDate = Mer.CreateTime,
|
|
|
+ UpdateDate = Mer.UpdateTime,
|
|
|
+ TopUserId = TopUserId,
|
|
|
+ MerUserType = user.MerchantType,
|
|
|
+ BrandId = BrandId,
|
|
|
+ SnStoreId = pos.StoreId,
|
|
|
+ SnType = pos.PosSnType,
|
|
|
+ UserId = pos.UserId,
|
|
|
+ MgrName = Mer.AgentName,
|
|
|
+ MerStatus = 1,
|
|
|
+ KqSnNo = Mer.SnNo,
|
|
|
+ KqMerNo = Mer.MerNo,
|
|
|
+ MerIdcardNo = Mer.MerIdcardNo,
|
|
|
+ MerRealName = Mer.MerRealName,
|
|
|
+ MerchantMobile = Mer.MerMobile,
|
|
|
+ MerchantName = Mer.MerName,
|
|
|
+ MerchantNo = Mer.MerNo.Length > 16 ? Mer.MerNo.Substring(0, 16) : Mer.MerNo,
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ pos.BindMerchantId = add.Id;
|
|
|
+ db.SaveChanges();
|
|
|
+ tran.Commit();
|
|
|
+ function.WriteLog(Mer.MerNo, "补充商户数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ tran.Rollback();
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n" + Mer.Id, "同步SP商户数据到MAIN异常");
|
|
|
+ }
|
|
|
+ tran.Dispose();
|
|
|
+ }
|
|
|
+ spdb.Dispose();
|
|
|
+ db.Dispose();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string scanTrade()
|
|
|
+ {
|
|
|
+ SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
+ PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
+ IQueryable<SpModels.TradeRecord> trades = spdb.TradeRecord.OrderBy(m => m.Id);
|
|
|
+ foreach (SpModels.TradeRecord trade in trades.ToList())
|
|
|
+ {
|
|
|
+ bool op = true;
|
|
|
+ if (trade.SerEntryMode == "N")
|
|
|
+ {
|
|
|
+ if (trade.TradeAmount == 9900 || trade.TradeAmount == 19900 || trade.TradeAmount == 29900)
|
|
|
+ {
|
|
|
+ op = false;
|
|
|
+ PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new PxcModels.MachineForMerNo();
|
|
|
+ PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
|
|
|
+ if (pos != null)
|
|
|
+ {
|
|
|
+ if (trade.SerEntryMode == "N" && trade.ProductType == "1")
|
|
|
+ {
|
|
|
+ pos.SeoKeyword = trade.TradeAmount.ToString("f2");
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (op)
|
|
|
+ {
|
|
|
+ PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new PxcModels.MachineForMerNo();
|
|
|
+ PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
|
|
|
+ if (pos != null)
|
|
|
+ {
|
|
|
+ if (pos.BindMerchantId > 0)
|
|
|
+ {
|
|
|
+ PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
|
|
|
+ int TopUserId = 0;
|
|
|
+ if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
+ {
|
|
|
+ TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
+ }
|
|
|
+ bool check = db.TradeRecord.Any(m => m.RecordNo == trade.TradeSerialNo);
|
|
|
+ if (!check)
|
|
|
+ {
|
|
|
+ decimal TradeAmount = trade.TradeAmount;
|
|
|
+ int BankCardType = -1;
|
|
|
+ int QrPayFlag = 0;
|
|
|
+ if (pos.BrandId == 1 || pos.BrandId == 3)
|
|
|
+ {
|
|
|
+ TradeAmount = TradeAmount / 100;
|
|
|
+ BankCardType = int.Parse(trade.BankCardType);
|
|
|
+ if(trade.TradeType == "02") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ else if (pos.BrandId == 2)
|
|
|
+ {
|
|
|
+ if (trade.TradeType == "CREDIT_BY_CARD")
|
|
|
+ {
|
|
|
+ BankCardType = 1;
|
|
|
+ }
|
|
|
+ else if (trade.TradeType == "DEBIT_BY_CARD")
|
|
|
+ {
|
|
|
+ BankCardType = 0;
|
|
|
+ }
|
|
|
+ if(trade.TradeType == "CLOUD_PAY") QrPayFlag = 1;
|
|
|
+ }
|
|
|
+ int BrandId = int.Parse(trade.ProductType);
|
|
|
+ if (trade.MerNo.StartsWith("M900"))
|
|
|
+ {
|
|
|
+ BrandId = 3;
|
|
|
+ }
|
|
|
+ db.TradeRecord.Add(new PxcModels.TradeRecord()
|
|
|
+ {
|
|
|
+ CreateDate = trade.CreateDate,
|
|
|
+ UpdateDate = trade.UpdateDate,
|
|
|
+ RecordNo = trade.TradeSerialNo, //单号
|
|
|
+ UserId = pos.UserId, //创客
|
|
|
+ MerchantId = pos.BindMerchantId, //商户
|
|
|
+ MerNo = trade.MerNo, //渠道商户编号
|
|
|
+ MerHelpFlag = 0, //是否属于扶持周期内商户
|
|
|
+ HelpMonthCount = 0, //扶持第几个月
|
|
|
+ MerBuddyType = user.MerchantType, //商户创客类型
|
|
|
+ SnNo = trade.TradeSnNo, //渠道SN号
|
|
|
+ // TradeDate = DateTime.Parse(trade.TradeTime), //交易日期
|
|
|
+ TradeSerialNo = trade.ChannelSerial, //交易流水号
|
|
|
+ TradeAmount = TradeAmount, //交易金额
|
|
|
+ BankCardType = BankCardType, //银行卡类型
|
|
|
+ QrPayFlag = QrPayFlag, //云闪付标识
|
|
|
+ BrandId = BrandId, //品牌
|
|
|
+ Remark = trade.Remark, //备注
|
|
|
+ TopUserId = TopUserId, //顶级创客
|
|
|
+ MerUserId = pos.UserId, //商户直属创客
|
|
|
+ });
|
|
|
+ if (BankCardType == 1)
|
|
|
+ {
|
|
|
+ pos.CreditTrade += TradeAmount;
|
|
|
+ }
|
|
|
+ else if (BankCardType == 0)
|
|
|
+ {
|
|
|
+ pos.DebitCardTrade += TradeAmount;
|
|
|
+ }
|
|
|
+ if (pos.CreditTrade < 1000)
|
|
|
+ {
|
|
|
+ pos.IsPurchase = 99;
|
|
|
+ }
|
|
|
+ else if (pos.CreditTrade >= 1000 && pos.ActivationState == 0 && pos.BindingTime > DateTime.Now.AddDays(-20))
|
|
|
+ {
|
|
|
+ pos.IsPurchase = 0;
|
|
|
+ pos.ActivationState = 1;
|
|
|
+ pos.ActivationTime = DateTime.Now;
|
|
|
+ PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
+ if (merchant != null)
|
|
|
+ {
|
|
|
+ merchant.ActiveStatus = 1;
|
|
|
+ merchant.MerStandardDate = DateTime.Now;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ function.WriteLog(trade.Id.ToString(), "补充交易数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ spdb.Dispose();
|
|
|
+ db.Dispose();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ // public string add100()
|
|
|
+ // {
|
|
|
+ // WebCMSEntities db = new WebCMSEntities();
|
|
|
+ // List<int> uids = new List<int>();
|
|
|
+ // uids.Add(1053);
|
|
|
+ // foreach (int uid in uids)
|
|
|
+ // {
|
|
|
+ // int ParentUserId = uid;
|
|
|
+ // int machineCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.PosSnType == 0); //判断是否拥有3台购买机
|
|
|
+ // int ActiveCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
|
|
|
+ // if (machineCount + ActiveCount >= 3)
|
|
|
+ // {
|
|
|
+ // UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == ParentUserId);
|
|
|
+ // if (account == null)
|
|
|
+ // {
|
|
|
+ // account = db.UserAccount.Add(new UserAccount()
|
|
|
+ // {
|
|
|
+ // Id = ParentUserId,
|
|
|
+ // UserId = ParentUserId,
|
|
|
+ // }).Entity;
|
|
|
+ // db.SaveChanges();
|
|
|
+ // }
|
|
|
+ // decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
+ // decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
+ // decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
+ // account.BalanceAmount += 100;
|
|
|
+ // account.TotalAmount += 100;
|
|
|
+ // decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
+ // decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
+ // decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
+ // UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
+ // {
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
+ // UpdateDate = DateTime.Now,
|
|
|
+ // UserId = ParentUserId, //创客
|
|
|
+ // ChangeType = 112, //变动类型
|
|
|
+ // ChangeAmount = 100, //变更金额
|
|
|
+ // BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
+ // AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
+ // BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
+ // AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
+ // BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
+ // AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
+ // }).Entity;
|
|
|
+ // db.SaveChanges();
|
|
|
+ // RedisDbconn.Instance.Set("UserAccount:" + ParentUserId, account);
|
|
|
+
|
|
|
+ // //推荐下单上级获得30天的机具循环天数
|
|
|
+ // var posList = db.PosMachinesTwo.Select(m => new { m.Id, m.UserId, m.BindingState, m.RecycEndDate }).Where(m => m.UserId == ParentUserId && m.BindingState == 0 && m.RecycEndDate != null).ToList();
|
|
|
+ // foreach (var subPos in posList)
|
|
|
+ // {
|
|
|
+ // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == subPos.Id);
|
|
|
+ // if (pos != null)
|
|
|
+ // {
|
|
|
+ // pos.RecycEndDate = pos.RecycEndDate.Value.AddDays(30);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // db.SaveChanges();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // db.Dispose();
|
|
|
+ // return "finish";
|
|
|
+ // }
|
|
|
+
|
|
|
+ //交易不到1000的机具,顶级姓名-代理姓名-客户姓名-客户电话-开机日期-SN // TODO:做到BS后台导出,按绑定时间查
|
|
|
+ public IActionResult PosTable()
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ List<PosMachinesTwo> poses = db.PosMachinesTwo.Where(m => m.CreditTrade < 1000 && m.BindingState == 1).ToList();
|
|
|
+ List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
|
|
|
+ foreach (PosMachinesTwo pos in poses)
|
|
|
+ {
|
|
|
+ PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new Users();
|
|
|
+ Users puser = db.Users.FirstOrDefault(m => m.Id == user.ParentUserId) ?? new Users();
|
|
|
+ Users ppuser = db.Users.FirstOrDefault(m => m.Id == puser.ParentUserId) ?? new Users();
|
|
|
+ Dictionary<string, string> item = new Dictionary<string, string>();
|
|
|
+ string TopRealName = "";
|
|
|
+ string TopMakerCode = "";
|
|
|
+ string TopMobile = "";
|
|
|
+ string ParentNav = user.ParentNav;
|
|
|
+ if (!string.IsNullOrEmpty(ParentNav))
|
|
|
+ {
|
|
|
+ string[] navlist = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ if (navlist.Length > 1)
|
|
|
+ {
|
|
|
+ int TopId = int.Parse(function.CheckInt(navlist[1]));
|
|
|
+ Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
|
|
|
+ TopRealName = tuser.RealName;
|
|
|
+ TopMakerCode = tuser.MakerCode;
|
|
|
+ TopMobile = tuser.Mobile;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.Add("TopRealName", TopRealName); //顶级姓名
|
|
|
+ item.Add("TopMakerCode", TopMakerCode); //顶级编号
|
|
|
+ item.Add("UpUpRealName", ppuser.RealName); //上上级姓名
|
|
|
+ item.Add("UpRealName", puser.RealName); //上级姓名
|
|
|
+ item.Add("RealName", user.RealName); //代理姓名
|
|
|
+ item.Add("MakerCode", user.MakerCode); //代理编号
|
|
|
+ item.Add("Mobile", user.Mobile); //代理手机号
|
|
|
+ item.Add("MerchantName", merchant.MerchantName); //客户姓名
|
|
|
+ item.Add("MerchantMobile", merchant.MerchantMobile); //客户电话
|
|
|
+ item.Add("OpenTime", pos.BindingTime == null ? "" : pos.BindingTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //开机日期
|
|
|
+ item.Add("Sn", pos.PosSn); //SN
|
|
|
+ list.Add(item);
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ ViewBag.list = list;
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ public string resetall(int k = 0, int b = 1)
|
|
|
+ {
|
|
|
+ DataTable dt = dbconn.dtable("select Id from Users where AuthFlag=1");
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
+ {
|
|
|
+ if (k == 1)
|
|
|
+ {
|
|
|
+ reset(int.Parse(dr["Id"].ToString()));
|
|
|
+ }
|
|
|
+ else if (k == 2)
|
|
|
+ {
|
|
|
+ resetpos(int.Parse(dr["Id"].ToString()), b);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+ public string reset(int uid)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ List<Users> users = db.Users.Where(m => m.ParentUserId == uid).OrderByDescending(m => m.AuthDate).ToList();
|
|
|
+ RedisDbconn.Instance.Clear("MyMakerList:" + uid);
|
|
|
+ RedisDbconn.Instance.Clear("MyMakerForNotAuth:" + uid);
|
|
|
+ RedisDbconn.Instance.Clear("TotalUser:" + uid + "*");
|
|
|
+ RedisDbconn.Instance.Clear("TotalUser:Auth:" + uid);
|
|
|
+ foreach (Users user in users)
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddInt("TotalUser:" + uid);
|
|
|
+ RedisDbconn.Instance.AddInt("TotalUser:" + uid + ":" + user.CreateDate.Value.ToString("yyyyMM"));
|
|
|
+ RedisDbconn.Instance.AddInt("TotalUser:" + uid + ":" + user.CreateDate.Value.ToString("yyyyMMdd"));
|
|
|
+ if (user.AuthFlag == 1)
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("MyMakerList:" + uid, new MyMakerItem()
|
|
|
+ {
|
|
|
+ UserId = user.Id,
|
|
|
+ RealName = user.RealName,
|
|
|
+ UserLevel = user.UserLevel,
|
|
|
+ });
|
|
|
+ RedisDbconn.Instance.AddInt("TotalUser:Auth:" + uid);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("MyMakerForNotAuth:" + uid, new MyMakerItem()
|
|
|
+ {
|
|
|
+ UserId = user.Id,
|
|
|
+ RealName = user.RealName,
|
|
|
+ UserLevel = user.UserLevel,
|
|
|
+ });
|
|
|
+ RedisDbconn.Instance.AddInt("TotalUser:NoAuth:" + uid);
|
|
|
+ }
|
|
|
+ RedisDbconn.Instance.Set("Users:" + user.Id, user);
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ return "finish";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string resetpos(int uid, int kind)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ string IdBrand = uid + "_" + kind;
|
|
|
+ UserMachineData machineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
+ if (machineData == null)
|
|
|
+ {
|
|
|
+ machineData = db.UserMachineData.Add(new UserMachineData()
|
|
|
+ {
|
|
|
+ IdBrand = IdBrand
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ machineData.BindCount = db.PosMachinesTwo.Count(m => (m.UserId == uid && m.BuyUserId == uid) && m.BrandId == kind && m.BindingState == 1);
|
|
|
+ machineData.UnBindCount = db.PosMachinesTwo.Count(m => (m.UserId == uid && m.BuyUserId == uid) && m.BrandId == kind && m.BindingState == 0);
|
|
|
+ machineData.TotalMachineCount = machineData.BindCount + machineData.UnBindCount;
|
|
|
+ db.SaveChanges();
|
|
|
+ RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, machineData);
|
|
|
+ RedisDbconn.Instance.SetExpire("UserMachineData:" + IdBrand, function.get_Random(1800, 5400));
|
|
|
+ db.Dispose();
|
|
|
+ return "finish";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新分仓库存
|
|
|
+ public string resetstorestock()
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ DataTable dt = dbconn.dtable("select s.Id,LaveNum,count(p.Id) as CurLaveNum from StoreHouse s left join PosMachinesTwo p on s.Id=p.StoreId and s.BrandId=p.BrandId and p.UserId=0 group by s.Id HAVING LaveNum!=count(p.Id)");
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
+ {
|
|
|
+ int Id = int.Parse(function.CheckInt(dr["Id"].ToString()));
|
|
|
+ int CurLaveNum = int.Parse(function.CheckInt(dr["CurLaveNum"].ToString()));
|
|
|
+ StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
|
|
|
+ if (store != null)
|
|
|
+ {
|
|
|
+ store.LaveNum = CurLaveNum;
|
|
|
+ db.SaveChanges();
|
|
|
+ RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+ public string resetstorestock2(int id)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ DataTable dt = dbconn.dtable("select Id,LaveNum,(select count(Id) from PosMachinesTwo where StoreId=s.Id and UserId=0) as CurLaveNum from StoreHouse s where Id=" + id);
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
+ {
|
|
|
+ int Id = int.Parse(function.CheckInt(dr["Id"].ToString()));
|
|
|
+ int CurLaveNum = int.Parse(function.CheckInt(dr["CurLaveNum"].ToString()));
|
|
|
+ StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
|
|
|
+ if (store != null)
|
|
|
+ {
|
|
|
+ store.LaveNum = CurLaveNum;
|
|
|
+ db.SaveChanges();
|
|
|
+ RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string chkpwd(string pwd)
|
|
|
+ {
|
|
|
+ return function.MD532(pwd);
|
|
|
+ }
|
|
|
+
|
|
|
+ //重置本月团队交易额
|
|
|
+ public string resetMonthTrade()
|
|
|
+ {
|
|
|
+
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string traderecord(int kind, int id = 0)
|
|
|
+ {
|
|
|
+ OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
+ if (kind == 1)
|
|
|
+ {
|
|
|
+ OtherMySqlConn.op("delete from TradeRecordTest;insert into TradeRecordTest (Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo) select Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo from TradeRecord order by CreateDate;");
|
|
|
+ }
|
|
|
+ else if (kind == 2)
|
|
|
+ {
|
|
|
+ OtherMySqlConn.op("delete from TradeRecord where Id<" + id + ";insert into TradeRecord (Id,Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo) select Id,Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo from TradeRecordTest order by Id;");
|
|
|
+ }
|
|
|
+ OtherMySqlConn.connstr = "";
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ public string test()
|
|
|
+ {
|
|
|
+ string result = "ok";
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|