|
@@ -39,19 +39,10 @@ namespace MySystem
|
|
|
if (OpType == 0)
|
|
|
{
|
|
|
DoTradeProfit(BrandId, date, SysUserName);
|
|
|
- DoSubsidyProfit(BrandId, date);
|
|
|
}
|
|
|
else if (OpType == 1)
|
|
|
{
|
|
|
DoTradeProfit2(BrandId, date, SysUserName);
|
|
|
- DoSubsidyProfit2(BrandId, date);
|
|
|
- if(BrandId == 1)
|
|
|
- {
|
|
|
- DoUserProfit(date);
|
|
|
- DoUserServiceFee();
|
|
|
- //扣过期机具费
|
|
|
- // RedisDbconn.Instance.AddList("DoChargeAmountQueue", "0");
|
|
|
- }
|
|
|
}
|
|
|
function.WriteLog(DateTime.Now.ToString() + "\r\n\r\n", "同步分润数据");
|
|
|
}
|
|
@@ -76,7 +67,8 @@ namespace MySystem
|
|
|
{
|
|
|
StartId = "0";
|
|
|
}
|
|
|
- OtherMySqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,ParentNav,BrandId,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "',(select ParentNav from Users where Id=p.UserId)," + BrandId + ",UserId,ProfitType,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord p where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId");
|
|
|
+ OtherMySqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,BrandId,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "'," + BrandId + ",UserId,ProfitType,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord p where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId");
|
|
|
+
|
|
|
DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId");
|
|
|
function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
|
|
|
int index = 0;
|
|
@@ -106,329 +98,32 @@ namespace MySystem
|
|
|
}
|
|
|
private void DoTradeProfit2(int BrandId, string date, string SysUserName)
|
|
|
{
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ProductType,ChangeType,ChangeAmount,BeforeTotalAmount,AfterTotalAmount,BeforeFreezeAmount,AfterFreezeAmount,BeforeBalanceAmount,AfterBalanceAmount,Remark) select tb.CreateDate,tb.UpdateDate,tb.UserId,ProductType,ChangeType,ProfitAmount,a.TotalAmount BeforeTotalAmount,a.TotalAmount+ProfitAmount AfterTotalAmount,a.FreezeAmount BeforeFreezeAmount,a.FreezeAmount AfterFreezeAmount,a.BalanceAmount BeforeBalanceAmount,a.BalanceAmount+ProfitAmount AfterBalanceAmount,Remark from (select now() CreateDate,now() UpdateDate,UserId," + BrandId + " ProductType,1 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) tb left join UserAccount a on tb.UserId=a.Id", conn);
|
|
|
-
|
|
|
- CustomerSqlConn.op("update ProfitRecord set Version=1 where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0", conn);
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //分润补贴
|
|
|
- private void DoSubsidyProfit(int BrandId, string date)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- string StartId = function.ReadInstance("/PublicParams/ProfitSubsidyDetailId" + date + ".txt");
|
|
|
- if(string.IsNullOrEmpty(StartId))
|
|
|
- {
|
|
|
- StartId = "0";
|
|
|
- }
|
|
|
-
|
|
|
- CustomerSqlConn.op("insert into SubsidyRecord (CreateDate,SeoKeyword,SeoTitle,ParentNav,BrandId,UserId,ProfitAmount) select now(),'root','" + date + "',(select ParentNav from Users where Id=p.SubsidyUserId)," + BrandId + ",SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail p where Id>=" + StartId + " and Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId", conn);
|
|
|
-
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail where Id>=" + StartId + " and Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId", conn);
|
|
|
- function.WriteLog("补贴:" + BrandId + ":" + dt.Rows.Count, "同步补贴数据");
|
|
|
- int index = 0;
|
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- index += 1;
|
|
|
- int UserId = int.Parse(dr["SubsidyUserId"].ToString());
|
|
|
- decimal ProfitMoney = decimal.Parse(dr[1].ToString());
|
|
|
- try
|
|
|
- {
|
|
|
- string content = UserId + "|" + BrandId + "|" + ProfitMoney + "|" + index;
|
|
|
- RedisDbconn.Instance.AddList("DoSubsidyProfitQueue", content);
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到补贴异常");
|
|
|
- }
|
|
|
- }
|
|
|
- CustomerSqlConn.op("update ProfitSubsidyDetail set Status=1 where Id>=" + StartId + " and Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "'", conn);
|
|
|
-
|
|
|
- db.Dispose();
|
|
|
- dt.Dispose();
|
|
|
-
|
|
|
- RedisDbconn.Instance.AddList("DoSubsidyProfitQueue", "end");
|
|
|
- SycnProfitServiceV2.Instance.StartSubsidy();
|
|
|
- }
|
|
|
-
|
|
|
- private void DoSubsidyProfit2(int BrandId, string date)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ProductType,ChangeType,ChangeAmount,BeforeTotalAmount,AfterTotalAmount,BeforeFreezeAmount,AfterFreezeAmount,BeforeBalanceAmount,AfterBalanceAmount,Remark) select tb.CreateDate,tb.UpdateDate,tb.UserId,ProductType,ChangeType,ProfitAmount,a.TotalAmount BeforeTotalAmount,a.TotalAmount+ProfitAmount AfterTotalAmount,a.FreezeAmount BeforeFreezeAmount,a.FreezeAmount AfterFreezeAmount,a.BalanceAmount BeforeBalanceAmount,a.BalanceAmount+ProfitAmount AfterBalanceAmount,Remark from (select now() CreateDate,now() UpdateDate,UserId," + BrandId + " ProductType,111 ChangeType,ProfitAmount,'直拓商户补贴' Remark from SubsidyRecord where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Status=0 and UserId>0 order by Id) tb left join UserAccount a on tb.UserId=a.Id", conn);
|
|
|
-
|
|
|
- CustomerSqlConn.op("update SubsidyRecord set Status=1 where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Status=0 and UserId>0", conn);
|
|
|
-
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- #region 助力宝分润展示
|
|
|
-
|
|
|
- public void DoHelpProfit(string month)
|
|
|
- {
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
- CustomerSqlConn.dtable("update HelpProfitReward set Status=1 where Status=0 and TradeMonth='" + month + "'", conn);
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 助力宝分润到账
|
|
|
-
|
|
|
- public void DoHelpProfit2(string month)
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select UserId,RewardType,sum(CreditRewardAmount),sum(CreditTradeAmt) from HelpProfitReward where Status=1 and TradeMonth='" + month + "' GROUP BY UserId,RewardType", conn);
|
|
|
- function.WriteLog("数量:" + dt.Rows.Count, "同步助力宝分润数据");
|
|
|
- int index = 0;
|
|
|
- foreach (DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- index += 1;
|
|
|
- int UserId = int.Parse(dr["UserId"].ToString());
|
|
|
- int RewardType = int.Parse(dr["RewardType"].ToString());
|
|
|
- decimal ProfitMoney = decimal.Parse(dr[2].ToString());
|
|
|
- decimal TradeAmt = decimal.Parse(dr[3].ToString());
|
|
|
- var tran = db.Database.BeginTransaction();
|
|
|
- try
|
|
|
- {
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
- UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
|
- if (account == null)
|
|
|
- {
|
|
|
- account = db.UserAccount.Add(new UserAccount()
|
|
|
- {
|
|
|
- Id = UserId,
|
|
|
- UserId = UserId,
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
- decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
- decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
- account.BalanceAmount += ProfitMoney;
|
|
|
- account.TotalAmount += ProfitMoney;
|
|
|
- decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
- decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
- decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
- UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UpdateDate = DateTime.Now,
|
|
|
- UserId = UserId, //创客
|
|
|
- ProductType = 101,
|
|
|
- ChangeType = RewardType, //变动类型
|
|
|
- ChangeAmount = ProfitMoney, //变更金额
|
|
|
- BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
- AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
- BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
- AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
- BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
- AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
- Remark = user.RealName.Substring(0, 1) + "**:" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "交易" + TradeAmt.ToString("f2"),
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- tran.Commit();
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步助利宝分润异常");
|
|
|
- tran.Rollback();
|
|
|
- }
|
|
|
- function.WriteLog(index.ToString(), "同步补贴数据");
|
|
|
- }
|
|
|
- OtherMySqlConn.dtable("update HelpProfitReward set Status=2 where Status=1 and TradeMonth='" + month + "'");
|
|
|
-
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 分润结果临时数据
|
|
|
-
|
|
|
- private void DoUserProfit(string date)
|
|
|
- {
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- CustomerSqlConn.op("delete from UserProfit;insert into UserProfit (Id,UserId,ProfitRate) select UserId,UserId,sum(ProfitAmount) from (select UserId,ProfitAmount from ProfitRecord where SeoTitle='" + date + "' and Version=1 and UserId>0 union all select UserId,ProfitAmount from SubsidyRecord where SeoTitle='" + date + "' and Status=1 and UserId>0) tb group by UserId", conn);
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ProductType,ChangeType,ChangeAmount,Remark) select now() CreateDate,now() UpdateDate,UserId," + BrandId + " ProductType,1 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);
|
|
|
|
|
|
- #region 扣创客服务费
|
|
|
+ CustomerSqlConn.op("update ProfitRecord set Version=1 where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0", MysqlConn.connstr);
|
|
|
|
|
|
- private void DoUserServiceFee()
|
|
|
- {
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- CustomerSqlConn.op("insert into UserAccount (Id,UserId) select Id,Id from UserProfit where Id not in (select Id from UserAccount)", conn);
|
|
|
-
|
|
|
- CustomerSqlConn.op("update UserAccount a set BalanceAmount=BalanceAmount+(select ProfitRate from UserProfit where Id=a.Id),TotalAmount=TotalAmount+(select ProfitRate from UserProfit where Id=a.Id) where Id in (select Id from UserProfit)", conn);
|
|
|
-
|
|
|
- string Month = DateTime.Now.AddDays(-90).ToString("yyyy-MM");
|
|
|
-
|
|
|
- CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ChangeType,ChangeAmount,BeforeTotalAmount,AfterTotalAmount,BeforeFreezeAmount,AfterFreezeAmount,BeforeBalanceAmount,AfterBalanceAmount) select now(),now(),Id,125,BalanceAmount,TotalAmount BeforeTotalAmount,TotalAmount AfterTotalAmount,FreezeAmount,FreezeAmount,BalanceAmount BeforeBalanceAmount,BalanceAmount-BalanceAmount AfterBalanceAmount from UserAccount where Id in (select Id from Users where AuthFlag=1 and AuthDate<'" + Month + "-01 00:00:00') and BalanceAmount>0 and BalanceAmount<10", conn);
|
|
|
-
|
|
|
- CustomerSqlConn.op("insert into UserAccountRecord (CreateDate,UpdateDate,UserId,ChangeType,ChangeAmount,BeforeTotalAmount,AfterTotalAmount,BeforeFreezeAmount,AfterFreezeAmount,BeforeBalanceAmount,AfterBalanceAmount) select now(),now(),Id,125,10,TotalAmount BeforeTotalAmount,TotalAmount AfterTotalAmount,FreezeAmount,FreezeAmount,BalanceAmount BeforeBalanceAmount,BalanceAmount-10 AfterBalanceAmount from UserAccount where Id in (select Id from Users where AuthFlag=1 and AuthDate<'" + Month + "-01 00:00:00') and BalanceAmount>=10;", conn);
|
|
|
-
|
|
|
- CustomerSqlConn.op("update UserAccount a set BalanceAmount=0 where Id in (select Id from Users where AuthFlag=1 and AuthDate<'" + Month + "-01 00:00:00') and BalanceAmount>0 and BalanceAmount<10", conn);
|
|
|
-
|
|
|
- CustomerSqlConn.op("update UserAccount a set BalanceAmount=BalanceAmount-10 where Id in (select Id from Users where AuthFlag=1 and AuthDate<'" + Month + "-01 00:00:00') and BalanceAmount>=10", conn);
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 扣过期机具费
|
|
|
-
|
|
|
- private void DoExpiredPosFee()
|
|
|
- {
|
|
|
- string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
-
|
|
|
- string checck = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00").AddDays(-60).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
- DataTable dt = CustomerSqlConn.dtable("select DISTINCT BuyUserId from PosMachinesTwo where RecycEndDate<'" + checck + "' and Status>-1 and BindingState=0 and ScanQrTrade<999", conn);
|
|
|
+ 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,sum(ChangeAmount) from UserAccountRecord where CreateDate>='" + start + "' and CreateDate<'" + end + "' group by UserId", MysqlConn.connstr);
|
|
|
+ int num = 0;
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
{
|
|
|
- RedisDbconn.Instance.AddList("PosExpiredPayQueue", dr["BuyUserId"].ToString());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public void StartProfit()
|
|
|
- {
|
|
|
- Thread th = new Thread(StartProfitDo);
|
|
|
- th.IsBackground = true;
|
|
|
- th.Start();
|
|
|
- }
|
|
|
-
|
|
|
- public void StartProfitDo()
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- bool op = true;
|
|
|
- while (op)
|
|
|
- {
|
|
|
- string content = RedisDbconn.Instance.RPop<string>("DoTradeProfitQueue");
|
|
|
- if (!string.IsNullOrEmpty(content))
|
|
|
+ num += 1;
|
|
|
+ sql += "update UserAccount set BalanceAmount=BalanceAmount+" + dr[1].ToString() + ",TotalAmount=TotalAmount+" + dr[1].ToString() + " where Id=" + dr["UserId"].ToString() + ";";
|
|
|
+ if(num >= 20)
|
|
|
{
|
|
|
- if(content == "end")
|
|
|
- {
|
|
|
- op = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- string[] data = content.Split('|');
|
|
|
- int UserId = int.Parse(data[0]);
|
|
|
- int BrandId = int.Parse(data[1]);
|
|
|
- decimal ProfitMoney = decimal.Parse(data[2]);
|
|
|
- int index = int.Parse(data[3]);
|
|
|
-
|
|
|
- string IdBrand = UserId + "_" + BrandId;
|
|
|
- UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
- if (MachineData == null)
|
|
|
- {
|
|
|
- MachineData = db.UserMachineData.Add(new UserMachineData()
|
|
|
- {
|
|
|
- IdBrand = IdBrand,
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- MachineData.TradeProfit += ProfitMoney;
|
|
|
- db.SaveChanges();
|
|
|
-
|
|
|
- function.WriteLog(index.ToString() + "--" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "同步分润队列数据");
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "同步分润队列数据异常");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Thread.Sleep(1000);
|
|
|
+ CustomerSqlConn.op(sql, MysqlConn.kxsconnstr);
|
|
|
+ num = 0;
|
|
|
+ sql = "";
|
|
|
}
|
|
|
}
|
|
|
- db.Dispose();
|
|
|
- }
|
|
|
-
|
|
|
- public void StartSubsidy()
|
|
|
- {
|
|
|
- Thread th = new Thread(StartSubsidyDo);
|
|
|
- th.IsBackground = true;
|
|
|
- th.Start();
|
|
|
- }
|
|
|
-
|
|
|
- public void StartSubsidyDo()
|
|
|
- {
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- bool op = true;
|
|
|
- while (op)
|
|
|
+ if(!string.IsNullOrEmpty(sql))
|
|
|
{
|
|
|
- string content = RedisDbconn.Instance.RPop<string>("DoSubsidyProfitQueue");
|
|
|
- if (!string.IsNullOrEmpty(content))
|
|
|
- {
|
|
|
- if(content == "end")
|
|
|
- {
|
|
|
- op = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- string[] data = content.Split('|');
|
|
|
- int UserId = int.Parse(data[0]);
|
|
|
- int BrandId = int.Parse(data[1]);
|
|
|
- decimal ProfitMoney = decimal.Parse(data[2]);
|
|
|
- int index = int.Parse(data[3]);
|
|
|
-
|
|
|
- string IdBrand = UserId + "_" + BrandId;
|
|
|
- UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
- if (MachineData == null)
|
|
|
- {
|
|
|
- MachineData = db.UserMachineData.Add(new UserMachineData()
|
|
|
- {
|
|
|
- IdBrand = IdBrand,
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- MachineData.OtherProfit += ProfitMoney;
|
|
|
- db.SaveChanges();
|
|
|
-
|
|
|
- function.WriteLog(index.ToString() + "--" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "同步补贴队列数据");
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "同步补贴队列数据异常");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Thread.Sleep(1000);
|
|
|
- }
|
|
|
+ CustomerSqlConn.op(sql, MysqlConn.kxsconnstr);
|
|
|
}
|
|
|
- db.Dispose();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
#region
|
|
|
private bool CheckUser(WebCMSEntities db, int Id)
|
|
|
{
|