浏览代码

奖励已通过

lcl 1 年之前
父节点
当前提交
61e6a38ddf

+ 511 - 0
AppStart/Helper/ActiveRewardService.cs

@@ -0,0 +1,511 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using System.Threading;
+using MySystem.Models;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class ActiveRewardService
+    {
+        public readonly static ActiveRewardService Instance = new ActiveRewardService();
+        private ActiveRewardService()
+        { }
+
+
+        //激活奖
+        public void StartAct()
+        {
+            Thread th = new Thread(StartActListen);
+            th.IsBackground = true;
+            th.Start();
+        }
+        
+        private void StartActListen()
+        {
+            while(true)
+            {
+                if(RedisDbconn.Instance.Get<string>("ActiveRewardThreadStatus") == "1")
+                {
+                    StartActDo();
+                    Thread.Sleep(5000);
+                }
+            }
+        }
+
+        public void StartActDo()
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            KxsMainModels.WebCMSEntities kxsdb = new KxsMainModels.WebCMSEntities();
+            DateTime yesterday = DateTime.Now.AddDays(-1);
+            IQueryable<MerchantDepositOrder> orderList = db.MerchantDepositOrder.Where(m => m.Status == 1 && m.UpdateDate >= yesterday);
+            foreach (MerchantDepositOrder order in orderList.ToList())
+            {
+                doActiveReward(db, kxsdb, order, 300);
+                RedisDbconn.Instance.AddList("OpenRewardQueue1", order.MerchantId);
+                RedisDbconn.Instance.AddList("LeaderPrizeQueue1", order.MerchantId);
+                RedisDbconn.Instance.AddList("OperatePrizeQueue1", order.MerchantId);
+                MerchantDepositOrder edit = db.MerchantDepositOrder.FirstOrDefault(m => m.Id == order.Id);
+                if(edit != null)
+                {
+                    edit.Status = 2;
+                    db.SaveChanges();
+                }
+            }
+            db.Dispose();
+            kxsdb.Dispose();
+        }
+
+        public void doActiveReward(WebCMSEntities db, KxsMainModels.WebCMSEntities kxsdb, MerchantDepositOrder order, decimal ActPrize)
+        {
+            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantInfo();
+            KxsMainModels.Users user = kxsdb.Users.FirstOrDefault(m => m.Id == merchant.UserId) ?? new KxsMainModels.Users();
+            int GetUserId = user.Id;
+            string ParentNav = user.ParentNav;
+            int TopUserId = 0;
+            if (!string.IsNullOrEmpty(ParentNav))
+            {
+                TopUserId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+            }
+            string IdBrand = GetUserId + "_0";
+            UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+            if (userData == null)
+            {
+                userData = db.UserMachineData.Add(new UserMachineData()
+                {
+                    IdBrand = IdBrand,
+                }).Entity;
+                db.SaveChanges();
+            }
+            userData.ActProfit += ActPrize;
+            db.SaveChanges();
+            KxsMainModels.UserAccount account = kxsdb.UserAccount.FirstOrDefault(m => m.Id == GetUserId);
+            if (account == null)
+            {
+                account = kxsdb.UserAccount.Add(new KxsMainModels.UserAccount()
+                {
+                    Id = GetUserId,
+                    UserId = GetUserId,
+                }).Entity;
+                kxsdb.SaveChanges();
+            }
+            decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+            decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+            decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+            account.BalanceAmount += ActPrize;
+            account.TotalAmount += ActPrize;
+            decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+            decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+            decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+            KxsMainModels.UserAccountRecord userAccountRecord = kxsdb.UserAccountRecord.Add(new KxsMainModels.UserAccountRecord()
+            {
+                CreateDate = DateTime.Now,
+                UpdateDate = DateTime.Now,
+                UserId = GetUserId, //创客
+                ChangeType = 311, //变动类型
+                ChangeAmount = ActPrize, //变更金额
+                BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                QueryCount = merchant.Id,
+            }).Entity;
+            kxsdb.SaveChanges();
+        }
+
+
+
+
+
+
+
+
+        //开户奖
+        public void StartOpenReward()
+        {
+            Thread th = new Thread(StartOpenRewardDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+        public void StartOpenRewardDo()
+        {
+            while(true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("OpenRewardQueue1");
+                if(!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        WebCMSEntities db = new WebCMSEntities();
+                        KxsMainModels.WebCMSEntities kxsdb = new KxsMainModels.WebCMSEntities();
+                        function.WriteLog("\n\n" + DateTime.Now.ToString() + "\nposid:" + content, "开机奖励发放日志");
+                        int MerchantId = int.Parse(content);
+                        MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId);
+                        if (merchant != null)
+                        {
+                            function.WriteLog("商户:" + merchant.Name, "开机奖励发放日志");
+                            KxsMainModels.Users user = kxsdb.Users.FirstOrDefault(m => m.Id == merchant.UserId);
+                            if (user != null)
+                            {
+                                function.WriteLog("所属人:" + user.MakerCode, "开机奖励发放日志");
+                                string ParentNav = function.CheckNull(user.ParentNav) + "," + user.Id + ",";
+                                if (!string.IsNullOrEmpty(ParentNav))
+                                {
+                                    decimal Prize = 20;
+                                    string[] ParentNavs = ParentNav.Trim(',').Replace(",,", ",").Split(',');
+                                    for (int i = ParentNavs.Length - 1; i >= 0; i--)
+                                    {
+                                        int UserId = int.Parse(ParentNavs[i]);
+                                        KxsMainModels.Users puser = kxsdb.Users.FirstOrDefault(m => m.Id == UserId && m.AuthFlag == 1 && m.Status > -1);
+                                        if (puser != null && Prize > 0)
+                                        {
+                                            function.WriteLog("上级:" + puser.MakerCode, "开机奖励发放日志");
+                                            function.WriteLog("条件:LeaderLevel:" + puser.LeaderLevel + ",UserType:" + puser.UserType, "开机奖励发放日志");
+                                            if(puser.LeaderLevel > 0 || puser.UserType == 1)
+                                            {
+                                                bool leaderOp = true;
+                                                if(puser.LeaderLevel > 0 && puser.UserType == 0)
+                                                {
+                                                    DateTime now = DateTime.Now;
+                                                    leaderOp = kxsdb.Leaders.Any(m => m.Id == puser.Id && m.ExpiredDate >= now);
+                                                    function.WriteLog("条件:leaderOp:" + leaderOp, "开机奖励发放日志");
+                                                }
+                                                if(leaderOp)
+                                                {
+                                                    function.WriteLog("满足条件", "开机奖励发放日志");
+                                                    int pTopUserId = 0;
+                                                    if (!string.IsNullOrEmpty(puser.ParentNav))
+                                                    {
+                                                        pTopUserId = int.Parse(puser.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                                                    }
+                                                    string IdBrand = puser.Id + "_0";
+                                                    UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                                                    if (userData == null)
+                                                    {
+                                                        userData = db.UserMachineData.Add(new UserMachineData()
+                                                        {
+                                                            IdBrand = IdBrand,
+                                                        }).Entity;
+                                                        db.SaveChanges();
+                                                    }
+                                                    userData.OpenProfit += Prize;
+                                                    db.SaveChanges();
+                                                    //账户入库
+                                                    KxsMainModels.UserAccount account = kxsdb.UserAccount.FirstOrDefault(m => m.Id == puser.Id);
+                                                    if (account == null)
+                                                    {
+                                                        account = kxsdb.UserAccount.Add(new KxsMainModels.UserAccount()
+                                                        {
+                                                            Id = puser.Id,
+                                                            UserId = puser.Id,
+                                                        }).Entity;
+                                                        kxsdb.SaveChanges();
+                                                    }
+                                                    //收支明细入库
+                                                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                    account.BalanceAmount += Prize;
+                                                    account.TotalAmount += Prize;
+                                                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                    KxsMainModels.UserAccountRecord userAccountRecord = kxsdb.UserAccountRecord.Add(new KxsMainModels.UserAccountRecord()
+                                                    {
+                                                        CreateDate = DateTime.Now,
+                                                        UpdateDate = DateTime.Now,
+                                                        UserId = puser.Id, //创客
+                                                        ChangeType = 312, //变动类型
+                                                        ChangeAmount = Prize, //变更金额
+                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        QueryCount = MerchantId,
+                                                    }).Entity;
+                                                    kxsdb.SaveChanges();
+                                                    Prize = 0;
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        db.Dispose();
+                        kxsdb.Dispose();
+                    }
+                    catch(Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "实时获取开机奖励异常");
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(5000);
+                }
+            }
+        }
+
+
+
+        //盟主奖
+        public void StartLeaderReward()
+        {
+            Thread th = new Thread(StartLeaderRewardDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartLeaderRewardDo()
+        {
+            while (true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("LeaderPrizeQueue1");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        WebCMSEntities db = new WebCMSEntities();
+                        KxsMainModels.WebCMSEntities kxsdb = new KxsMainModels.WebCMSEntities();
+                        function.WriteLog("\n\n" + DateTime.Now.ToString() + "\nposid:" + content, "盟主奖励发放日志");
+                        int MerchantId = int.Parse(content);
+                        MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId);
+                        if (merchant != null)
+                        {
+                            function.WriteLog("商户:" + merchant.Name, "盟主奖励发放日志");
+                            KxsMainModels.Users user = kxsdb.Users.FirstOrDefault(m => m.Id == merchant.UserId);
+                            if (user != null)
+                            {
+                                function.WriteLog("所属人:" + user.MakerCode, "盟主奖励发放日志");
+                                string ParentNav = function.CheckNull(user.ParentNav) + "," + user.Id + ",";
+                                if (!string.IsNullOrEmpty(ParentNav))
+                                {
+                                    decimal Prize = 10;
+                                    string[] ParentNavs = ParentNav.Trim(',').Replace(",,", ",").Split(',');
+                                    for (int i = ParentNavs.Length - 1; i >= 0; i--)
+                                    {
+                                        int UserId = int.Parse(ParentNavs[i]);
+                                        KxsMainModels.Users puser = kxsdb.Users.FirstOrDefault(m => m.Id == UserId && m.AuthFlag == 1 && m.Status > -1);
+                                        if (puser != null && Prize > 0)
+                                        {
+                                            function.WriteLog("上级:" + puser.MakerCode, "盟主奖励发放日志");
+                                            function.WriteLog("条件:LeaderLevel:" + puser.LeaderLevel + ",UserType:" + puser.UserType, "盟主奖励发放日志");
+                                            if(puser.LeaderLevel == 2)
+                                            {
+                                                DateTime now = DateTime.Now;
+                                                bool leaderOp = kxsdb.Leaders.Any(m => m.Id == puser.Id && m.ExpiredDate >= now);
+                                                function.WriteLog("条件:leaderOp:" + leaderOp, "盟主奖励发放日志");
+                                                if(leaderOp)
+                                                {
+                                                    function.WriteLog("满足条件", "盟主奖励发放日志");
+                                                    int pTopUserId = 0;
+                                                    if (!string.IsNullOrEmpty(puser.ParentNav))
+                                                    {
+                                                        pTopUserId = int.Parse(puser.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                                                    }
+                                                    string IdBrand = puser.Id + "_0";
+                                                    UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                                                    if (userData == null)
+                                                    {
+                                                        userData = db.UserMachineData.Add(new UserMachineData()
+                                                        {
+                                                            IdBrand = IdBrand,
+                                                        }).Entity;
+                                                        db.SaveChanges();
+                                                    }
+                                                    userData.OpenProfit += Prize;
+                                                    db.SaveChanges();
+                                                    //账户入库
+                                                    KxsMainModels.UserAccount account = kxsdb.UserAccount.FirstOrDefault(m => m.Id == puser.Id);
+                                                    if (account == null)
+                                                    {
+                                                        account = kxsdb.UserAccount.Add(new KxsMainModels.UserAccount()
+                                                        {
+                                                            Id = puser.Id,
+                                                            UserId = puser.Id,
+                                                        }).Entity;
+                                                        kxsdb.SaveChanges();
+                                                    }
+                                                    //收支明细入库
+                                                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                    account.BalanceAmount += Prize;
+                                                    account.TotalAmount += Prize;
+                                                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                    KxsMainModels.UserAccountRecord userAccountRecord = kxsdb.UserAccountRecord.Add(new KxsMainModels.UserAccountRecord()
+                                                    {
+                                                        CreateDate = DateTime.Now,
+                                                        UpdateDate = DateTime.Now,
+                                                        UserId = puser.Id, //创客
+                                                        ChangeType = 313, //变动类型
+                                                        ChangeAmount = Prize, //变更金额
+                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        QueryCount = MerchantId,
+                                                    }).Entity;
+                                                    kxsdb.SaveChanges();
+                                                    Prize = 0;
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        db.Dispose();
+                        kxsdb.Dispose();
+                    }
+                    catch (Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "盟主奖发放日志异常");
+                    }
+                    Thread.Sleep(100);
+                }
+                else
+                {
+                    Thread.Sleep(60000);
+                }
+            }
+        }
+
+
+
+        //运营中心奖
+        public void StartOperateReward()
+        {
+            Thread th = new Thread(StartOperateRewardDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartOperateRewardDo()
+        {
+            while (true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("OperatePrizeQueue1");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        WebCMSEntities db = new WebCMSEntities();
+                        KxsMainModels.WebCMSEntities kxsdb = new KxsMainModels.WebCMSEntities();
+                        function.WriteLog("\n\n" + DateTime.Now.ToString() + "\nposid:" + content, "运营中心奖励发放日志");
+                        int MerchantId = int.Parse(content);
+                        MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId);
+                        if (merchant != null)
+                        {
+                            function.WriteLog("商户:" + merchant.Name, "运营中心奖励发放日志");
+                            KxsMainModels.Users user = kxsdb.Users.FirstOrDefault(m => m.Id == merchant.UserId);
+                            if (user != null)
+                            {
+                                function.WriteLog("所属人:" + user.MakerCode, "运营中心奖励发放日志");
+                                string ParentNav = function.CheckNull(user.ParentNav) + "," + user.Id + ",";
+                                if (!string.IsNullOrEmpty(ParentNav))
+                                {
+                                    decimal Prize = 5;
+                                    string[] ParentNavs = ParentNav.Trim(',').Replace(",,", ",").Split(',');
+                                    for (int i = ParentNavs.Length - 1; i >= 0; i--)
+                                    {
+                                        int UserId = int.Parse(ParentNavs[i]);
+                                        KxsMainModels.Users puser = kxsdb.Users.FirstOrDefault(m => m.Id == UserId && m.AuthFlag == 1 && m.Status > -1);
+                                        if (puser != null && Prize > 0)
+                                        {
+                                            function.WriteLog("上级:" + puser.MakerCode, "运营中心奖励发放日志");
+                                            function.WriteLog("条件:LeaderLevel:" + puser.LeaderLevel + ",UserType:" + puser.UserType, "运营中心奖励发放日志");
+                                            if(puser.UserType == 1)
+                                            {
+                                                function.WriteLog("满足条件", "运营中心奖励发放日志");
+                                                int pTopUserId = 0;
+                                                if (!string.IsNullOrEmpty(puser.ParentNav))
+                                                {
+                                                    pTopUserId = int.Parse(puser.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                                                }
+                                                string IdBrand = puser.Id + "_0";
+                                                UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                                                if (userData == null)
+                                                {
+                                                    userData = db.UserMachineData.Add(new UserMachineData()
+                                                    {
+                                                        IdBrand = IdBrand,
+                                                    }).Entity;
+                                                    db.SaveChanges();
+                                                }
+                                                userData.OpenProfit += Prize;
+                                                db.SaveChanges();
+                                                //账户入库
+                                                KxsMainModels.UserAccount account = kxsdb.UserAccount.FirstOrDefault(m => m.Id == puser.Id);
+                                                if (account == null)
+                                                {
+                                                    account = kxsdb.UserAccount.Add(new KxsMainModels.UserAccount()
+                                                    {
+                                                        Id = puser.Id,
+                                                        UserId = puser.Id,
+                                                    }).Entity;
+                                                    kxsdb.SaveChanges();
+                                                }
+                                                //收支明细入库
+                                                decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                account.BalanceAmount += Prize;
+                                                account.TotalAmount += Prize;
+                                                decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                KxsMainModels.UserAccountRecord userAccountRecord = kxsdb.UserAccountRecord.Add(new KxsMainModels.UserAccountRecord()
+                                                {
+                                                    CreateDate = DateTime.Now,
+                                                    UpdateDate = DateTime.Now,
+                                                    UserId = puser.Id, //创客
+                                                    ChangeType = 314, //变动类型
+                                                    ChangeAmount = Prize, //变更金额
+                                                    BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                    AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                    BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                    AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                    BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                    AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                    QueryCount = MerchantId,
+                                                }).Entity;
+                                                kxsdb.SaveChanges();
+                                                Prize = 0;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        db.Dispose();
+                        kxsdb.Dispose();
+                    }
+                    catch (Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "运营中心奖发放日志异常");
+                    }
+                    Thread.Sleep(100);
+                }
+                else
+                {
+                    Thread.Sleep(60000);
+                }
+            }
+        }
+
+        
+    }
+}

+ 20 - 0
KxsMainModels/ChangeTypes.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class ChangeTypes
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string Name { get; set; }
+        public int Kind { get; set; }
+    }
+}

+ 24 - 0
KxsMainModels/CustomQuery.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class CustomQuery
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string AdminNames { get; set; }
+        public string Title { get; set; }
+        public string SqlContent { get; set; }
+    }
+}

+ 2 - 0
KxsMainModels/LeaderAccountRecord.cs

@@ -29,5 +29,7 @@ namespace MySystem.KxsMainModels
         public string CreateMan { get; set; }
         public string UpdateMan { get; set; }
         public int Version { get; set; }
+        public decimal LeaderReserve { get; set; }
+        public int LeaderId { get; set; }
     }
 }

+ 26 - 0
KxsMainModels/LeaderCompAddTrade.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompAddTrade
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public decimal AddTradeAmount { get; set; }
+        public int UserId { get; set; }
+        public string StatMonth { get; set; }
+    }
+}

+ 26 - 0
KxsMainModels/LeaderCompAddTradeBak.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompAddTradeBak
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public decimal AddTradeAmount { get; set; }
+        public int UserId { get; set; }
+        public string StatMonth { get; set; }
+    }
+}

+ 30 - 0
KxsMainModels/LeaderCompPrize.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompPrize
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public decimal CompPrize { get; set; }
+        public ulong IsComp { get; set; }
+        public int SecDirectCount { get; set; }
+        public int NotDirectCount { get; set; }
+        public int DirectCount { get; set; }
+        public int UserId { get; set; }
+        public string StatMonth { get; set; }
+    }
+}

+ 30 - 0
KxsMainModels/LeaderCompPrizeBak.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompPrizeBak
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public decimal CompPrize { get; set; }
+        public ulong IsComp { get; set; }
+        public int SecDirectCount { get; set; }
+        public int NotDirectCount { get; set; }
+        public int DirectCount { get; set; }
+        public int UserId { get; set; }
+        public string StatMonth { get; set; }
+    }
+}

+ 13 - 0
KxsMainModels/LeaderCompTmp.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompTmp
+    {
+        public int Id { get; set; }
+        public string EveryMonthData { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+    }
+}

+ 13 - 0
KxsMainModels/LeaderCompTmpBak.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompTmpBak
+    {
+        public int Id { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public string EveryMonthData { get; set; }
+    }
+}

+ 31 - 0
KxsMainModels/LeaderCompTradeStat.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompTradeStat
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public decimal ResultTradeAmount { get; set; }
+        public decimal TradeAmount { get; set; }
+        public decimal CheckTradeAmount { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public int UserId { get; set; }
+        public string StatMonth { get; set; }
+        public decimal SelfResultTradeAmount { get; set; }
+        public decimal SelfTradeAmount { get; set; }
+        public decimal CheckSelfTradeAmount { get; set; }
+    }
+}

+ 31 - 0
KxsMainModels/LeaderCompTradeStatBak.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderCompTradeStatBak
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public decimal SelfResultTradeAmount { get; set; }
+        public decimal SelfTradeAmount { get; set; }
+        public decimal CheckSelfTradeAmount { get; set; }
+        public decimal ResultTradeAmount { get; set; }
+        public decimal TradeAmount { get; set; }
+        public decimal CheckTradeAmount { get; set; }
+        public string ParentNav { get; set; }
+        public int ParentUserId { get; set; }
+        public int UserId { get; set; }
+        public string StatMonth { get; set; }
+    }
+}

