|
@@ -27,7 +27,7 @@ namespace MySystem
|
|
|
{
|
|
|
while (true)
|
|
|
{
|
|
|
- if(DateTime.Now.Hour > 0 && DateTime.Now.Hour < 12)
|
|
|
+ if(DateTime.Now.Hour > 0 && DateTime.Now.Hour < 23)
|
|
|
{
|
|
|
Recommend();
|
|
|
}
|
|
@@ -37,12 +37,12 @@ namespace MySystem
|
|
|
public void Recommend()
|
|
|
{
|
|
|
string today = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
- // string checkFlag = function.ReadInstance("/RecommandKing/" + today + ".txt");
|
|
|
- // if(!string.IsNullOrEmpty(checkFlag))
|
|
|
- // {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // function.WritePage("/RecommandKing/", today + ".txt", DateTime.Now.ToString());
|
|
|
+ string checkFlag = function.ReadInstance("/RecommandKing/" + today + ".txt");
|
|
|
+ if(!string.IsNullOrEmpty(checkFlag))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ function.WritePage("/RecommandKing/", today + ".txt", DateTime.Now.ToString());
|
|
|
List<int> Historys = new List<int>();
|
|
|
Historys.Add(565);
|
|
|
Historys.Add(139473);
|
|
@@ -69,7 +69,7 @@ namespace MySystem
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
|
ReadModels.WebCMSEntities readdb = new ReadModels.WebCMSEntities();
|
|
|
//统计当月下单名单
|
|
|
- List<int> uids = readdb.Orders.Where(m => m.PayDate >= check && m.Status > 0 && m.Sort == 0 && ProductIds.Contains(m.ProductId)).ToList().Select(m => m.UserId).Distinct().ToList();
|
|
|
+ List<int> uids = readdb.Orders.Where(m => m.PayDate >= check && m.Status > 0 && m.Sort == 0 && m.UserId > 1 && ProductIds.Contains(m.ProductId)).ToList().Select(m => m.UserId).Distinct().ToList();
|
|
|
foreach(int uid in uids)
|
|
|
{
|
|
|
int ActCount = 0;
|
|
@@ -109,6 +109,7 @@ namespace MySystem
|
|
|
ParentUserId = user.ParentUserId,
|
|
|
ParentNav = user.ParentNav,
|
|
|
PreAmount = PreMonthAmt.ContainsKey(user.Id) ? PreMonthAmt[user.Id] : 0,
|
|
|
+ Level = user.ParentNav.Replace(",,", ",").Trim(',').Split(',').Length + 1
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -164,11 +165,21 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- users = users.OrderByDescending(m => m.ParentNav).ToList();
|
|
|
+ users = users.OrderByDescending(m => m.Level).ToList();
|
|
|
+ List<RecommandKingItem> users2 = users.OrderBy(m => m.Level).ToList();
|
|
|
foreach(RecommandKingItem user in users)
|
|
|
{
|
|
|
string UserIdStr = "," + user.UserId + ",";
|
|
|
- user.ActCount = users.Count(m => m.ParentNav.Contains(UserIdStr) && m.ActCount < 50 && m.PreAmount < 30000000);
|
|
|
+ RecommandKingItem lookSub = users2.FirstOrDefault(m => m.ParentNav.Contains(UserIdStr) && (m.ActCount >= 50 || m.PreAmount >= 30000000));
|
|
|
+ if(lookSub != null)
|
|
|
+ {
|
|
|
+ string ParentNav = lookSub.ParentNav + "," + lookSub.UserId + ",";
|
|
|
+ user.ActCount = users.Count(m => m.ParentNav.Contains(UserIdStr) && !m.ParentNav.StartsWith(ParentNav) && m.UserId != lookSub.UserId && m.ActCount < 50 && m.PreAmount < 30000000);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ user.ActCount = users.Count(m => m.ParentNav.Contains(UserIdStr) && m.ActCount < 50 && m.PreAmount < 30000000);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
int num = 0;
|
|
@@ -182,7 +193,7 @@ namespace MySystem
|
|
|
{
|
|
|
UserId = user.UserId,
|
|
|
TradeMonth = TradeMonth,
|
|
|
- QueryCount = user.ActCount,
|
|
|
+ QueryCount = user.ActCount > 50 ? 50 : user.ActCount,
|
|
|
}).Entity;
|
|
|
if(num % 200 == 0)
|
|
|
{
|