lichunlei hace 2 años
padre
commit
0ee4883b78

+ 216 - 160
AppStart/Helper/AlipayPayBack2Service.cs

@@ -78,6 +78,7 @@ namespace MySystem
             db.Dispose();
         }
 
+        #region 新订单流程
         public void DoOrderV2(WebCMSEntities db, int OrderId)
         {
             Orders order = db.Orders.FirstOrDefault(m => m.Id == OrderId && m.Status == 0);
@@ -87,12 +88,11 @@ namespace MySystem
                 order.PayDate = DateTime.Now;
                 order.PayStatus = 1;
                 db.SaveChanges();
-                RedisDbconn.Instance.Set("Orders:" + order.Id, order);
 
-                //机具券逻辑
                 OrderProduct pro = db.OrderProduct.FirstOrDefault(m => m.OrderId == OrderId);
                 if (pro != null)
                 {
+                    List<int> couponIds = new List<int>();
                     if (pro.ProductId == 10 || pro.ProductId == 11 || pro.ProductId == 12 || pro.ProductId == 13)
                     {
                         order.Status = 2;
@@ -108,82 +108,23 @@ namespace MySystem
                         }
                         else if (pro.ProductId == 12)
                         {
-                            if (pro.NormDetail == "电签POS")
-                            {
-                                Kind = 1;
-                            }
-                            else if (pro.NormDetail == "大POS")
+                            Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId);
+                            if(user != null)
                             {
-                                Kind = 2;
+                                user.LeaderLevel = 1;
                             }
-                            
                         }
                         else if (pro.ProductId == 13)
                         {
-                            if (pro.NormDetail == "300电签POS")
-                            {
-                                Kind = 1;
-                            }
-                            else if (pro.NormDetail == "200大POS")
-                            {
-                                Kind = 2;
-                            }
-                            else if (pro.NormDetail == "50大机券+225电签券")
-                            {
-                                Kind = 3;
-                            }
-                            else if (pro.NormDetail == "100大机券+150电签券")
-                            {
-                                Kind = 4;
-                            }
-                            else if (pro.NormDetail == "150大机券+75电签券")
+                            Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId);
+                            if(user != null)
                             {
-                                Kind = 5;
+                                user.LeaderLevel = 2;
                             }
                         }
-                        db.SaveChanges();
-                        string Codes = "";
-                        if(Kind > 2)
-                        {
-                            Dictionary<int, int> couponData = new Dictionary<int, int>();
-                            if(Kind == 3)
-                            {
-                                couponData.Add(1, 225); //电签数量
-                                couponData.Add(2, 50); //大机数量
-                            }
-                            else if(Kind == 4)
-                            {
-                                couponData.Add(1, 150); //电签数量
-                                couponData.Add(2, 100); //大机数量
-                            }
-                            else if(Kind == 5)
-                            {
-                                couponData.Add(1, 75); //电签数量
-                                couponData.Add(2, 150); //大机数量
-                            }
-                            foreach(int kindNum in couponData.Keys)
-                            {
-                                int BuyCountByKind = couponData[kindNum];
-                                var coupons = db.PosCoupons.Where(m => m.IsLock == 0 && m.IsUse == 0 && m.UserId == 0 && m.QueryCount == kindNum).OrderBy(m => m.Id).Take(BuyCountByKind).ToList();
-                                foreach (var coupon in coupons)
-                                {
-                                    PosCoupons item = db.PosCoupons.FirstOrDefault(m => m.Id == coupon.Id);
-                                    if (item != null)
-                                    {
-                                        item.CreateDate = DateTime.Now;
-                                        item.UserId = order.UserId;
-                                        item.UpdateDate = DateTime.Now.AddDays(180);
-                                        if (pro.ProductId == 13)
-                                        {
-                                            item.LeaderUserId = order.UserId;
-                                        }
-                                        Codes += item.ExchangeCode + ",";
-                                    }
-                                }
-                            }
-                        }
-                        else
+                        if(Kind <= 2)
                         {
+                            string Codes = "";
                             var coupons = db.PosCoupons.Where(m => m.IsLock == 0 && m.IsUse == 0 && m.UserId == 0 && m.QueryCount == Kind).OrderBy(m => m.Id).Take(BuyCount).ToList();
                             foreach (var coupon in coupons)
                             {
@@ -193,120 +134,76 @@ namespace MySystem
                                     item.CreateDate = DateTime.Now;
                                     item.UserId = order.UserId;
                                     item.UpdateDate = DateTime.Now.AddDays(180);
-                                    if (pro.ProductId == 13)
-                                    {
-                                        item.LeaderUserId = order.UserId;
-                                    }
                                     Codes += item.ExchangeCode + ",";
+                                    couponIds.Add(coupon.Id);
                                 }
                             }
