|
@@ -94,6 +94,41 @@ namespace MySystem
|
|
|
|
|
|
db.Dispose();
|
|
|
}
|
|
|
+ private void DoTradeProfitUnion(int BrandId, string date, string SysUserName)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ string StartId = function.ReadInstance("/PublicParams/ProfitRewardRecordId" + date + ".txt");
|
|
|
+ if(string.IsNullOrEmpty(StartId))
|
|
|
+ {
|
|
|
+ StartId = "0";
|
|
|
+ }
|
|
|
+ CustomerSqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "',UserId,ProfitType,sum(CreditTradeProfit+TradeProfit) from ProfitRewardRecord p where Id>=" + StartId + " and CheckStatus=0 and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId", MysqlConn.connstr2);
|
|
|
+
|
|
|
+ CustomerSqlConn.op("update ProfitRewardRecord set CheckStatus=1 where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "'", MysqlConn.connstr2);
|
|
|
+
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select UserId,sum(ProfitAmount) from ProfitRecord where UserId>0 and SeoTitle='" + date + "' group by UserId", MysqlConn.connstr2);
|
|
|
+ function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
|
|
|
+ int index = 0;
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
+ {
|
|
|
+ index += 1;
|
|
|
+ int UserId = int.Parse(dr["UserId"].ToString());
|
|
|
+ decimal ProfitMoney = decimal.Parse(dr[1].ToString());
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string content = UserId + "|2|" + ProfitMoney + "|" + index;
|
|
|
+ RedisDbconn.Instance.AddList("DoTradeProfitQueue", content);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到余额异常");
|
|
|
+ }
|
|
|
+ function.WriteLog(index.ToString(), "同步分润数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
private void DoTradeProfit2(int BrandId, string date, string SysUserName)
|
|
|
{
|
|
|
// CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ProductType,ChangeType,ChangeAmount,Remark) select now() CreateDate,now() UpdateDate,UserId," + BrandId + " ProductType,301 ChangeType,ProfitAmount,(case when DirectFlag=1 then '直拓商户分润' else '品牌推广服务费' end) Remark from ProfitRecord where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0 order by Id", MysqlConn.connstr);
|
|
@@ -129,42 +164,6 @@ namespace MySystem
|
|
|
CustomerSqlConn.op("update ProfitRecord set Version=1 where SeoTitle='" + date + "' and Version=0 and UserId>0", MysqlConn.connstr);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- private void DoTradeProfitUnion(int BrandId, string date, string SysUserName)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- string StartId = function.ReadInstance("/PublicParams/ProfitRewardRecordId" + date + ".txt");
|
|
|
- if(string.IsNullOrEmpty(StartId))
|
|
|
- {
|
|
|
- StartId = "0";
|
|
|
- }
|
|
|
- CustomerSqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "',UserId,ProfitType,sum(CreditTradeProfit+TradeProfit) from ProfitRewardRecord p where Id>=" + StartId + " and CheckStatus=0 and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId", MysqlConn.connstr2);
|
|
|
-
|
|
|
- CustomerSqlConn.op("update ProfitRewardRecord set CheckStatus=1 where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "'", MysqlConn.connstr2);
|
|
|
-
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select UserId,sum(ProfitAmount) from ProfitRecord where UserId>0 and SeoTitle='" + date + "' group by UserId", MysqlConn.connstr2);
|
|
|
- function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
|
|
|
- int index = 0;
|
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- index += 1;
|
|
|
- int UserId = int.Parse(dr["UserId"].ToString());
|
|
|
- decimal ProfitMoney = decimal.Parse(dr[1].ToString());
|
|
|
- try
|
|
|
- {
|
|
|
- string content = UserId + "|2|" + ProfitMoney + "|" + index;
|
|
|
- RedisDbconn.Instance.AddList("DoTradeProfitQueue", content);
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到余额异常");
|
|
|
- }
|
|
|
- function.WriteLog(index.ToString(), "同步分润数据");
|
|
|
- }
|
|
|
-
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
private void DoTradeProfit2Union(int BrandId, string date, string SysUserName)
|
|
|
{
|
|
|
// CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ProductType,ChangeType,ChangeAmount,Remark) select now() CreateDate,now() UpdateDate,UserId," + BrandId + " ProductType,301 ChangeType,ProfitAmount,(case when DirectFlag=1 then '直拓商户分润' else '品牌推广服务费' end) Remark from ProfitRecord where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0 order by Id", MysqlConn.connstr2);
|
|
@@ -172,7 +171,7 @@ namespace MySystem
|
|
|
string start = date.Substring(0, 4) + "-" + date.Substring(4) + "-01 00:00:00";
|
|
|
string end = DateTime.Parse(start).AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
string sql = "";
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select UserId,301 ChangeType,ProfitAmount,(case when DirectFlag=1 then '直拓商户分润' else '品牌推广服务费' end) Remark from ProfitRecord where SeoTitle='" + date + "' and Version=0 and UserId>0 order by Id", MysqlConn.connstr2);
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select UserId,301 ChangeType,ProfitAmount,(case when DirectFlag=1 then '直拓商户分润(银联)' else '品牌推广服务费(银联)' end) Remark from ProfitRecord where SeoTitle='" + date + "' and Version=0 and UserId>0 order by Id", MysqlConn.connstr2);
|
|
|
int num = 0;
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
{
|