瀏覽代碼

修改推荐奖判断购买订单数规则
增加立刷品牌逻辑
押金机具收到押金数据,直接循环
取消绑定原始数据的限制,通过商户号和机具号覆盖相应的数据
增加立刷60天内刷满10000,再返40逻辑

lichunlei 3 年之前
父節點
當前提交
d4100c3d43

+ 9 - 1
AppStart/Helper/AlipayPayBack2Service.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Data;
 using MySystem.PxcModels;
 using Library;
 using LitJson;
@@ -176,7 +177,14 @@ namespace MySystem
                             if (pro.ProductId == 10 || pro.ProductId == 11)
                             {
                                 bool checkPrize = db.UserAccountRecord.Any(m => m.QueryCount == OrderId);
-                                int SelfBuy = db.OrderProduct.Count(m => m.UserId == order.UserId && (m.ProductId == 10 || m.ProductId == 11));
+                                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, "推荐下单奖励监控日志");

+ 193 - 124
AppStart/Helper/StatService.cs

@@ -63,6 +63,7 @@ namespace MySystem
                 jobInfo.Status = Msg == "success" ? 1 : 0;
                 jobInfo.Msg = Msg == "success" ? "执行完成" : Msg;
                 RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack");
+                function.WritePage("/static/", "act.txt", DateTime.Now.ToString());
             }
             catch (Exception ex)
             {
@@ -262,7 +263,7 @@ namespace MySystem
         public void dosomething3(int posid = 0)
         {
             WebCMSEntities db = new WebCMSEntities();
-            DateTime yesterday = DateTime.Now.AddHours(-3);
+            DateTime yesterday = DateTime.Now.AddDays(-1);
             DateTime today = DateTime.Now;
             IQueryable<PosMachinesTwo> posList = db.PosMachinesTwo.Where(m => m.ActivationState == 1 && !string.IsNullOrEmpty(m.SeoKeyword));
             if (posid > 0)
@@ -296,131 +297,29 @@ namespace MySystem
                             TopUserId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
                         }
                         decimal ActPrize = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-                        if (pos.BrandId == 1 || pos.BrandId == 3 || pos.BrandId == 4 || pos.BrandId == 5)
+                        if (pos.BrandId == 1 || pos.BrandId == 3 || pos.BrandId == 4 || pos.BrandId == 5 || pos.BrandId == 6)
                         {
                             ActPrize = ActPrize / 100;
                         }
                         if (ActPrize > 0)
                         {
-                            bool check = db.ActiveReward.Any(m => m.KqMerNo == merchant.KqMerNo);
-                            if (!check)
+                            if (ActPrize == 99)
                             {
-                                if (ActPrize == 99)
-                                {
-                                    ActPrize = 100;
-                                }
-                                else if (ActPrize == 199)
-                                {
-                                    ActPrize = 200;
-                                }
-                                else if (ActPrize == 299)
-                                {
-                                    ActPrize = 300;
-                                }
-                                Users machineUser = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
-                                db.ActiveReward.Add(new ActiveReward()
-                                {
-                                    CreateDate = DateTime.Now,
-                                    UpdateDate = DateTime.Now,
-                                    UserId = GetUserId, //创客
-                                    MerchantId = pos.BindMerchantId, //商户
-                                    StandardDate = pos.ActivationTime, //达标日期
-                                    RewardAmount = ActPrize, //奖励金额
-                                    BrandId = pos.BrandId, //品牌
-                                    UserNav = ParentNav, //创客父级
-                                    DirectBuddyNo = merchant.UserId, //商户直属创客
-                                    KqMerNo = merchant.KqMerNo, //渠道商户编号
-                                    KqSnNo = pos.PosSn, //渠道SN号
-                                    SnType = pos.PosSnType, //机具类型
-                                    SnApplyUserId = pos.BuyUserId, //机具申请创客
-                                    ActType = 0, //激活类型
-                                    SnStoreId = pos.StoreId, //SN仓库
-                                    RewardTips = "激活奖励", //奖励描述
-                                    Remark = "激活奖励", //备注
-                                    ActDate = pos.ActivationTime, //激活时间
-                                    TopUserId = TopUserId, //顶级创客
-                                    SeoTitle = machineUser.RealName,
-                                });
-                                db.SaveChanges();
-                                string IdBrand = GetUserId + "_" + pos.BrandId;
-                                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();
-                                RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, userData);
-                                UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == GetUserId);
-                                if (account == null)
-                                {
-                                    account = db.UserAccount.Add(new UserAccount()
-                                    {
-                                        Id = GetUserId,
-                                        UserId = GetUserId,
-                                    }).Entity;
-                                    db.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; //变更后余额
-                                UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
-                                {
-                                    CreateDate = DateTime.Now,
-                                    UpdateDate = DateTime.Now,
-                                    UserId = GetUserId, //创客
-                                    ChangeType = 0, //变动类型
-                                    ProductType = pos.BrandId, //产品类型
-                                    ChangeAmount = ActPrize, //变更金额
-                                    BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                                    AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                                    BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                                    AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                                    BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                                    AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                                }).Entity;
-                                db.SaveChanges();
-                                RedisDbconn.Instance.Set("UserAccount:" + GetUserId, account);
-
-                                string dateString = pos.ActivationTime.Value.ToString("yyyyMMdd");
-                                string monthString = pos.ActivationTime.Value.ToString("yyyyMM");
-                                // 激活奖励列表
-                                List<string> dates = RedisDbconn.Instance.GetList<string>("ActiveRewardDay:" + GetUserId + ":" + pos.BrandId);
-                                if (!dates.Contains(dateString))
-                                {
-                                    RedisDbconn.Instance.AddList("ActiveRewardDay:" + GetUserId + ":" + pos.BrandId, dateString);
-                                }
-                                RedisDbconn.Instance.AddNumber("ActiveRewardAmt:" + GetUserId + ":" + pos.BrandId + ":" + dateString, ActPrize);
-
-                                List<string> months = RedisDbconn.Instance.GetList<string>("ActiveRewardMonth:" + GetUserId + ":" + pos.BrandId);
-                                if (!months.Contains(monthString))
-                                {
-                                    RedisDbconn.Instance.AddList("ActiveRewardMonth:" + GetUserId + ":" + pos.BrandId, monthString);
-                                }
-                                RedisDbconn.Instance.AddNumber("ActiveRewardAmt:" + GetUserId + ":" + pos.BrandId + ":" + monthString, ActPrize);
-
-                                // 激活奖励详情
-                                List<int> actPrizeList = RedisDbconn.Instance.GetList<int>("ActiveRewardDetail:" + GetUserId + ":" + pos.BrandId + ":" + dateString);
-                                if (!actPrizeList.Contains(pos.BindMerchantId))
-                                {
-                                    RedisDbconn.Instance.AddList("ActiveRewardDetail:" + GetUserId + ":" + pos.BrandId + ":" + dateString, pos.BindMerchantId);
-                                }
-                                RedisDbconn.Instance.AddNumber("ActiveRewardAmt:mer:" + pos.BindMerchantId + ":" + pos.BrandId + ":" + dateString, ActPrize);
-
-                                //收支明细
-                                RedisDbconn.Instance.AddList("UserAccountRecord:" + GetUserId + ":1:" + monthString, userAccountRecord);
-                                RedisDbconn.Instance.AddNumber("UserAccount:" + GetUserId + ":1:" + monthString, ActPrize);
-                                RedisDbconn.Instance.Clear("UserAccount:Income:" + GetUserId + ":" + monthString);
+                                ActPrize = 100;
                             }