+                            order.SnNos = Codes.TrimEnd(',');
                         }
-                        order.SnNos = Codes.TrimEnd(',');
-                        string ChangeRecordNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                        PosCouponForUser forUser = db.PosCouponForUser.FirstOrDefault(m => m.Id == order.UserId);
-                        if (forUser == null)
+                        db.SaveChanges();
+                        if (pro.ProductId == 12 || pro.ProductId == 13)
                         {
-                            forUser = db.PosCouponForUser.Add(new PosCouponForUser()
-                            {
-                                Id = order.UserId,
-                            }).Entity;
-                            db.SaveChanges();
+                            //充值盟主储备金
+                            OpReserve(db, order, order.UserId, order.TotalPrice, 1);
                         }
-                        int BeforeOut = forUser.OutNum;
-                        int BeforeTotal = forUser.TotalNum;
-                        int BeforeStock = forUser.StockNum;
-                        forUser.TotalNum += BuyCount;
-                        forUser.StockNum += BuyCount;
-                        int AfterOut = forUser.OutNum;
-                        int AfterTotal = forUser.TotalNum;
-                        int AfterStock = forUser.StockNum;
-                        PosCouponOrders stat = db.PosCouponOrders.Add(new PosCouponOrders()
-                        {
-                            QueryCount = Kind,
-                            CreateDate = DateTime.Now,
-                            ChangeKind = 1,
-                            ChangeCount = BuyCount,
-                            AfterOut = AfterOut,
-                            AfterTotal = AfterTotal,
-                            AfterStock = AfterStock,
-                            BeforeOut = BeforeOut,
-                            BeforeTotal = BeforeTotal,
-                            BeforeStock = BeforeStock,
-                            OrderNo = ChangeRecordNo,
-                            ToUserId = order.UserId,
-                            FromUserId = 0,
-                        }).Entity;
-                        db.SaveChanges();
-                        RedisDbconn.Instance.Clear("Orders:" + order.Id);
                     }
 
                     //推荐下单奖励
                     if (pro.ProductId == 10 || pro.ProductId == 11)
                     {
                         bool checkPrize = db.UserAccountRecord.Any(m => m.QueryCount == OrderId);
-                        int SelfBuy = 0;
-                        OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
-                        DataTable stat = OtherMySqlConn.dtable("select count(Id) from Orders where Id in (select OrderId from OrderProduct where UserId=" + order.UserId + " and (ProductId=10 or ProductId=11)) and Status>0 and TotalPrice>0");
-                        if (stat.Rows.Count > 0)
-                        {
-                            SelfBuy = int.Parse(function.CheckInt(stat.Rows[0][0].ToString()));
-                        }
-                        // OtherMySqlConn.connstr = ;
                         function.WriteLog("OrderId:" + OrderId, "推荐下单奖励监控日志");
                         function.WriteLog("checkPrize:" + checkPrize, "推荐下单奖励监控日志");
-                        function.WriteLog("SelfBuy:" + SelfBuy, "推荐下单奖励监控日志");
-                        if (SelfBuy == 1 && !checkPrize)
+                        if (!checkPrize)
                         {
                             Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId);
                             if (user != null)
                             {
+                                if(user.LeaderLevel > 0)
+                                {
+                                    UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == order.UserId) ?? new UserAccount();
+                                    if(acccount.LeaderReserve >= order.TotalPrice)
+                                    {
+                                        if(order.PayMode == 4)
+                                        {
+                                            //扣减备用金
+                                            OpReserve(db, order, order.UserId, order.TotalPrice, 0, 0, "商城购机");
+                                            //返回到余额
+                                            OpAccount(db, order, order.UserId, order.TotalPrice);
+                                        }
+                                    }
+                                    //获得100元奖励
+                                    OpAccount(db, order, order.UserId, 100);
+                                    //推荐奖励
+                                    DirectPrize(db, order.Id, order.UserId);
+                                    //推荐下单上级获得30天的机具循环天数
+                                    var posList = db.PosMachinesTwo.Select(m => new { m.Id, m.UserId, m.BindingState, m.RecycEndDate }).Where(m => m.UserId == order.UserId && 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();
+                                    return;
+                                }
+                                bool directPrize = false;
                                 int ParentUserId = user.ParentUserId;
                                 while(ParentUserId > 0)
                                 {
+                                    Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
                                     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台激活机(不限购买或赠送)
                                     int couponCount = db.PosCoupons.Count(m => m.UserId == ParentUserId && m.IsUse == 0); //判断是否拥有3张券
                                     function.WriteLog("MakerCode:" + user.MakerCode, "推荐下单奖励监控日志");
                                     function.WriteLog("machineCount:" + machineCount, "推荐下单奖励监控日志");
                                     function.WriteLog("ActiveCount:" + ActiveCount, "推荐下单奖励监控日志");
-                                    if (machineCount + ActiveCount + couponCount >= 3)
+                                    if (machineCount + ActiveCount + couponCount >= 3 && !directPrize)
                                     {
                                         function.WriteLog("满足条件", "推荐下单奖励监控日志");
-                                        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, //变更后余额
-                                            QueryCount = OrderId,
-                                        }).Entity;
-                                        db.SaveChanges();
-                                        RedisDbconn.Instance.Set("UserAccount:" + ParentUserId, account);
+                                        DirectPrize(db, order.Id, ParentUserId);
 
                                         //推荐下单上级获得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();
@@ -319,22 +216,181 @@ namespace MySystem
                                             }
                                         }
                                         db.SaveChanges();
