|
@@ -32,14 +32,21 @@ public class ResetSmallStoreHelper
|
|
|
OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
try
|
|
|
{
|
|
|
- // if(DateTime.Now.Day == 1 && DateTime.Now.Hour > 0 && DateTime.Now.Hour < 3)
|
|
|
- // {
|
|
|
+ string content = RedisDbconn.Instance.RPop<string>("ResetSmallStoreQueue");
|
|
|
+ if(!string.IsNullOrEmpty(content))
|
|
|
+ {
|
|
|
string Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
|
|
|
string check = function.ReadInstance("/ResetSmallStore/" + Month + ".txt");
|
|
|
if(string.IsNullOrEmpty(check))
|
|
|
{
|
|
|
function.WritePage("/ResetSmallStore/", Month + ".txt", DateTime.Now.ToString());
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where UserId>0 and TradeMonth='" + Month + "' group by UserId order by UserId");
|
|
|
+ string minId = "0";
|
|
|
+ DataTable minIdDt = OtherMySqlConn.dtable("select min(Id) from ProfitRewardRecord where TradeMonth='" + Month + "'");
|
|
|
+ if(minIdDt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ minId = minIdDt.Rows[0][0].ToString();
|
|
|
+ }
|
|
|
+ DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where Id>=" + minId + " and UserId>0 and TradeMonth='" + Month + "' group by UserId");
|
|
|
function.WriteLog("总数" + dt.Rows.Count, "计算小分仓额度日志");
|
|
|
int index = 0;
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
@@ -67,7 +74,7 @@ public class ResetSmallStoreHelper
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
}
|
|
|
- // }
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|