+                            else if (ActPrize == 199)
+                            {
+                                ActPrize = 200;
+                            }
+                            else if (ActPrize == 299)
+                            {
+                                ActPrize = 300;
+                            }
+                            else if (ActPrize == 249)
+                            {
+                                ActPrize = 260;
+                            }
+                            doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, ActPrize);
                         }
                     }
                     // }
@@ -429,6 +328,117 @@ namespace MySystem
             db.Dispose();
         }
 
+        public void doActiveReward(WebCMSEntities db, PosMerchantInfo merchant, PosMachinesTwo pos, int GetUserId, string ParentNav, int TopUserId, decimal ActPrize)
+        {
+            bool check = db.ActiveReward.Any(m => m.KqMerNo == merchant.KqMerNo && m.RewardAmount == ActPrize);
+            if (!check)
+            {
+                Users machineUser = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
+                db.ActiveReward.Add(new ActiveReward()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    UserId = GetUserId, //创客
+                    MerchantId = pos.BindMerchantId, //商户
+                    StandardDate = pos.ActivationTime, //达标日期
+                    RewardAmount = ActPrize, //奖励金额
+                    BrandId = pos.BrandId, //品牌
+                    UserNav = ParentNav, //创客父级
+                    DirectBuddyNo = merchant.UserId, //商户直属创客
+                    KqMerNo = merchant.KqMerNo, //渠道商户编号
+                    KqSnNo = pos.PosSn, //渠道SN号
+                    SnType = pos.PosSnType, //机具类型
+                    SnApplyUserId = pos.BuyUserId, //机具申请创客
+                    ActType = 0, //激活类型
+                    SnStoreId = pos.StoreId, //SN仓库
+                    RewardTips = "激活奖励", //奖励描述
+                    Remark = "激活奖励", //备注
+                    ActDate = pos.ActivationTime, //激活时间
+                    TopUserId = TopUserId, //顶级创客
+                    SeoTitle = machineUser.RealName,
+                });
+                db.SaveChanges();
+                string IdBrand = GetUserId + "_" + pos.BrandId;
+                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();
+                RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, userData);
+                UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == GetUserId);
+                if (account == null)
+                {
+                    account = db.UserAccount.Add(new UserAccount()
+                    {
+                        Id = GetUserId,
+                        UserId = GetUserId,
+                    }).Entity;
+                    db.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; //变更后余额
+                UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    UserId = GetUserId, //创客
+                    ChangeType = 0, //变动类型
+                    ProductType = pos.BrandId, //产品类型
+                    ChangeAmount = ActPrize, //变更金额
+                    BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                    AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                    BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                    AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                    BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                    AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                }).Entity;
+                db.SaveChanges();
+                RedisDbconn.Instance.Set("UserAccount:" + GetUserId, account);
+
+                string dateString = pos.ActivationTime.Value.ToString("yyyyMMdd");
+                string monthString = pos.ActivationTime.Value.ToString("yyyyMM");
+                // 激活奖励列表
+                List<string> dates = RedisDbconn.Instance.GetList<string>("ActiveRewardDay:" + GetUserId + ":" + pos.BrandId);
+                if (!dates.Contains(dateString))
+                {
+                    RedisDbconn.Instance.AddList("ActiveRewardDay:" + GetUserId + ":" + pos.BrandId, dateString);
+                }
+                RedisDbconn.Instance.AddNumber("ActiveRewardAmt:" + GetUserId + ":" + pos.BrandId + ":" + dateString, ActPrize);
+
+                List<string> months = RedisDbconn.Instance.GetList<string>("ActiveRewardMonth:" + GetUserId + ":" + pos.BrandId);
+                if (!months.Contains(monthString))
+                {
+                    RedisDbconn.Instance.AddList("ActiveRewardMonth:" + GetUserId + ":" + pos.BrandId, monthString);
+                }
+                RedisDbconn.Instance.AddNumber("ActiveRewardAmt:" + GetUserId + ":" + pos.BrandId + ":" + monthString, ActPrize);
+
+                // 激活奖励详情
+                List<int> actPrizeList = RedisDbconn.Instance.GetList<int>("ActiveRewardDetail:" + GetUserId + ":" + pos.BrandId + ":" + dateString);
+                if (!actPrizeList.Contains(pos.BindMerchantId))
+                {
+                    RedisDbconn.Instance.AddList("ActiveRewardDetail:" + GetUserId + ":" + pos.BrandId + ":" + dateString, pos.BindMerchantId);
+                }
+                RedisDbconn.Instance.AddNumber("ActiveRewardAmt:mer:" + pos.BindMerchantId + ":" + pos.BrandId + ":" + dateString, ActPrize);
+
+                //收支明细
+                RedisDbconn.Instance.AddList("UserAccountRecord:" + GetUserId + ":1:" + monthString, userAccountRecord);
+                RedisDbconn.Instance.AddNumber("UserAccount:" + GetUserId + ":1:" + monthString, ActPrize);
+                RedisDbconn.Instance.Clear("UserAccount:Income:" + GetUserId + ":" + monthString);
+            }
+        }
+
 
         //根据商户信息发放激活奖励
         public void dosomething32(int merid = 0)
