|
@@ -72,83 +72,94 @@ namespace MySystem
|
|
|
MpMainModels.WebCMSEntities mpdb = new MpMainModels.WebCMSEntities();
|
|
|
MpMainModels2.WebCMSEntities mpdb2 = new MpMainModels2.WebCMSEntities();
|
|
|
//统计当月下单名单
|
|
|
- // List<int> checkIds = readdb.Users.Where(m => (m.ParentNav.Contains(",609,") || m.Id == 609) && m.AuthFlag == 1).ToList().Select(m => m.Id).ToList();
|
|
|
- // List<int> uids = readdb.Orders.Where(m => m.PayDate >= check && m.Status > 0 && m.Sort == 0 && m.UserId > 1 && checkIds.Contains(m.UserId) && ProductIds.Contains(m.ProductId)).ToList().Select(m => m.UserId).Distinct().ToList();
|
|
|
- // foreach(int uid in uids)
|
|
|
- // {
|
|
|
- // Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
- // if(user != null)
|
|
|
- // {
|
|
|
- // if(!users.Any(m => m.UserId == user.Id))
|
|
|
- // {
|
|
|
- // users.Add(new RecommandKingItem()
|
|
|
- // {
|
|
|
- // UserId = user.Id,
|
|
|
- // ParentUserId = user.ParentUserId,
|
|
|
- // ParentNav = user.ParentNav,
|
|
|
- // PreAmount = PreMonthAmt.ContainsKey(user.Id) ? PreMonthAmt[user.Id] : 0,
|
|
|
- // Level = user.ParentNav.Replace(",,", ",").Trim(',').Split(',').Length + 1,
|
|
|
- // Kind = 1,
|
|
|
- // Op = false,
|
|
|
- // });
|
|
|
- // }
|
|
|
- // string[] ParentIds = user.ParentNav.Replace(",,", ",").Trim(',').Split(',');
|
|
|
- // foreach(string ParentId in ParentIds)
|
|
|
- // {
|
|
|
- // int ParentUserId = int.Parse(ParentId);
|
|
|
- // Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId && m.Id > 1);
|
|
|
- // if(puser != null)
|
|
|
- // {
|
|
|
- // if(!users.Any(m => m.UserId == puser.Id))
|
|
|
- // {
|
|
|
- // users.Add(new RecommandKingItem()
|
|
|
- // {
|
|
|
- // UserId = puser.Id,
|
|
|
- // ParentUserId = puser.ParentUserId,
|
|
|
- // ParentNav = puser.ParentNav,
|
|
|
- // PreAmount = PreMonthAmt.ContainsKey(puser.Id) ? PreMonthAmt[puser.Id] : 0,
|
|
|
- // Level = puser.ParentNav.Replace(",,", ",").Trim(',').Split(',').Length + 1,
|
|
|
- // Kind = 2,
|
|
|
- // Op = false,
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // foreach(RecommandKingItem user in users)
|
|
|
- // {
|
|
|
- // if(user.Kind == 1)
|
|
|
- // {
|
|
|
- // int uid = user.UserId;
|
|
|
- // int ActCount = 0;
|
|
|
- // if(ActCount == 0)
|
|
|
- // {
|
|
|
- // if(readdb.UserTradeMonthSummary.Any(m => m.UserId == uid && m.TradeMonth == TradeMonth && m.SeoTitle == "team"))
|
|
|
- // {
|
|
|
- // ActCount += readdb.UserTradeMonthSummary.Where(m => m.UserId == uid && m.TradeMonth == TradeMonth && m.SeoTitle == "team").Sum(m => m.ActiveBuddyMerStatus);
|
|
|
- // if(readdb.UserSimActSummary.Any(m => m.UserId == uid && m.Kind == 1))
|
|
|
- // {
|
|
|
- // ActCount -= readdb.UserSimActSummary.Where(m => m.UserId == uid && m.Kind == 1).Sum(m => m.ActCount); //减去注销的用户
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if(ActCount == 0)
|
|
|
- // {
|
|
|
- // ActCount += mpdb.MerchantDepositOrder.Count(m => m.UserId == uid && m.CreateDate >= start && m.CreateDate < end && m.Status > 0 && m.UserId == uid);
|
|
|
- // }
|
|
|
- // if(ActCount == 0)
|
|
|
- // {
|
|
|
- // ActCount += mpdb2.MerchantDepositOrder.Count(m => m.UserId == uid && m.CreateDate >= start && m.CreateDate < end && m.Status > 0 && m.UserId == uid);
|
|
|
- // }
|
|
|
- // if(ActCount > 0)
|
|
|
- // {
|
|
|
- // user.Op = true;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // RedisDbconn.Instance.AddList("userstmp2024", user);
|
|
|
- // }
|
|
|
- users = RedisDbconn.Instance.GetList<RecommandKingItem>("userstmp2024", 1, 99999999);
|
|
|
+ List<int> checkIds = readdb.Users.Where(m => (m.ParentNav.Contains(",609,") || m.Id == 609) && m.AuthFlag == 1).ToList().Select(m => m.Id).ToList();
|
|
|
+ List<int> uids = readdb.Orders.Where(m => m.PayDate >= check && m.Status > 0 && m.Sort == 0 && m.UserId > 1 && checkIds.Contains(m.UserId) && ProductIds.Contains(m.ProductId)).ToList().Select(m => m.UserId).Distinct().ToList();
|
|
|
+ foreach(int uid in uids)
|
|
|
+ {
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
+ if(user != null)
|
|
|
+ {
|
|
|
+ if(!users.Any(m => m.UserId == user.Id))
|
|
|
+ {
|
|
|
+ users.Add(new RecommandKingItem()
|
|
|
+ {
|
|
|
+ UserId = user.Id,
|
|
|
+ ParentUserId = user.ParentUserId,
|
|
|
+ ParentNav = user.ParentNav,
|
|
|
+ PreAmount = PreMonthAmt.ContainsKey(user.Id) ? PreMonthAmt[user.Id] : 0,
|
|
|
+ Level = user.ParentNav.Replace(",,", ",").Trim(',').Split(',').Length + 1,
|
|
|
+ Kind = 1,
|
|
|
+ Op = false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach(int uid in uids)
|
|
|
+ {
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == uid);
|
|
|
+ if(user != null)
|
|
|
+ {
|
|
|
+ string[] ParentIds = user.ParentNav.Replace(",,", ",").Trim(',').Split(',');
|
|
|
+ foreach(string ParentId in ParentIds)
|
|
|
+ {
|
|
|
+ int ParentUserId = int.Parse(ParentId);
|
|
|
+ Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId && m.Id > 1);
|
|
|
+ if(puser != null)
|
|
|
+ {
|
|
|
+ if(!users.Any(m => m.UserId == puser.Id))
|
|
|
+ {
|
|
|
+ users.Add(new RecommandKingItem()
|
|
|
+ {
|
|
|
+ UserId = puser.Id,
|
|
|
+ ParentUserId = puser.ParentUserId,
|
|
|
+ ParentNav = puser.ParentNav,
|
|
|
+ PreAmount = PreMonthAmt.ContainsKey(puser.Id) ? PreMonthAmt[puser.Id] : 0,
|
|
|
+ Level = puser.ParentNav.Replace(",,", ",").Trim(',').Split(',').Length + 1,
|
|
|
+ Kind = 2,
|
|
|
+ Op = false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach(RecommandKingItem user in users)
|
|
|
+ {
|
|
|
+ if(user.Kind == 1)
|
|
|
+ {
|
|
|
+ int uid = user.UserId;
|
|
|
+ if(uid == 193523)
|
|
|
+ {
|
|
|
+ string ss = "123123";
|
|
|
+ }
|
|
|
+ int ActCount = 0;
|
|
|
+ if(ActCount == 0)
|
|
|
+ {
|
|
|
+ if(readdb.UserTradeMonthSummary.Any(m => m.UserId == uid && m.TradeMonth == TradeMonth && m.SeoTitle == "self"))
|
|
|
+ {
|
|
|
+ ActCount += readdb.UserTradeMonthSummary.Where(m => m.UserId == uid && m.TradeMonth == TradeMonth && m.SeoTitle == "self").Sum(m => m.ActiveBuddyMerStatus);
|
|
|
+ if(readdb.UserSimActSummary.Any(m => m.UserId == uid && m.Kind == 1))
|
|
|
+ {
|
|
|
+ ActCount -= readdb.UserSimActSummary.Where(m => m.UserId == uid && m.Kind == 1).Sum(m => m.ActCount); //减去注销的用户
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ActCount == 0)
|
|
|
+ {
|
|
|
+ ActCount += mpdb.MerchantDepositOrder.Count(m => m.UserId == uid && m.CreateDate >= start && m.CreateDate < end && m.Status > 0 && m.UserId == uid);
|
|
|
+ }
|
|
|
+ if(ActCount == 0)
|
|
|
+ {
|
|
|
+ ActCount += mpdb2.MerchantDepositOrder.Count(m => m.UserId == uid && m.CreateDate >= start && m.CreateDate < end && m.Status > 0 && m.UserId == uid);
|
|
|
+ }
|
|
|
+ if(ActCount > 0)
|
|
|
+ {
|
|
|
+ user.Op = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RedisDbconn.Instance.AddList("userstmp2024", user);
|
|
|
+ }
|
|
|
+ // users = RedisDbconn.Instance.GetList<RecommandKingItem>("userstmp2024", 1, 99999999);
|
|
|
users = users.OrderBy(m => m.Level).ToList();
|
|
|
foreach(RecommandKingItem user in users)
|
|
|
{
|
|
@@ -156,6 +167,10 @@ namespace MySystem
|
|
|
int Count = users.Count(m => m.ParentNav.Contains(UserIdStr) && m.Op);
|
|
|
user.ActCount = Count;
|
|
|
user.ChkActCount = Count;
|
|
|
+ if(user.UserId == 184916)
|
|
|
+ {
|
|
|
+ var test = users.Where(m => m.ParentNav.Contains(UserIdStr) && m.Op).ToList();
|
|
|
+ }
|
|
|
}
|
|
|
foreach(RecommandKingItem user in users)
|
|
|
{
|