|
@@ -992,7 +992,7 @@ namespace MySystem
|
|
|
PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
|
|
|
// PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId && m.Sort == 1);
|
|
|
PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
- if(merchant != null && pos.BrandId != 6)
|
|
|
+ if (merchant != null && pos.BrandId != 6)
|
|
|
{
|
|
|
bool checkExist = db.FluxProfitDetail.Any(m => m.MerNo == merchant.KqMerNo);
|
|
|
if (!checkExist && decimal.Parse(function.CheckNum(pos.SeoKeyword)) > 0)
|
|
@@ -1178,7 +1178,7 @@ namespace MySystem
|
|
|
// 每天统计头一天的交易额
|
|
|
public void StartEverDayV2(string date)
|
|
|
{
|
|
|
- OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
+ OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
// Thread th = new Thread(StatTradeAmountEverDay);
|
|
|
// th.IsBackground = true;
|
|
|
// th.Start(date);
|
|
@@ -1254,10 +1254,10 @@ namespace MySystem
|
|
|
}
|
|
|
if (BankCardType == 0)
|
|
|
{
|
|
|
- if(MerHelpFlag == 1)
|
|
|
+ if (MerHelpFlag == 1)
|
|
|
{
|
|
|
selfStat.HelpDirectDebitTradeAmt += TradeAmount;
|
|
|
- if(CapFlag == 1)
|
|
|
+ if (CapFlag == 1)
|
|
|
{
|
|
|
selfStat.HelpDirectDebitCapTradeAmt += TradeAmount;
|
|
|
selfStat.HelpDirectDebitCapNum += TradeCount;
|
|
@@ -1266,7 +1266,7 @@ namespace MySystem
|
|
|
else
|
|
|
{
|
|
|
selfStat.NotHelpDirectDebitTradeAmt += TradeAmount;
|
|
|
- if(CapFlag == 1)
|
|
|
+ if (CapFlag == 1)
|
|
|
{
|
|
|
selfStat.NotHelpDirectDebitCapTradeAmt += TradeAmount;
|
|
|
selfStat.NotHelpDirectDebitCapNum += TradeCount;
|
|
@@ -1275,7 +1275,7 @@ namespace MySystem
|
|
|
}
|
|
|
else if (BankCardType != 0)
|
|
|
{
|
|
|
- if(MerHelpFlag == 1)
|
|
|
+ if (MerHelpFlag == 1)
|
|
|
{
|
|
|
selfStat.HelpDirectTradeAmt += TradeAmount;
|
|
|
}
|
|
@@ -1328,10 +1328,10 @@ namespace MySystem
|
|
|
}
|
|
|
if (BankCardType == 0)
|
|
|
{
|
|
|
- if(MerHelpFlag == 1)
|
|
|
+ if (MerHelpFlag == 1)
|
|
|
{
|
|
|
teamStat.HelpNonDirectDebitTradeAmt += TradeAmount;
|
|
|
- if(CapFlag == 1)
|
|
|
+ if (CapFlag == 1)
|
|
|
{
|
|
|
teamStat.HelpDirectDebitCapTradeAmt += TradeAmount;
|
|
|
teamStat.HelpDirectDebitCapNum += TradeCount;
|
|
@@ -1340,7 +1340,7 @@ namespace MySystem
|
|
|
else
|
|
|
{
|
|
|
teamStat.NotHelpNonDirectDebitTradeAmt += TradeAmount;
|
|
|
- if(CapFlag == 1)
|
|
|
+ if (CapFlag == 1)
|
|
|
{
|
|
|
teamStat.NotHelpDirectDebitCapTradeAmt += TradeAmount;
|
|
|
teamStat.NotHelpDirectDebitCapNum += TradeCount;
|
|
@@ -1349,7 +1349,7 @@ namespace MySystem
|
|
|
}
|
|
|
else if (BankCardType != 0)
|
|
|
{
|
|
|
- if(MerHelpFlag == 1)
|
|
|
+ if (MerHelpFlag == 1)
|
|
|
{
|
|
|
teamStat.HelpNonDirectTradeAmt += TradeAmount;
|
|
|
}
|
|
@@ -1359,7 +1359,7 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
- OtherMySqlConn.op("update Users set ThisMonthTrade=ThisMonthTrade+"+TradeAmount+" where Id=" + NavUserId);
|
|
|
+ OtherMySqlConn.op("update Users set ThisMonthTrade=ThisMonthTrade+" + TradeAmount + " where Id=" + NavUserId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1388,11 +1388,11 @@ namespace MySystem
|
|
|
// th.Start(check.ToString("yyyy-MM-dd"));
|
|
|
// check = check.AddDays(1);
|
|
|
// }
|
|
|
- if(DateTime.Now.Day == 2)
|
|
|
+ if (DateTime.Now.Day == 2)
|
|
|
{
|
|
|
OtherMySqlConn.op("update Users set ThisMonthTrade=0 where ThisMonthTrade>0");
|
|
|
DataTable list = OtherMySqlConn.dtable("select UserId,sum(NonDirectTradeAmt) from UserTradeDaySummary where TradeMonth='" + DateTime.Now.ToString("yyyyMM") + "' GROUP BY UserId");
|
|
|
- foreach(DataRow dr in list.Rows)
|
|
|
+ foreach (DataRow dr in list.Rows)
|
|
|
{
|
|
|
string UserId = dr["UserId"].ToString();
|
|
|
string ThisMonthTrade = dr[1].ToString();
|
|
@@ -1513,11 +1513,11 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(DateTime.Now.Day >= 2)
|
|
|
+ if (DateTime.Now.Day >= 2)
|
|
|
{
|
|
|
Thread.Sleep(5000);
|
|
|
DataTable list = OtherMySqlConn.dtable("select UserId,sum(NonDirectTradeAmt) from UserTradeDaySummary where TradeDate='" + TradeDate + "' GROUP BY UserId");
|
|
|
- foreach(DataRow dr in list.Rows)
|
|
|
+ foreach (DataRow dr in list.Rows)
|
|
|
{
|
|
|
string UserId = dr["UserId"].ToString();
|
|
|
string ThisMonthTrade = dr[1].ToString();
|
|
@@ -1606,7 +1606,7 @@ namespace MySystem
|
|
|
// function.WritePage("/html/", "1.html", html);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1734,19 +1734,23 @@ namespace MySystem
|
|
|
// 统计创客激活数
|
|
|
public void StartPosActNum()
|
|
|
{
|
|
|
- OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
Thread th = new Thread(StartPosActNumFor);
|
|
|
th.IsBackground = true;
|
|
|
th.Start();
|
|
|
}
|
|
|
public void StartPosActNumFor()
|
|
|
{
|
|
|
- DateTime end = DateTime.Parse("2022-06-15 00:00:00");
|
|
|
- DateTime check = DateTime.Parse("2022-06-14");
|
|
|
- while (check <= end)
|
|
|
+ // DateTime end = DateTime.Parse("2022-06-15 00:00:00");
|
|
|
+ // DateTime check = DateTime.Parse("2022-06-14");
|
|
|
+ // while (check <= end)
|
|
|
+ // {
|
|
|
+ // StartPosActNumDo(check.ToString("yyyy-MM-dd"));
|
|
|
+ // check = check.AddDays(1);
|
|
|
+ // }
|
|
|
+ while (true)
|
|
|
{
|
|
|
- StartPosActNumDo(check.ToString("yyyy-MM-dd"));
|
|
|
- check = check.AddDays(1);
|
|
|
+ StartPosActNumEverTime();
|
|
|
+ Thread.Sleep(600000);
|
|
|
}
|
|
|
}
|
|
|
public void StartPosActNumDo(object sender)
|
|
@@ -1841,6 +1845,91 @@ namespace MySystem
|
|
|
function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "执行创客激活数日志");
|
|
|
Thread.Sleep(60000);
|
|
|
}
|
|
|
+ public void StartPosActNumEverTime()
|
|
|
+ {
|
|
|
+ OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
+ function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "实时执行创客激活数日志");
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ DataTable idsDt = OtherMySqlConn.dtable("select Id from PosMachinesTwo where QueryCount=0 and ActivationState=1 and ActivationTime is not null and BuyUserId>0 limit 200");
|
|
|
+ if(idsDt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string ids = "";
|
|
|
+ foreach (DataRow idsDr in idsDt.Rows)
|
|
|
+ {
|
|
|
+ ids += idsDr["Id"].ToString() + ",";
|
|
|
+ }
|
|
|
+ DataTable userDt = OtherMySqlConn.dtable("select BuyUserId,BrandId,DATE_FORMAT(ActivationTime, '%Y%m%d'),count(Id) from PosMachinesTwo where Id in (" + ids.TrimEnd(',') + ") group by BuyUserId,BrandId,DATE_FORMAT(ActivationTime, '%Y%m%d')");
|
|
|
+ if (userDt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ OtherMySqlConn.op("update PosMachinesTwo set QueryCount=1 where Id in (" + ids.TrimEnd(',') + ")");
|
|
|
+ function.WriteLog("人数:" + userDt.Rows.Count + "\n\n", "实时执行创客激活数日志");
|
|
|
+ foreach (DataRow userDr in userDt.Rows)
|
|
|
+ {
|
|
|
+ int UserId = int.Parse(userDr["BuyUserId"].ToString());
|
|
|
+ int BrandId = int.Parse(userDr["BrandId"].ToString());
|
|
|
+ string TradeDate = userDr[2].ToString();
|
|
|
+ int ActCount = int.Parse(function.CheckInt(userDr[3].ToString()));
|
|
|
+ int QrPayFlag = 0;
|
|
|
+ string TradeMonth = TradeDate.Substring(0, 6);
|
|
|
+ string date = TradeDate.Substring(0, 4) + "-" + TradeDate.Substring(4, 2) + "-" + TradeDate.Substring(6, 2);
|
|
|
+ string start = date + " 00:00:00";
|
|
|
+ string end = DateTime.Parse(date).AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00";
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
+ string ParentNav = user.ParentNav;
|
|
|
+ UserTradeDaySummary selfStat = db.UserTradeDaySummary.FirstOrDefault(m => m.UserId == UserId && m.TradeMonth == TradeMonth && m.TradeDate == TradeDate && m.BrandId == BrandId && m.QueryCount == QrPayFlag && m.SeoTitle == "self");
|
|
|
+ if (selfStat == null)
|
|
|
+ {
|
|
|
+ selfStat = db.UserTradeDaySummary.Add(new UserTradeDaySummary()
|
|
|
+ {
|
|
|
+ UserId = UserId,
|
|
|
+ TradeMonth = TradeMonth,
|
|
|
+ TradeDate = TradeDate,
|
|
|
+ BrandId = BrandId,
|
|
|
+ QueryCount = QrPayFlag,
|
|
|
+ SeoTitle = "self",
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ selfStat.DirectDebitCapNum += ActCount;
|
|
|
+ db.SaveChanges();
|
|
|
+ ParentNav += "," + UserId + ",";
|
|
|
+ if (!string.IsNullOrEmpty(ParentNav))
|
|
|
+ {
|
|
|
+ string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ foreach (string NavUserIdString in ParentNavList)
|
|
|
+ {
|
|
|
+ int NavUserId = int.Parse(NavUserIdString);
|
|
|
+ UserTradeDaySummary teamStat = db.UserTradeDaySummary.FirstOrDefault(m => m.UserId == NavUserId && m.TradeMonth == TradeMonth && m.TradeDate == TradeDate && m.BrandId == BrandId && m.QueryCount == QrPayFlag && m.SeoTitle == "team");
|
|
|
+ if (teamStat == null)
|
|
|
+ {
|
|
|
+ teamStat = db.UserTradeDaySummary.Add(new UserTradeDaySummary()
|
|
|
+ {
|
|
|
+ UserId = NavUserId,
|
|
|
+ TradeMonth = TradeMonth,
|
|
|
+ TradeDate = TradeDate,
|
|
|
+ BrandId = BrandId,
|
|
|
+ QueryCount = QrPayFlag,
|
|
|
+ SeoTitle = "team",
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ teamStat.NonDirectDebitCapNum += ActCount;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "实时执行创客激活数异常");
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "实时执行创客激活数日志");
|
|
|
+ }
|
|
|
|
|
|
// 统计新增创客数
|
|
|
public void StartNewUserNum()
|
|
@@ -1851,12 +1940,17 @@ namespace MySystem
|
|
|
}
|
|
|
public void StartNewUserNumFor()
|
|
|
{
|
|
|
- DateTime end = DateTime.Parse("2022-06-15 00:00:00");
|
|
|
- DateTime check = DateTime.Parse("2022-06-14");
|
|
|
- while (check <= end)
|
|
|
+ // DateTime end = DateTime.Parse("2022-06-15 00:00:00");
|
|
|
+ // DateTime check = DateTime.Parse("2022-06-14");
|
|
|
+ // while (check <= end)
|
|
|
+ // {
|
|
|
+ // StartNewUserNumDo(check.ToString("yyyy-MM-dd"));
|
|
|
+ // check = check.AddDays(1);
|
|
|
+ // }
|
|
|
+ while (true)
|
|
|
{
|
|
|
- StartNewUserNumDo(check.ToString("yyyy-MM-dd"));
|
|
|
- check = check.AddDays(1);
|
|
|
+ StartNewUserNumEverTime();
|
|
|
+ Thread.Sleep(600000);
|
|
|
}
|
|
|
}
|
|
|
public void StartNewUserNumDo(object sender)
|
|
@@ -1944,6 +2038,84 @@ namespace MySystem
|
|
|
function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "执行新增创客数日志");
|
|
|
Thread.Sleep(60000);
|
|
|
}
|
|
|
+ public void StartNewUserNumEverTime()
|
|
|
+ {
|
|
|
+ OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
+ function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "实时执行新增创客数日志");
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ DataTable idsDt = OtherMySqlConn.dtable("select Id from Users where QueryCount=0 and AuthFlag=1 and AuthDate is not null limit 200");
|
|
|
+ if(idsDt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string ids = "";
|
|
|
+ foreach (DataRow idsDr in idsDt.Rows)
|
|
|
+ {
|
|
|
+ ids += idsDr["Id"].ToString() + ",";
|
|
|
+ }
|
|
|
+ DataTable userDt = OtherMySqlConn.dtable("select ParentUserId,DATE_FORMAT(AuthDate, '%Y%m%d'),count(Id) from Users where Id in (" + ids.TrimEnd(',') + ") group by ParentUserId,DATE_FORMAT(AuthDate, '%Y%m%d')");
|
|
|
+ if(userDt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ OtherMySqlConn.op("update Users set QueryCount=1 where Id in (" + ids.TrimEnd(',') + ")");
|
|
|
+ function.WriteLog("人数:" + userDt.Rows.Count + "\n\n", "实时执行新增创客数日志");
|
|
|
+ foreach (DataRow userDr in userDt.Rows)
|
|
|
+ {
|
|
|
+ string StatDate = userDr[1].ToString();
|
|
|
+ int UserId = int.Parse(userDr["ParentUserId"].ToString());
|
|
|
+ string StatMonth = StatDate.Substring(0, 6);
|
|
|
+ string date = StatDate.Substring(0, 4) + "-" + StatDate.Substring(4, 2) + "-" + StatDate.Substring(6, 2);
|
|
|
+ string start = date + " 00:00:00";
|
|
|
+ string end = DateTime.Parse(date).AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00";
|
|
|
+ int AddCount = int.Parse(userDr[2].ToString());
|
|
|
+ string ParentNav = userDr["ParentNav"].ToString();
|
|
|
+ PullnewSummary selfStat = db.PullnewSummary.FirstOrDefault(m => m.UserId == UserId && m.StatMonth == StatMonth && m.StatDate == StatDate && m.SeoTitle == "self");
|
|
|
+ if (selfStat == null)
|
|
|
+ {
|
|
|
+ selfStat = db.PullnewSummary.Add(new PullnewSummary()
|
|
|
+ {
|
|
|
+ UserId = UserId,
|
|
|
+ StatMonth = StatMonth,
|
|
|
+ StatDate = StatDate,
|
|
|
+ SeoTitle = "self",
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ selfStat.RecUserAuthNum += AddCount;
|
|
|
+ db.SaveChanges();
|
|
|
+ ParentNav += "," + UserId + ",";
|
|
|
+ if (!string.IsNullOrEmpty(ParentNav))
|
|
|
+ {
|
|
|
+ string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ foreach (string NavUserIdString in ParentNavList)
|
|
|
+ {
|
|
|
+ int NavUserId = int.Parse(NavUserIdString);
|
|
|
+ PullnewSummary teamStat = db.PullnewSummary.FirstOrDefault(m => m.UserId == NavUserId && m.StatMonth == StatMonth && m.StatDate == StatDate && m.SeoTitle == "team");
|
|
|
+ if (teamStat == null)
|
|
|
+ {
|
|
|
+ teamStat = db.PullnewSummary.Add(new PullnewSummary()
|
|
|
+ {
|
|
|
+ UserId = NavUserId,
|
|
|
+ StatMonth = StatMonth,
|
|
|
+ StatDate = StatDate,
|
|
|
+ SeoTitle = "team",
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ teamStat.RecUserAuthNum += AddCount;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "实时执行新增创客数异常");
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "实时执行新增创客数日志");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -1957,8 +2129,8 @@ namespace MySystem
|
|
|
}
|
|
|
public void StatProfitDo()
|
|
|
{
|
|
|
- DateTime end = DateTime.Parse("2022-06-15 00:00:00");
|
|
|
- DateTime check = DateTime.Parse("2022-06-04");
|
|
|
+ DateTime end = DateTime.Parse("2022-06-16 00:00:00");
|
|
|
+ DateTime check = DateTime.Parse("2022-06-16");
|
|
|
while (check <= end)
|
|
|
{
|
|
|
StatProfitEverDay(check.ToString("yyyy-MM-dd"));
|