@@ -1210,11 +1220,11 @@ namespace MySystem
                 string end = DateTime.Parse(date).AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00";
                 string startId = "0", endId = "9999999999";
                 List<string> uids = new List<string>();
-                // DataTable startDt = OtherMySqlConn.dtable("select min(Id) from TradeRecord where CreateDate>='" + start + "'");
-                // if (startDt.Rows.Count > 0)
-                // {
-                //     startId = startDt.Rows[0][0].ToString();
-                // }
+                DataTable startDt = OtherMySqlConn.dtable("select min(Id) from TradeRecord where CreateDate>='" + start + "'");
+                if (startDt.Rows.Count > 0)
+                {
+                    startId = startDt.Rows[0][0].ToString();
+                }
                 // DataTable endDt = OtherMySqlConn.dtable("select max(Id) from TradeRecord where CreateDate<'" + end + "'");
                 // if (endDt.Rows.Count > 0)
                 // {
@@ -1446,5 +1456,64 @@ namespace MySystem
             // db.Dispose();
             function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "执行商户交易额日志");
         }
+
+
+
+
+        // 5. 创客升级
+        public void StatUserLevel()
+        { 
+            Thread th = new Thread(StatUserLevelDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+        public void StatUserLevelDo()
+        {
+            DateTime start = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01 00:00:00");
+            DateTime end = start.AddDays(1);
+            string TradeMonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
+            WebCMSEntities db = new WebCMSEntities();
+            List<UserLevelSet> sets = db.UserLevelSet.ToList();
+            var users = db.Users.Select(m => new { m.Id, m.AuthFlag }).Where(m => m.AuthFlag == 1).ToList();
+            foreach (var subuser in users)
+            {
+                Users user = db.Users.FirstOrDefault(m => m.Id == subuser.Id);
+                if (user != null)
+                {
+                    int BeforeLevel = user.UserLevel;
+                    int AfterLevel = 0;
+                    decimal TradeAmount = 0;
+                    bool check = db.UserTradeDaySummary.Any(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team");
+                    if (check)
+                    {
+                        TradeAmount = db.UserTradeDaySummary.Where(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team").Sum(m => m.NonDirectTradeAmt);
+                    }
+                    UserLevelSet set = sets.FirstOrDefault(m => m.UpLevelGrowth <= TradeAmount && m.UpLevelIntegral > TradeAmount);
+                    if (set != null)
+                    {
+                        AfterLevel = set.Id;
+                    }
+                    if (AfterLevel > BeforeLevel)
+                    {
+                        user.UserLevel = AfterLevel;
+                        db.UserRank.Add(new UserRank()
+                        {
+                            CreateDate = DateTime.Now,
+                            UpdateDate = DateTime.Now,
+                            UserId = user.Id, //创客
+                            Rank = AfterLevel, //当前等级
+                            StatYear = DateTime.Now.Year, //统计年份
+                            StatMonth = DateTime.Now.Month, //统计月份
+                            TradeAmt = TradeAmount, //团队交易总额
+                            UpgradeFlag = 1, //升级标识
+                            OperateDate = DateTime.Now, //操作时间
+                        });
+                        db.SaveChanges();
+                        RedisDbconn.Instance.AddList("UserLevelData:" + user.Id, BeforeLevel + "#" + AfterLevel);
+                    }
+                }
+            }
+            db.Dispose();
+        }
     }
 }

+ 1 - 0
AppStart/Helper/SycnSpServer/SycnSpActiveService.cs

@@ -57,6 +57,7 @@ namespace MySystem
                                 if (pos.BrandId == 2 || pos.BrandId == 4 || pos.BrandId == 5 || pos.BrandId == 6)
                                 {
                                     pos.SeoKeyword = act.SeoTitle;
+                                    pos.IsPurchase = 0;
                                     db.SaveChanges();
                                     RedisDbconn.Instance.Set("PosMachinesTwo:" + pos.Id, pos);
                                     RedisDbconn.Instance.Set("PosMachinesTwo:" + pos.PosSn, pos);

+ 4 - 0
AppStart/Helper/SycnSpServer/SycnSpBindService.cs

@@ -51,6 +51,10 @@ namespace MySystem
                                         SnId = pos.Id,
                                     }).Entity;
                                 }