+ 25 - 0
KxsMainModels/LeaderReconRecord.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class LeaderReconRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public decimal BalanceAmount { get; set; }
+        public decimal ReserveAmount { get; set; }
+        public string StatMonth { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 1 - 0
KxsMainModels/MachineApply.cs

@@ -56,5 +56,6 @@ namespace MySystem.KxsMainModels
         public int UserId { get; set; }
         public string ApplyNo { get; set; }
         public int OperateId { get; set; }
+        public string OutBatchNo { get; set; }
     }
 }

+ 23 - 0
KxsMainModels/MsgAlertUserList.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class MsgAlertUserList
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int MsgId { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 5 - 0
KxsMainModels/PosMachinesTwo.cs

@@ -59,5 +59,10 @@ namespace MySystem.KxsMainModels
         public DateTime? RecycStartDate { get; set; }
         public string SourcePosSn { get; set; }
         public int RecycStatus { get; set; }
+        public string OutBatchNo { get; set; }
+        public int WithholdFlag { get; set; }
+        public int IsSupplement { get; set; }
+        public int IsOpAct { get; set; }
+        public int LastMerchantId { get; set; }
     }
 }

+ 2 - 0
KxsMainModels/PosMerchantInfoBak.cs

@@ -43,5 +43,7 @@ namespace MySystem.KxsMainModels
         public string MerchantMobile { get; set; }
         public string MerchantName { get; set; }
         public string MerchantNo { get; set; }
