浏览代码

盟主预设职级过期时间变为9个月

lcl 1 年之前
父节点
当前提交
25dd161bce
共有 3 个文件被更改,包括 69 次插入2 次删除
  1. 2 2
      AppStart/Helper/AlipayPayBack2Service.cs
  2. 66 0
      AppStart/Helper/LeaderAmountMonthChangeQueue.cs
  3. 1 0
      Startup.cs

+ 2 - 2
AppStart/Helper/AlipayPayBack2Service.cs

@@ -628,7 +628,7 @@ namespace MySystem
                                     function.WriteLog("MakerCode:" + puser.MakerCode, "推荐下单奖励监控日志");
                                     function.WriteLog("machineCount:" + machineCount, "推荐下单奖励监控日志");
                                     function.WriteLog("ActiveCount:" + ActiveCount, "推荐下单奖励监控日志");
-                                    if ((machineCount + ActiveCount + couponCount >= 3 || lkb_order || puser.LeaderLevel > 0) && !directPrize)
+                                    if (Utils.Instance.IsStandardUser(ParentUserId))
                                     {
                                         // function.WriteLog("满足条件", "推荐下单奖励监控日志");
                                         // if(puser.LeaderLevel == 0) // 非盟主直推奖励,每个创客第一次下单,上级可得
@@ -1280,7 +1280,7 @@ namespace MySystem
 
         public void LeaderPreUserLevel(WebCMSEntities db, int UserId, int LeaderKind)
         {
-            int Month = LeaderKind == 1 ? 6 : 12;
+            int Month = LeaderKind == 1 ? 6 : 9;
             int Rank = LeaderKind == 1 ? 5 : 7;
             LeaderRankWhite check = db.LeaderRankWhite.FirstOrDefault(m => m.Id == UserId);
             if(check == null)

+ 66 - 0
AppStart/Helper/LeaderAmountMonthChangeQueue.cs

@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Linq;
+using System.Data;
+using MySystem;
+using MySystem.PxcModels;
+using Library;
+using LitJson;
+
+/// <summary>
+/// 每月一号记录上月盟主储蓄金和可提现余额
+/// </summary>
+public class LeaderAmountMonthChangeQueue
+{
+    public readonly static LeaderAmountMonthChangeQueue Instance = new LeaderAmountMonthChangeQueue();
+    private LeaderAmountMonthChangeQueue()
+    {
+    }
+
+    public void Start()
+    {
+        Thread th = new Thread(StartDo);
+        th.IsBackground = true;
+        th.Start();
+    }
+
+    private void StartDo()
+    {
+        while (true)
+        {
+            if (DateTime.Now.Day == 1 && DateTime.Now.Hour > 1 && DateTime.Now.Hour < 10)
+            {
+                try
+                {
+                    string check = function.ReadInstance("/LeaderAmountMonthChange/check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
+                    if (string.IsNullOrEmpty(check))
+                    {
+                        function.WritePage("/LeaderAmountMonthChange/", "check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString("HH:mm:ss"));
+                        WebCMSEntities db = new WebCMSEntities();
+                        var leaders = db.Leaders.Select(m => new { m.UserId, m.ExpiredDate }).ToList();
+                        foreach (var item in leaders)
+                        {
+                            var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == item.UserId) ?? new UserAccount();
+                            var leaderInfo = db.Leaders.FirstOrDefault(m => m.Id == item.UserId) ?? new Leaders();
+                            db.LeaderReconRecord.Add(new LeaderReconRecord()
+                            {
+                                CreateDate = DateTime.Now,
+                                UserId = item.UserId,
+                                StatMonth = DateTime.Now.ToString("yyyy-MM"),
+                                ReserveAmount = userAccount.LeaderReserve,
+                                BalanceAmount = userAccount.LeaderBalanceAmount
+                            });
+                            db.SaveChanges();
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "每月一号记录上月盟主储蓄金和可提现余额线程异常");
+                }
+            }
+            Thread.Sleep(60000);
+        }
+    }
+}

+ 1 - 0
Startup.cs

@@ -219,6 +219,7 @@ namespace MySystem
                 OperateService.Instance.Start(); //运营中心每天统计一次发货量、库存
                 TimeOutPosChargeService.Instance.StartDoChargeAmount(); //实时监听待扣款记录,并扣费
                 InstallmentDeductionService.Instance.Start(); //分期扣款(每月20号执行)
+                LeaderAmountMonthChangeQueue.Instance.Start(); //每月一号记录上月盟主储蓄金和可提现余额
                 LeaderCompPrizeHelper.Instance.Start(); //领导人达标奖
 
                 ChangePosTimer.Instance.Start(); //售后换新执行机具数据转移