+                                else
+                                {
+                                    merFor.SnId = pos.Id;
+                                }
                                 db.SaveChanges();
                                 RedisDbconn.Instance.Set("PosMachinesTwo", pos);
 

+ 23 - 19
AppStart/Helper/SycnSpServer/SycnSpMerchantService.cs

@@ -55,26 +55,30 @@ namespace MySystem
                                 { 
                                     BrandId = 5;
                                 }
-                                PxcModels.PosMerchantInfo add = db.PosMerchantInfo.Add(new PxcModels.PosMerchantInfo()
+                                PxcModels.PosMerchantInfo add = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == Mer.MerNo);
+                                if (add == null)
                                 {
-                                    CreateDate = Mer.CreateTime,
-                                    UpdateDate = Mer.UpdateTime,
-                                    TopUserId = TopUserId,
-                                    BrandId = BrandId,
-                                    SnStoreId = pos.StoreId,
-                                    SnType = pos.PosSnType,
-                                    UserId = pos.UserId,
-                                    MgrName = Mer.AgentName,
-                                    MerStatus = 1,
-                                    KqSnNo = Mer.SnNo,
-                                    KqMerNo = Mer.MerNo,
-                                    MerIdcardNo = Mer.MerIdcardNo,
-                                    MerRealName = Mer.MerRealName,
-                                    MerchantMobile = Mer.MerMobile,
-                                    MerchantName = Mer.MerName,
-                                    MerchantNo = Mer.MerNo,
-                                }).Entity;
-                                db.SaveChanges();
+                                    add = db.PosMerchantInfo.Add(new PxcModels.PosMerchantInfo()
+                                    {
+                                        CreateDate = Mer.CreateTime,
+                                        KqMerNo = Mer.MerNo,
+                                        MerchantNo = Mer.MerNo,
+                                    }).Entity;
+                                    db.SaveChanges();
+                                }
+                                add.UpdateDate = Mer.UpdateTime;
+                                add.TopUserId = TopUserId;
+                                add.BrandId = BrandId;
+                                add.SnStoreId = pos.StoreId;
+                                add.SnType = pos.PosSnType;
+                                add.UserId = pos.UserId;
+                                add.MgrName = Mer.AgentName;
+                                add.MerStatus = 1;
+                                add.KqSnNo = Mer.SnNo;
+                                add.MerIdcardNo = Mer.MerIdcardNo;
+                                add.MerRealName = Mer.MerRealName;
+                                add.MerchantMobile = Mer.MerMobile;
+                                add.MerchantName = Mer.MerName;
                                 pos.BindMerchantId = add.Id;
                                 Merchants edit = spdb.Merchants.FirstOrDefault(m => m.Id == Mer.Id);
                                 if (edit != null)

