Ver Fonte

调整分润完毕扣创客服务费逻辑

lichunlei há 3 anos atrás
pai
commit
3eef046cf5

+ 6 - 0
AppStart/Helper/SycnHelpProfitService.cs

@@ -86,6 +86,7 @@ namespace MySystem
                 decimal ProfitMoney = decimal.Parse(dr[2].ToString());
                 decimal TradeAmt = decimal.Parse(dr[3].ToString());
                 var tran = db.Database.BeginTransaction();
+                bool op = false;
                 try
                 {
                     Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
@@ -125,12 +126,17 @@ namespace MySystem
                     }).Entity;
                     db.SaveChanges();
                     tran.Commit();
+                    op = true;
                 }
                 catch (Exception ex)
                 {
                     function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步助利宝分润异常");
                     tran.Rollback();
                 }
+                if(op)
+                {
+                    RedisDbconn.Instance.AddList("UserMonthFeeQueue", UserId.ToString());
+                }
                 function.WriteLog(index.ToString(), "同步补贴数据");
             }
             OtherMySqlConn.dtable("update HelpProfitReward set Status=2 where Status=1 and TradeMonth='" + month + "'");

+ 9 - 0
AppStart/Helper/SycnProfitServiceV2.cs

@@ -110,6 +110,7 @@ namespace MySystem
                 {
                     function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
                     int index = 0;
+                    List<int> UserIds = new List<int>();
                     foreach (DataRow dr in dt.Rows)
                     {
                         index += 1;
@@ -154,6 +155,10 @@ namespace MySystem
                                 Remark = DirectFlag == 1 ? "直拓商户分润" : "品牌推广服务费",
                             }).Entity;
                             db.SaveChanges();
+                            if(!UserIds.Contains(UserId))
+                            {
+                                UserIds.Add(UserId);
+                            }
                             tran.Commit();
                         }
                         catch (Exception ex)
@@ -164,6 +169,10 @@ namespace MySystem
                         startid = int.Parse(dr["Id"].ToString());
                         function.WriteLog(index.ToString(), "同步分润数据");
                     }
+                    foreach(int UserId in UserIds)
+                    {
+                        RedisDbconn.Instance.AddList("UserMonthFeeQueue", UserId.ToString());
+                    }
                 }
                 else
                 {