-                                        ParentUserId = 0;
+                                        directPrize = true;
                                     }
-                                    else
+                                    if(puser.LeaderLevel > 0)
                                     {
-                                        Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
-                                        ParentUserId = puser.ParentUserId;
+                                        UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id) ?? new UserAccount();
+                                        if(acccount.LeaderReserve >= order.TotalPrice)
+                                        {
+                                            //扣减备用金
+                                            OpReserve(db, order, puser.Id, order.TotalPrice, 0, order.UserId, "购机奖励");
+                                            //返回到余额
+                                            OpAccount(db, order, puser.Id, order.TotalPrice);
+                                            //购机奖励
+                                            OpAccount(db, order, puser.Id, 100);
+                                        }
+                                        //如果是大盟主,则标记大盟主标签
+                                        if(couponIds.Count > 0 && puser.LeaderLevel == 2)
+                                        {
+                                            foreach(int couponId in couponIds)
+                                            {
+                                                PosCoupons coupon = db.PosCoupons.FirstOrDefault(m => m.Id == couponId);
+                                                if(coupon != null)
+                                                {
+                                                    coupon.LeaderUserId = puser.Id;
+                                                }
+                                            }
+                                            db.SaveChanges();
+                                        }
                                     }
+                                    ParentUserId = puser.ParentUserId;
                                 }
                             }
                         }
                         function.WriteLog("\r\n\r\n", "推荐下单奖励监控日志");
                     }
                 }
+                else
+                {
+                    if(order.ProductId > 0 && order.ErpMode > 0)
+                    {
+                        //盟主储备金-升级/购买
+                        if(order.ErpMode == 2)
+                        {
+                            Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId);
+                            if(user != null)
+                            {
+                                user.LeaderLevel = 2;
+                                db.SaveChanges();
+                                OpReserve(db, order, order.UserId, order.TotalPrice, 1);
+                            }
+                        }
+                    }
+                }
             }
         }
 
+        //操作储备金
+        public void OpReserve(WebCMSEntities db, Orders order, int UserId, decimal Money, int ChangeType, int SourceUserId = 0, string Remark = "储备金购买")
+        {
+            UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+            if (account == null)
+            {
+                account = db.UserAccount.Add(new UserAccount()
+                {
+                    Id = UserId,
+                    UserId = UserId,
+                }).Entity;
+                db.SaveChanges();
+            }
+            decimal BeforeAmount = account.LeaderReserve; //变更前总金额
+            account.LeaderReserve += Money;
+            decimal AfterAmount = account.LeaderReserve; //变更后总金额
+            LeaderReserveRecord add = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
+            {
+                CreateDate = DateTime.Now,
+                ChangeType = ChangeType,
+                OrderId = order.Id,
+                Remark = Remark,
+                AfterAmt = AfterAmount,
+                BeforeAmt = BeforeAmount,
+                ChangeAmt = Money,
+                TradeDate = DateTime.Now.ToString("yyyyMMdd"),
+                TradeMonth = DateTime.Now.ToString("yyyyMM"),
+                UserId = UserId,
+                SourceUserId = SourceUserId,
+            }).Entity;
+            db.SaveChanges();
+        }
+        //操作余额
+        public void OpAccount(WebCMSEntities db, Orders order, int UserId, decimal Money)
+        {
+            UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+            if (account == null)
+            {
+                account = db.UserAccount.Add(new UserAccount()
+                {
+                    Id = UserId,
+                    UserId = UserId,
+                }).Entity;
+                db.SaveChanges();
+            }
+            int ChangeType = 0;
+            if(Money == 600)
+            {
+                ChangeType = 117;
+            }
+            else if(Money == 100)
+            {
+                ChangeType = 118;
+            }
+            decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+            decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+            decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+            account.BalanceAmount += Money;
+            account.TotalAmount += Money;
+            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 = UserId, //创客
+                ChangeType = ChangeType, //变动类型
+                ChangeAmount = Money, //变更金额
+                BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                QueryCount = order.Id,
+            }).Entity;
+            db.SaveChanges();
+        }
+        public void DirectPrize(WebCMSEntities db, int OrderId, int UserId)
+        {
+            UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+            if (account == null)
+            {
+                account = db.UserAccount.Add(new UserAccount()
+                {
+                    Id = UserId,
+                    UserId = UserId,
+                }).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 = UserId, //创客
+                ChangeType = 112, //变动类型
+                ChangeAmount = 100, //变更金额
+                BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                QueryCount = OrderId,
+            }).Entity;
+            db.SaveChanges();
+        }
+
+        #endregion
+
+        #region 老订单流程
         public void DoOrder(WebCMSEntities db, int OrderId)
         {
             Orders order = db.Orders.FirstOrDefault(m => m.Id == OrderId && m.Status == 0);
@@ -590,14 +646,12 @@ namespace MySystem
                 }
             }
         }
