lcl 2 жил өмнө
parent
commit
54fff6ad78

+ 31 - 11
AppStart/Helper/StatService.cs

@@ -1376,11 +1376,11 @@ namespace MySystem
         }
         public void CheckFluxForTrade()
         {
-            function.WriteLog(DateTime.Now.ToString(), "扫描金控交易记录中的流量费");
+            function.WriteLog(DateTime.Now.ToString(), "扫描交易记录中的流量费");
             SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
             DateTime start = DateTime.Now.AddDays(-1);
             int StartId = int.Parse(function.CheckInt(function.ReadInstance("/SycnSp/TradeRecordId.txt")));
-            var list = spdb.TradeRecord.Select(m => new { m.Id, m.CreateDate, m.ProductType, m.Status }).Where(m => m.Id >= StartId && m.Status == 2 && m.CreateDate > start && m.ProductType == "1").OrderBy(m => m.CreateDate);
+            var list = spdb.TradeRecord.Select(m => new { m.Id, m.CreateDate, m.ProductType, m.Status }).Where(m => m.Id >= StartId && m.Status == 2 && m.CreateDate > start && (m.ProductType == "1" || m.ProductType == "10")).OrderBy(m => m.CreateDate);
             foreach (var sub in list.ToList())
             {
                 try
@@ -1388,18 +1388,38 @@ namespace MySystem
                     SpModels.TradeRecord trade = spdb.TradeRecord.FirstOrDefault(m => m.Id == sub.Id);
                     if (trade != null)
                     {
-                        string content = trade.SeoDescription;
-                        if (!string.IsNullOrEmpty(content))
+                        if(trade.ProductType == "1") //金控
                         {
-                            content = System.Web.HttpUtility.UrlDecode(content);
-                            JsonData jsonObj = JsonMapper.ToObject(content);
-                            decimal terminalDataFlowFee = decimal.Parse(function.CheckNum(jsonObj["terminalDataFlowFee"].ToString()));
-                            if (terminalDataFlowFee > 0)
+                            string content = trade.SeoDescription;
+                            if (!string.IsNullOrEmpty(content))
+                            {
+                                content = System.Web.HttpUtility.UrlDecode(content);
+                                JsonData jsonObj = JsonMapper.ToObject(content);
+                                decimal terminalDataFlowFee = decimal.Parse(function.CheckNum(jsonObj["terminalDataFlowFee"].ToString()));
+                                if (terminalDataFlowFee > 0)
+                                {
+                                    spdb.TradeFluxRecord.Add(new SpModels.TradeFluxRecord()
+                                    {
+                                        SeoDescription = trade.TradeSerialNo,
+                                        FeeAmount = terminalDataFlowFee,
+                                        TradeSerialNo = function.MD5_16(trade.TradeSerialNo),
+                                        CreateDate = trade.CreateDate,
+                                        TradeSnNo = trade.TradeSnNo,
+                                        ProductType = trade.ProductType,
+                                        Status = 1,
+                                    });
+                                    spdb.SaveChanges();
+                                }
+                            }
+                        }
+                        else if(trade.ProductType == "10") //联动
+                        {
+                            if (trade.DigAmt > 0)
                             {
                                 spdb.TradeFluxRecord.Add(new SpModels.TradeFluxRecord()
                                 {
                                     SeoDescription = trade.TradeSerialNo,
-                                    FeeAmount = terminalDataFlowFee,
+                                    FeeAmount = trade.DigAmt,
                                     TradeSerialNo = function.MD5_16(trade.TradeSerialNo),
                                     CreateDate = trade.CreateDate,
                                     TradeSnNo = trade.TradeSnNo,
@@ -1415,11 +1435,11 @@ namespace MySystem
                 }
                 catch (Exception ex)
                 {
-                    function.WriteLog(DateTime.Now.ToString() + "\n$" + sub.Id + "$\n" + ex.ToString(), "扫描金控交易记录中的流量费异常");
+                    function.WriteLog(DateTime.Now.ToString() + "\n$" + sub.Id + "$\n" + ex.ToString(), "扫描交易记录中的流量费异常");
                 }
             }
             spdb.Dispose();
-            function.WriteLog(DateTime.Now.ToString() + "\n", "扫描金控交易记录中的流量费");
+            function.WriteLog(DateTime.Now.ToString() + "\n", "扫描交易记录中的流量费");
 
             doFluxRecord();
         }