+        public int StandardMonths { get; set; }
+        public int StandardStatus { get; set; }
     }
 }

+ 1 - 0
KxsMainModels/PreSendStockDetail.cs

@@ -29,5 +29,6 @@ namespace MySystem.KxsMainModels
         public int BrandId { get; set; }
         public int StoreId { get; set; }
         public ulong AuthFlag { get; set; }
+        public int WithholdFlag { get; set; }
     }
 }

+ 2 - 0
KxsMainModels/SchoolMorningMeet.cs

@@ -23,5 +23,7 @@ namespace MySystem.KxsMainModels
         public string Photo { get; set; }
         public string Lecturer { get; set; }
         public string Title { get; set; }
+        public ulong IsBanner { get; set; }
+        public string BannerPhoto { get; set; }
     }
 }

+ 2 - 0
KxsMainModels/SetMerchantTypeRecord.cs

@@ -26,5 +26,7 @@ namespace MySystem.KxsMainModels
         public string Note { get; set; }
         public int ToUserId { get; set; }
         public int FromUserId { get; set; }
+        public int OperateType { get; set; }
+        public int BuyUserId { get; set; }
     }
 }

+ 24 - 0
KxsMainModels/SettlementCardChangeRecord.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class SettlementCardChangeRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string AfterCardNo { get; set; }
+        public string BeforeCardNo { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 12 - 0
KxsMainModels/TableSplit.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class TableSplit
+    {
+        public string TableName { get; set; }
+        public int EndId { get; set; }
+        public int StartId { get; set; }
+    }
+}