-
         public void checkOrder(int OrderId)
         {
             WebCMSEntities db = new WebCMSEntities();
             DoOrder(db, OrderId);
             db.Dispose();
         }
-
         public void addcoupon(int OrderId)
         {
             WebCMSEntities db = new WebCMSEntities();
@@ -763,5 +817,7 @@ namespace MySystem
             }
             db.Dispose();
         }
+    
+        #endregion
     }
 }

+ 28 - 0
Models/LeaderReserveRecord.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models
+{
+    public partial class LeaderReserveRecord
+    {
+        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 int ChangeType { get; set; }
+        public int OrderId { get; set; }
+        public int SourceUserId { get; set; }
+        public string Remark { get; set; }
+        public decimal AfterAmt { get; set; }
+        public decimal BeforeAmt { get; set; }
+        public decimal ChangeAmt { get; set; }
+        public string TradeDate { get; set; }
+        public string TradeMonth { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 1 - 0
Models/Orders.cs

@@ -63,5 +63,6 @@ namespace MySystem.Models
         public string RealName { get; set; }
         public string OrderNo { get; set; }
         public int UserId { get; set; }
+        public int ParentOrderId { get; set; }
     }
 }

+ 1 - 0
Models/PosMachinesTwo.cs

@@ -45,5 +45,6 @@ namespace MySystem.Models
         public int BindingState { get; set; }
         public int LeaderUserId { get; set; }
         public int PreUserId { get; set; }
+        public int IsFirst { get; set; }
     }
 }

+ 2 - 0
Models/StoreHouse.cs

@@ -37,5 +37,7 @@ namespace MySystem.Models
         public int UserId { get; set; }
         public string StoreName { get; set; }
         public string StoreNo { get; set; }
+        public DateTime? AuthDate { get; set; }
+        public ulong AuthFlag { get; set; }
     }
 }

+ 25 - 0
Models/StoreHouseAmountRecord.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models
+{
+    public partial class StoreHouseAmountRecord
+    {
+        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 int OperateType { get; set; }
+        public int AmountType { get; set; }
+        public decimal AfterAmount { get; set; }
+        public decimal BeforeAmount { get; set; }
+        public decimal UseAmount { get; set; }
+        public int ApplyId { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 8 - 15
Models/StoreMachineApply.cs

@@ -9,26 +9,19 @@ namespace MySystem.Models
         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 DateTime? ApplyTime { get; set; }
-        public int? BrandId { get; set; }
+        public int UserId { get; set; }
+        public string SendSn { get; set; }
+        public string ErpCode { get; set; }
+        public string SendMode { get; set; }
+        public decimal UseAmount { get; set; }
+        public int SendNum { get; set; }
+        public int ApplyNum { get; set; }
         public string ApplyNo { get; set; }
-        public int? ApplyNum { get; set; }
-        public int? SendNum { get; set; }
-        public int? BoxNum { get; set; }
-        public int? LastApply { get; set; }
-        public int? MaxApply { get; set; }
-        public int? ActualApply { get; set; }
-        public int? UserId { get; set; }
-        public int? StoreId { get; set; }
-        public int? OrderId { get; set; }
-        public string SwapSnExpand { get; set; }
+        public int BrandId { get; set; }
     }
 }

+ 3 - 0
Models/UserAccount.cs

@@ -32,5 +32,8 @@ namespace MySystem.Models
         public int UserProperty { get; set; }
         public int UserType { get; set; }
         public int UserId { get; set; }
+        public decimal TempAmount { get; set; }
+        public decimal FixedAmount { get; set; }
+        public decimal LeaderReserve { get; set; }
     }
 }