+ 32 - 2
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -29,7 +29,7 @@ namespace MySystem
                 {
                     WebCMSEntities spdb = new WebCMSEntities();
                     PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
-                    DateTime start = DateTime.Now.AddDays(-5);
+                    DateTime start = DateTime.Now.AddDays(-30);
                     IQueryable<TradeRecord> trades = spdb.TradeRecord;
                     trades = trades.Where(m => m.CreateDate >= start && m.Status == 1);
                     trades = trades.OrderBy(m => m.CreateDate);
@@ -48,6 +48,7 @@ namespace MySystem
                                     if (trade.SerEntryMode == "N" && trade.ProductType == "1")
                                     {
                                         pos.SeoKeyword = trade.TradeAmount.ToString("f2");
+                                        pos.IsPurchase = 0;
                                         db.SaveChanges();
                                     }
                                 }
@@ -176,7 +177,15 @@ namespace MySystem
                                         }
                                         if (pos.CreditTrade < CheckMoney)
                                         {
-                                            pos.IsPurchase = 99;
+                                            decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
+                                            if (deposit > 0)
+                                            { 
+                                                pos.IsPurchase = 0;
+                                            }
+                                            else
+                                            {
+                                                pos.IsPurchase = 99;
+                                            }
                                         }
                                         else if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
                                         {
@@ -192,6 +201,27 @@ namespace MySystem
                                                 RedisDbconn.Instance.Set("PosMerchantInfo:" + merchant.Id, merchant);
                                             }
                                         }
+                                        // 立刷60天内刷满10000,再返40
+                                        if (pos.BrandId == 6 && pos.CreditTrade >= 10000 && pos.BindingTime > DateTime.Now.AddDays(-60))
+                                        {
+                                            PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PxcModels.PosMerchantInfo();
+                                            PxcModels.Users getUser = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new PxcModels.Users();
+                                            int BuyTopUserId = 0;
+                                            string ParentNav = getUser.ParentNav;
+                                            if (!string.IsNullOrEmpty(ParentNav))
+                                            {
+                                                string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
+                                                if (ParentNavList.Length > 1)
+                                                {
+                                                    BuyTopUserId = int.Parse(ParentNavList[1]);
+                                                }
+                                                else if (ParentNavList.Length == 1)
+                                                {
+                                                    BuyTopUserId = int.Parse(ParentNavList[0]);
+                                                }
+                                            }
+                                            StatService.Instance.doActiveReward(db, merchant, pos, getUser.Id, getUser.ParentNav, BuyTopUserId, 40);
+                                        }
                                         db.SaveChanges();
                                     }
                                     TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);

二進制
bin/release/netcoreapp3.0/MySystem.dll


二進制
bin/release/netcoreapp3.0/MySystem.pdb


二進制
obj/release/netcoreapp3.0/MySystem.dll


二進制
obj/release/netcoreapp3.0/MySystem.pdb