|
@@ -37,29 +37,38 @@ namespace MySystem
|
|
|
|
|
|
if(DateTime.Now.Day == 2)
|
|
|
{
|
|
|
- Recommend(DateTime.Now.AddMonths(-1).ToString("yyyyMM"));
|
|
|
+ Recommend(DateTime.Now.AddMonths(-1).ToString("yyyyMM"), 1);
|
|
|
+ Recommend(DateTime.Now.AddMonths(-1).ToString("yyyyMM"), 2);
|
|
|
}
|
|
|
- Recommend(DateTime.Now.ToString("yyyyMM"));
|
|
|
+ Recommend(DateTime.Now.ToString("yyyyMM"), 1);
|
|
|
+ Recommend(DateTime.Now.ToString("yyyyMM"), 2);
|
|
|
}
|
|
|
}
|
|
|
Thread.Sleep(600000);
|
|
|
}
|
|
|
}
|
|
|
- public void Recommend(string TradeMonth)
|
|
|
+ public void Recommend(string TradeMonth, int Kind)
|
|
|
{
|
|
|
+ int CheckCount = 0;
|
|
|
+ if(Kind == 1) CheckCount = 40;
|
|
|
+ if(Kind == 2) CheckCount = 50;
|
|
|
List<int> ReduceUserId = new List<int>();
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
|
List<RecommendDirectUser> list = new List<RecommendDirectUser>();
|
|
|
- List<int> Historys = db.RecommendDirectUser.Where(m => m.QueryCount >= 50 && m.TradeMonth != TradeMonth).ToList().Select(m => m.UserId).ToList();
|
|
|
- Historys.Add(565);
|
|
|
- Historys.Add(139473);
|
|
|
- Historys.Add(173790);
|
|
|
- Historys.Add(174506);
|
|
|
- Historys.Add(127023);
|
|
|
+ List<int> Historys = new List<int>();
|
|
|
+ if(Kind == 1)
|
|
|
+ {
|
|
|
+ Historys = db.RecommendDirectUser.Where(m => m.QueryCount >= CheckCount && m.TradeMonth != TradeMonth && m.Kind == Kind).ToList().Select(m => m.UserId).ToList();
|
|
|
+ Historys.Add(565);
|
|
|
+ Historys.Add(139473);
|
|
|
+ Historys.Add(173790);
|
|
|
+ Historys.Add(174506);
|
|
|
+ Historys.Add(127023);
|
|
|
+ }
|
|
|
DateTime check = DateTime.Parse("2023-10-01 00:00:00");
|
|
|
DateTime start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00");
|
|
|
DateTime end = start.AddMonths(1);
|
|
|
- CustomerSqlConn.op("delete from RecommendDirectUser where TradeMonth='" + TradeMonth + "'", MysqlConn.SqlConnStr);
|
|
|
+ CustomerSqlConn.op("delete from RecommendDirectUser where TradeMonth='" + TradeMonth + "' and Kind=" + Kind, MysqlConn.SqlConnStr);
|
|
|
List<int> ProductIds = new List<int>();
|
|
|
ProductIds.Add(10);
|
|
|
ProductIds.Add(11);
|
|
@@ -181,7 +190,7 @@ namespace MySystem
|
|
|
foreach(RecommandKingItem sub in subs)
|
|
|
{
|
|
|
function.WriteLog(sub.UserId + ":" + sub.ActCount, "推荐王最终的达标创客数量分析");
|
|
|
- if(sub.ActCount < 50 && sub.UserLevel < 5 && !Historys.Contains(sub.UserId))
|
|
|
+ if(sub.ActCount < CheckCount && sub.UserLevel < 5 && !Historys.Contains(sub.UserId))
|
|
|
{
|
|
|
ActCount += sub.ActCount;
|
|
|
if(sub.Op) ActCount += 1;
|
|
@@ -197,7 +206,7 @@ namespace MySystem
|
|
|
if(!Historys.Contains(user.UserId))
|
|
|
{
|
|
|
num += 1;
|
|
|
- RecommendDirectUser item = db.RecommendDirectUser.FirstOrDefault(m => m.UserId == user.UserId && m.TradeMonth == TradeMonth);
|
|
|
+ RecommendDirectUser item = db.RecommendDirectUser.FirstOrDefault(m => m.UserId == user.UserId && m.TradeMonth == TradeMonth && m.Kind == Kind);
|
|
|
if(item == null)
|
|
|
{
|
|
|
function.WriteLog(user.UserId.ToString(), "推荐王达标最终入库");
|
|
@@ -205,7 +214,8 @@ namespace MySystem
|
|
|
{
|
|
|
UserId = user.UserId,
|
|
|
TradeMonth = TradeMonth,
|
|
|
- QueryCount = user.ActCount > 50 ? 50 : user.ActCount,
|
|
|
+ QueryCount = user.ActCount > CheckCount ? CheckCount : user.ActCount,
|
|
|
+ Kind = Kind,
|
|
|
}).Entity;
|
|
|
if(num % 200 == 0)
|
|
|
{
|