+ 1 - 0
Models/Users.cs

@@ -82,5 +82,6 @@ namespace MySystem.Models
         public int CashStatus { get; set; }
         public string CashNote { get; set; }
         public decimal ThisMonthTrade { get; set; }
+        public int LeaderLevel { get; set; }
     }
 }

+ 145 - 54
Models/WebCMSEntities.cs

@@ -48,6 +48,7 @@ namespace MySystem.Models
         public virtual DbSet<KqProductOrgs> KqProductOrgs { get; set; }
         public virtual DbSet<KqProductRuleSet> KqProductRuleSet { get; set; }
         public virtual DbSet<KqProducts> KqProducts { get; set; }
+        public virtual DbSet<LeaderReserveRecord> LeaderReserveRecord { get; set; }
         public virtual DbSet<MachineApply> MachineApply { get; set; }
         public virtual DbSet<MachineApplyDetail> MachineApplyDetail { get; set; }
         public virtual DbSet<MachineChange> MachineChange { get; set; }
@@ -147,6 +148,7 @@ namespace MySystem.Models
         public virtual DbSet<StoreForCode> StoreForCode { get; set; }
         public virtual DbSet<StoreForName> StoreForName { get; set; }
         public virtual DbSet<StoreHouse> StoreHouse { get; set; }
+        public virtual DbSet<StoreHouseAmountRecord> StoreHouseAmountRecord { get; set; }
         public virtual DbSet<StoreMachineApply> StoreMachineApply { get; set; }
         public virtual DbSet<StoreMallOrderSummary> StoreMallOrderSummary { get; set; }
         public virtual DbSet<StoreSnActivateSummary> StoreSnActivateSummary { get; set; }
@@ -2514,6 +2516,65 @@ namespace MySystem.Models
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<LeaderReserveRecord>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AfterAmt).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.BeforeAmt).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.ChangeAmt).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.ChangeType).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OrderId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.SourceUserId).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.TradeDate)
+                    .HasColumnType("varchar(8)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.TradeMonth)
+                    .HasColumnType("varchar(6)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
+            });
+
             modelBuilder.Entity<MachineApply>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -6109,6 +6170,8 @@ namespace MySystem.Models
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.ParentOrderId).HasColumnType("int(11)");
+
                 entity.Property(e => e.PayDate).HasColumnType("datetime");
 
                 entity.Property(e => e.PayMode).HasColumnType("int(11)");
@@ -6790,6 +6853,8 @@ namespace MySystem.Models
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.IsFirst).HasColumnType("int(11)");
+
                 entity.Property(e => e.IsPurchase).HasColumnType("int(11)");
 
                 entity.Property(e => e.IsVip)
