|
|
@@ -27,9 +27,8 @@ namespace MySystem
|
|
|
{
|
|
|
while(true)
|
|
|
{
|
|
|
- if(DateTime.Now.Hour > 0 && DateTime.Now.Hour < 23)
|
|
|
- {
|
|
|
-
|
|
|
+ if(DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 3 && DateTime.Now.Minute > 5)
|
|
|
+ {
|
|
|
string check = function.ReadInstance("/LeaderComp/" + DateTime.Now.ToString("yyyyMMdd") + ".txt");
|
|
|
if(string.IsNullOrEmpty(check))
|
|
|
{
|
|
|
@@ -69,10 +68,14 @@ namespace MySystem
|
|
|
|
|
|
//创客团队交易额
|
|
|
string sql = "";
|
|
|
+ int rownum = 0;
|
|
|
int num = 0;
|
|
|
DataTable dt = CustomerSqlConn.dtable("select UserId,sum(HelpNonDirectTradeAmt + NotHelpNonDirectTradeAmt + ProfitNonDirectTradeAmt + HelpNonDirectDebitTradeAmt + NotHelpNonDirectDebitTradeAmt + ProfitNonDirectDebitTradeAmt) Amt from TradeDaySummary where Id>=15055757 and TradeMonth='" + month + "' and SeoTitle='team' and UserId>0 group by UserId", MysqlConn.ReadSqlConnStr);
|
|
|
+ function.WriteLog("交易数:" + dt.Rows.Count.ToString(), "领导人达标奖励日志");
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
{
|
|
|
+ rownum += 1;
|
|
|
+ function.WriteLog("rownum:" + rownum.ToString(), "领导人达标奖励日志");
|
|
|
int UserId = int.Parse(dr["UserId"].ToString());
|
|
|
decimal TradeAmount = decimal.Parse(dr["Amt"].ToString());
|
|
|
//码牌团队交易额(直联)
|
|
|
@@ -107,6 +110,7 @@ namespace MySystem
|
|
|
num += 1;
|
|
|
if(num >= 200)
|
|
|
{
|
|
|
+ function.WriteLog("执行一次sql:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "领导人达标奖励日志");
|
|
|
CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
|
|
|
sql = "";
|
|
|
num = 0;
|
|
|
@@ -115,16 +119,17 @@ namespace MySystem
|
|
|
|
|
|
if(!string.IsNullOrEmpty(sql))
|
|
|
{
|
|
|
+ function.WriteLog("最后执行sql:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "领导人达标奖励日志");
|
|
|
CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
|
|
|
}
|
|
|
CustomerSqlConn.op("update LeaderCompTradeStat leader set ParentUserId=case when (select ParentUserId from Users where Id=leader.UserId) is null then 0 else (select ParentUserId from Users where Id=leader.UserId) end,ParentNav=(select ParentNav from Users where Id=leader.UserId) where StatMonth='" + MonthString + "' and UserId>1", MysqlConn.SqlConnStr);
|
|
|
|
|
|
- function.WriteLog("start-----" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "领导人达标奖励日志");
|
|
|
+ function.WriteLog("start2-----" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "领导人达标奖励日志");
|
|
|
|
|
|
//计算创客名下的达标人数,直推和间接
|
|
|
function.WriteLog("MonthString:" + MonthString, "领导人达标奖励日志");
|
|
|
|
|
|
- Thread.Sleep(4000000);
|
|
|
+ Thread.Sleep(600000);
|
|
|
|
|
|
// List<LeaderCompTradeStat> stats = db.LeaderCompTradeStat.Where(m => m.StatMonth == MonthString).ToList();
|
|
|
DataTable stats = CustomerSqlConn.dtable("select UserId,ParentUserId,ParentNav,TradeAmount,(select sum(TradeAmount) from LeaderCompTradeStat where ParentUserId=p.UserId and TradeAmount<30000000) SmallTradeAmount from LeaderCompTradeStat p where StatMonth='" + MonthString + "' and UserId>1", MysqlConn.SqlConnStr);
|