|
@@ -53,20 +53,54 @@ namespace MySystem
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void StartListenProfitAdd()
|
|
|
|
|
+ {
|
|
|
|
|
+ Thread th = new Thread(StartListenProfitAddDo);
|
|
|
|
|
+ th.IsBackground = true;
|
|
|
|
|
+ th.Start();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void StartListenProfitAddDo()
|
|
|
|
|
+ {
|
|
|
|
|
+ while (true)
|
|
|
|
|
+ {
|
|
|
|
|
+ string content = RedisDbconn.Instance.RPop<string>("ProfitBeforeNewQueue");
|
|
|
|
|
+ if (!string.IsNullOrEmpty(content))
|
|
|
|
|
+ {
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ DoProfit(content);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "来客吧分润异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ Thread.Sleep(2000);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ Thread.Sleep(60000);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//分润算法
|
|
//分润算法
|
|
|
- public void DoProfit()
|
|
|
|
|
|
|
+ public void DoProfit(string otherCondi = "")
|
|
|
{
|
|
{
|
|
|
string TradeMonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
|
|
string TradeMonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
|
|
|
- string check = function.ReadInstance("/ProfitFlag/" + TradeMonth + "-before-new.txt");
|
|
|
|
|
- if (!string.IsNullOrEmpty(check))
|
|
|
|
|
|
|
+ if(string.IsNullOrEmpty(otherCondi))
|
|
|
{
|
|
{
|
|
|
- return;
|
|
|
|
|
|
|
+ string check = function.ReadInstance("/ProfitFlag/" + TradeMonth + "-before-new.txt");
|
|
|
|
|
+ if (!string.IsNullOrEmpty(check))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ function.WritePage("/ProfitFlag/", TradeMonth + "-before-new.txt", DateTime.Now.ToString());
|
|
|
}
|
|
}
|
|
|
- function.WritePage("/ProfitFlag/", TradeMonth + "-before-new.txt", DateTime.Now.ToString());
|
|
|
|
|
Models.KxsMain.WebCMSEntities kxsdb = new Models.KxsMain.WebCMSEntities();
|
|
Models.KxsMain.WebCMSEntities kxsdb = new Models.KxsMain.WebCMSEntities();
|
|
|
WebCMSEntities dbnew = new WebCMSEntities();
|
|
WebCMSEntities dbnew = new WebCMSEntities();
|
|
|
KxsUserModels.WebCMSEntities udb = new KxsUserModels.WebCMSEntities();
|
|
KxsUserModels.WebCMSEntities udb = new KxsUserModels.WebCMSEntities();
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount),Sort from UserAmountSummaryNewBefore where TradeMonth='" + TradeMonth + "' and SeoTitle='self' group by IsAct,UserId,Sort", AppConfig.Base.SqlConnStr);
|
|
|
|
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount),Sort from UserAmountSummaryNewBefore where TradeMonth='" + TradeMonth + "'" + otherCondi + " and SeoTitle='self' group by IsAct,UserId,Sort", AppConfig.Base.SqlConnStr);
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
{
|
|
{
|
|
|
int UserId = int.Parse(dr["UserId"].ToString());
|
|
int UserId = int.Parse(dr["UserId"].ToString());
|