@@ -9859,6 +9924,12 @@ namespace MySystem.Models
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.AuthDate).HasColumnType("datetime");
+
+                entity.Property(e => e.AuthFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'");
+
                 entity.Property(e => e.BrandId)
                     .HasColumnType("varchar(30)")
                     .HasCharSet("utf8")
@@ -9960,60 +10031,83 @@ namespace MySystem.Models
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
-            modelBuilder.Entity<StoreMachineApply>(entity =>
+            modelBuilder.Entity<StoreHouseAmountRecord>(entity =>
             {
-                entity.HasComment("机具申请记录表");
-
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
-                entity.Property(e => e.ActualApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("实际申请台数");
+                entity.Property(e => e.AfterAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.ApplyNo)
-                    .HasColumnType("varchar(50)")
-                    .HasComment("申请单号")
-                    .HasCharSet("latin1")
-                    .HasCollation("latin1_swedish_ci");
+                entity.Property(e => e.AmountType).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApplyId).HasColumnType("int(11)");
 
-                entity.Property(e => e.ApplyNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("申请箱数");
+                entity.Property(e => e.BeforeAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.ApplyTime).HasColumnType("datetime");
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
-                entity.Property(e => e.BoxNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("每箱台数");
+                entity.Property(e => e.OperateType).HasColumnType("int(11)");
 
-                entity.Property(e => e.BrandId)
-                    .HasColumnType("int(11)")
-                    .HasComment("产品Id");
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
-                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
-                entity.Property(e => e.CreateMan)
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.UseAmount).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
+            });
+
+            modelBuilder.Entity<StoreMachineApply>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApplyNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
-                entity.Property(e => e.LastApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("上月申请台数");
+                entity.Property(e => e.ApplyNum).HasColumnType("int(11)");
 
-                entity.Property(e => e.MaxApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("最多申请台数");
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
 
-                entity.Property(e => e.OrderId)
-                    .HasColumnType("int(11)")
-                    .HasComment("订单Id");
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.ErpCode)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
-                entity.Property(e => e.SendNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("发货箱数");
+                entity.Property(e => e.SendMode)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SendNum).HasColumnType("int(11)");
+
+                entity.Property(e => e.SendSn)
+                    .HasColumnType("mediumtext")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.SeoDescription)
                     .HasColumnType("varchar(500)")
@@ -10034,28 +10128,11 @@ namespace MySystem.Models
 
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
-                entity.Property(e => e.StoreId)
-                    .HasColumnType("int(11)")
-                    .HasComment("仓库Id");
-
-                entity.Property(e => e.SwapSnExpand)
-                    .HasColumnType("mediumtext")
-                    .HasComment("已发货机具SN号")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
-
                 entity.Property(e => e.UpdateDate).HasColumnType("datetime");
 
-                entity.Property(e => e.UpdateMan)
-                    .HasColumnType("varchar(50)")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
-
-                entity.Property(e => e.UserId)
-                    .HasColumnType("int(11)")
-                    .HasComment("创客Id");
+                entity.Property(e => e.UseAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.Version).HasColumnType("int(11)");
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
             });
 
             modelBuilder.Entity<StoreMallOrderSummary>(entity =>
@@ -11309,6 +11386,9 @@ namespace MySystem.Models
 
             modelBuilder.Entity<TradeDaySummary>(entity =>
             {
+                entity.HasIndex(e => new { e.UserId, e.TradeMonth, e.TradeDate, e.BrandId, e.QueryCount, e.VipFlag, e.PayType, e.SeoTitle })
+                    .HasName("TradeDaySummaryIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.BrandId).HasColumnType("int(11)");
@@ -11744,8 +11824,12 @@ namespace MySystem.Models
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.FixedAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.FreezeAmount).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.LeaderReserve).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.LockStatus).HasColumnType("int(11)");
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
@@ -11775,6 +11859,8 @@ namespace MySystem.Models
 
                 entity.Property(e => e.TeamTotalServiceProfit).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.TempAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.TotalAmount).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.TotalOverProfit).HasColumnType("decimal(18,2)");
@@ -14235,6 +14321,9 @@ namespace MySystem.Models
 
             modelBuilder.Entity<UserTradeMonthSummary>(entity =>
             {
+                entity.HasIndex(e => new { e.UserId, e.BrandId, e.TradeMonth, e.SeoKeyword, e.SeoTitle })
+                    .HasName("UserTradeMonthSummaryIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.ActiveBuddyMerStatus).HasColumnType("int(11)");
@@ -14444,6 +14533,8 @@ namespace MySystem.Models
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
 
+                entity.Property(e => e.LeaderLevel).HasColumnType("int(11)");
+
                 entity.Property(e => e.LockStatus)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");

+ 28 - 0
PxcModels/LeaderReserveRecord.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class LeaderReserveRecord
+    {
+        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 int ChangeType { get; set; }
+        public int OrderId { get; set; }
+        public int SourceUserId { get; set; }
+        public string Remark { get; set; }
+        public decimal AfterAmt { get; set; }
+        public decimal BeforeAmt { get; set; }
+        public decimal ChangeAmt { get; set; }
+        public string TradeDate { get; set; }
+        public string TradeMonth { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 1 - 0
PxcModels/Orders.cs

@@ -63,5 +63,6 @@ namespace MySystem.PxcModels
         public string RealName { get; set; }
         public string OrderNo { get; set; }
         public int UserId { get; set; }
+        public int ParentOrderId { get; set; }
     }
 }

+ 1 - 0
PxcModels/PosMachinesTwo.cs

@@ -45,5 +45,6 @@ namespace MySystem.PxcModels
         public int BindingState { get; set; }
         public int LeaderUserId { get; set; }
         public int PreUserId { get; set; }
+        public int IsFirst { get; set; }
     }
 }

+ 2 - 0
PxcModels/StoreHouse.cs

@@ -37,5 +37,7 @@ namespace MySystem.PxcModels
         public int UserId { get; set; }
         public string StoreName { get; set; }
         public string StoreNo { get; set; }
+        public DateTime? AuthDate { get; set; }
+        public ulong AuthFlag { get; set; }
     }
 }