+ 14 - 0
KxsMainModels/TmpLeaders.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class TmpLeaders
+    {
+        public string MakerCode { get; set; }
+        public string RealName { get; set; }
+        public string LevelString { get; set; }
+        public DateTime? BuyDate { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 1 - 0
KxsMainModels/UserAccountRecord.cs

@@ -29,5 +29,6 @@ namespace MySystem.KxsMainModels
         public int ProductType { get; set; }
         public int ChangeType { get; set; }
         public int UserId { get; set; }
+        public int Kind { get; set; }
     }
 }

+ 42 - 0
KxsMainModels/UserCashRecordForBusiness.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.KxsMainModels
+{
+    public partial class UserCashRecordForBusiness
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string Remark { get; set; }
+        public string MediaSource { get; set; }
+        public string Ip { get; set; }
+        public DateTime? PaymentDate { get; set; }
+        public string ReturnMsg { get; set; }
+        public string ReturnCode { get; set; }
+        public string ResData { get; set; }
+        public string ReqData { get; set; }
+        public decimal ManageFee { get; set; }
+        public decimal TradeFee { get; set; }
+        public decimal ActualTradeAmount { get; set; }
+        public decimal TradeAmount { get; set; }
+        public string ChanelName { get; set; }
+        public string ChannelCode { get; set; }
+        public string PayTradeNo { get; set; }
+        public int TradeType { get; set; }
+        public string SettleBankName { get; set; }
+        public string SettleBankCardNo { get; set; }
+        public string IdCardNo { get; set; }
+        public int UserId { get; set; }
+        public string CashOrderNo { get; set; }
+    }
+}