+ 25 - 0
PxcModels/StoreHouseAmountRecord.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class StoreHouseAmountRecord
+    {
+        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 int OperateType { get; set; }
+        public int AmountType { get; set; }
+        public decimal AfterAmount { get; set; }
+        public decimal BeforeAmount { get; set; }
+        public decimal UseAmount { get; set; }
+        public int ApplyId { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 8 - 15
PxcModels/StoreMachineApply.cs

@@ -9,26 +9,19 @@ namespace MySystem.PxcModels
         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 DateTime? ApplyTime { get; set; }
-        public int? BrandId { get; set; }
+        public int UserId { get; set; }
+        public string SendSn { get; set; }
+        public string ErpCode { get; set; }
+        public string SendMode { get; set; }
+        public decimal UseAmount { get; set; }
+        public int SendNum { get; set; }
+        public int ApplyNum { get; set; }
         public string ApplyNo { get; set; }
-        public int? ApplyNum { get; set; }
-        public int? SendNum { get; set; }
-        public int? BoxNum { get; set; }
-        public int? LastApply { get; set; }
-        public int? MaxApply { get; set; }
-        public int? ActualApply { get; set; }
-        public int? UserId { get; set; }
-        public int? StoreId { get; set; }
-        public int? OrderId { get; set; }
-        public string SwapSnExpand { get; set; }
+        public int BrandId { get; set; }
     }
 }

+ 3 - 0
PxcModels/UserAccount.cs

@@ -32,5 +32,8 @@ namespace MySystem.PxcModels
         public int UserProperty { get; set; }
         public int UserType { get; set; }
         public int UserId { get; set; }
+        public decimal TempAmount { get; set; }
+        public decimal FixedAmount { get; set; }
+        public decimal LeaderReserve { get; set; }
     }
 }

+ 1 - 0
PxcModels/Users.cs

@@ -82,5 +82,6 @@ namespace MySystem.PxcModels
         public int CashStatus { get; set; }
         public string CashNote { get; set; }
         public decimal ThisMonthTrade { get; set; }
+        public int LeaderLevel { get; set; }
     }
 }

+ 145 - 54
PxcModels/WebCMSEntities.cs

@@ -48,6 +48,7 @@ namespace MySystem.PxcModels
         public virtual DbSet<KqProductOrgs> KqProductOrgs { get; set; }
         public virtual DbSet<KqProductRuleSet> KqProductRuleSet { get; set; }
         public virtual DbSet<KqProducts> KqProducts { get; set; }
+        public virtual DbSet<LeaderReserveRecord> LeaderReserveRecord { get; set; }
         public virtual DbSet<MachineApply> MachineApply { get; set; }
         public virtual DbSet<MachineApplyDetail> MachineApplyDetail { get; set; }
         public virtual DbSet<MachineChange> MachineChange { get; set; }
@@ -147,6 +148,7 @@ namespace MySystem.PxcModels
         public virtual DbSet<StoreForCode> StoreForCode { get; set; }
         public virtual DbSet<StoreForName> StoreForName { get; set; }
         public virtual DbSet<StoreHouse> StoreHouse { get; set; }
+        public virtual DbSet<StoreHouseAmountRecord> StoreHouseAmountRecord { get; set; }
         public virtual DbSet<StoreMachineApply> StoreMachineApply { get; set; }
         public virtual DbSet<StoreMallOrderSummary> StoreMallOrderSummary { get; set; }
         public virtual DbSet<StoreSnActivateSummary> StoreSnActivateSummary { get; set; }
@@ -2514,6 +2516,65 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<LeaderReserveRecord>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AfterAmt).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.BeforeAmt).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.ChangeAmt).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.ChangeType).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OrderId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.SourceUserId).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.TradeDate)
+                    .HasColumnType("varchar(8)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.TradeMonth)
+                    .HasColumnType("varchar(6)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
+            });
+
             modelBuilder.Entity<MachineApply>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -6109,6 +6170,8 @@ namespace MySystem.PxcModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.ParentOrderId).HasColumnType("int(11)");
+
                 entity.Property(e => e.PayDate).HasColumnType("datetime");
 
                 entity.Property(e => e.PayMode).HasColumnType("int(11)");
@@ -6790,6 +6853,8 @@ namespace MySystem.PxcModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.IsFirst).HasColumnType("int(11)");
+
                 entity.Property(e => e.IsPurchase).HasColumnType("int(11)");
 
                 entity.Property(e => e.IsVip)