+ 1 - 0
KxsMainModels/Users.cs

@@ -96,5 +96,6 @@ namespace MySystem.KxsMainModels
         public int ThisMonthSend { get; set; }
         public string BusinessLogo { get; set; }
         public string BusinessName { get; set; }
+        public DateTime? LogOutDate { get; set; }
     }
 }

文件差异内容过多而无法显示
+ 815 - 48
KxsMainModels/WebCMSEntities.cs


+ 11 - 0
Startup.cs

@@ -170,6 +170,13 @@ namespace MySystem
             });
 
             //必须打开的
+            if(Library.ConfigurationManager.EnvironmentFlag == 1)
+            {                
+                ActiveRewardService.Instance.StartAct();
+                ActiveRewardService.Instance.StartOpenReward();
+                ActiveRewardService.Instance.StartLeaderReward();
+                ActiveRewardService.Instance.StartOperateReward();
+            }
             if(Library.ConfigurationManager.EnvironmentFlag == 2)
             {
                 MerchantConfirmService.Instance.Start(); //特约商户进件队列
@@ -187,6 +194,10 @@ namespace MySystem
                 ProfitHelper.Instance.StartListenProfit(); //每月分润
 
                 AlipayPayBackFeeService.Instance.Start();
+                ActiveRewardService.Instance.StartAct();
+                ActiveRewardService.Instance.StartOpenReward();
+                ActiveRewardService.Instance.StartLeaderReward();
+                ActiveRewardService.Instance.StartOperateReward();
             }
             // HaoDaExtHelper.Instance.StartWeChat();
             // HaoDaExtHelper.Instance.StartAlipay();

+ 1 - 1
appsettings.Development.json

@@ -22,7 +22,7 @@
     "SpSqlConnStr": "server=47.109.31.237;port=3306;user=QrCodePlateSpServer;password=T2ZzxUq2fix0cTqa;database=QrCodePlateSpServer;charset=utf8;",
     "KxsSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;",
     "KxsStatSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsStatServer;charset=utf8;",
-    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=4,poolsize=500,preheat=50,asyncPipeline=true",
+    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=5,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "",

部分文件因为文件数量过多而无法显示