@@ -9859,6 +9924,12 @@ namespace MySystem.PxcModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.AuthDate).HasColumnType("datetime");
+
+                entity.Property(e => e.AuthFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'");
+
                 entity.Property(e => e.BrandId)
                     .HasColumnType("varchar(30)")
                     .HasCharSet("utf8")
@@ -9960,60 +10031,83 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
-            modelBuilder.Entity<StoreMachineApply>(entity =>
+            modelBuilder.Entity<StoreHouseAmountRecord>(entity =>
             {
-                entity.HasComment("机具申请记录表");
-
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
-                entity.Property(e => e.ActualApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("实际申请台数");
+                entity.Property(e => e.AfterAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.ApplyNo)
-                    .HasColumnType("varchar(50)")
-                    .HasComment("申请单号")
-                    .HasCharSet("latin1")
-                    .HasCollation("latin1_swedish_ci");
+                entity.Property(e => e.AmountType).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApplyId).HasColumnType("int(11)");
 
-                entity.Property(e => e.ApplyNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("申请箱数");
+                entity.Property(e => e.BeforeAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.ApplyTime).HasColumnType("datetime");
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
-                entity.Property(e => e.BoxNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("每箱台数");
+                entity.Property(e => e.OperateType).HasColumnType("int(11)");
 
-                entity.Property(e => e.BrandId)
-                    .HasColumnType("int(11)")
-                    .HasComment("产品Id");
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
-                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
-                entity.Property(e => e.CreateMan)
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.UseAmount).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
+            });
+
+            modelBuilder.Entity<StoreMachineApply>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApplyNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
-                entity.Property(e => e.LastApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("上月申请台数");
+                entity.Property(e => e.ApplyNum).HasColumnType("int(11)");
 
-                entity.Property(e => e.MaxApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("最多申请台数");
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
 
-                entity.Property(e => e.OrderId)
-                    .HasColumnType("int(11)")
-                    .HasComment("订单Id");
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.ErpCode)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
-                entity.Property(e => e.SendNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("发货箱数");
+                entity.Property(e => e.SendMode)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SendNum).HasColumnType("int(11)");
+
+                entity.Property(e => e.SendSn)
+                    .HasColumnType("mediumtext")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.SeoDescription)
                     .HasColumnType("varchar(500)")
@@ -10034,28 +10128,11 @@ namespace MySystem.PxcModels
 
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
-                entity.Property(e => e.StoreId)
-                    .HasColumnType("int(11)")
-                    .HasComment("仓库Id");
-
-                entity.Property(e => e.SwapSnExpand)
-                    .HasColumnType("mediumtext")
-                    .HasComment("已发货机具SN号")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
-
                 entity.Property(e => e.UpdateDate).HasColumnType("datetime");
 
-                entity.Property(e => e.UpdateMan)
-                    .HasColumnType("varchar(50)")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
-
-                entity.Property(e => e.UserId)
-                    .HasColumnType("int(11)")
-                    .HasComment("创客Id");
+                entity.Property(e => e.UseAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.Version).HasColumnType("int(11)");
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
             });
 
             modelBuilder.Entity<StoreMallOrderSummary>(entity =>
@@ -11309,6 +11386,9 @@ namespace MySystem.PxcModels
 
             modelBuilder.Entity<TradeDaySummary>(entity =>
             {
+                entity.HasIndex(e => new { e.UserId, e.TradeMonth, e.TradeDate, e.BrandId, e.QueryCount, e.VipFlag, e.PayType, e.SeoTitle })
+                    .HasName("TradeDaySummaryIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.BrandId).HasColumnType("int(11)");
@@ -11744,8 +11824,12 @@ namespace MySystem.PxcModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.FixedAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.FreezeAmount).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.LeaderReserve).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.LockStatus).HasColumnType("int(11)");
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
@@ -11775,6 +11859,8 @@ namespace MySystem.PxcModels
 
                 entity.Property(e => e.TeamTotalServiceProfit).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.TempAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.TotalAmount).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.TotalOverProfit).HasColumnType("decimal(18,2)");
@@ -14235,6 +14321,9 @@ namespace MySystem.PxcModels
 
             modelBuilder.Entity<UserTradeMonthSummary>(entity =>
             {
+                entity.HasIndex(e => new { e.UserId, e.BrandId, e.TradeMonth, e.SeoKeyword, e.SeoTitle })
+                    .HasName("UserTradeMonthSummaryIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.ActiveBuddyMerStatus).HasColumnType("int(11)");
@@ -14444,6 +14533,8 @@ namespace MySystem.PxcModels
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
 
+                entity.Property(e => e.LeaderLevel).HasColumnType("int(11)");
+
                 entity.Property(e => e.LockStatus)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");