Jelajahi Sumber

增加批量解析退款日志,并退款功能,自用

lichunlei 1 tahun lalu
induk
melakukan
31fb318a51
1 mengubah file dengan 43 tambahan dan 0 penghapusan
  1. 43 0
      Util/HaoDa/TestHaoDaService.cs

+ 43 - 0
Util/HaoDa/TestHaoDaService.cs

@@ -493,5 +493,48 @@ namespace MySystem
             // ZBankNo
             db.Dispose();
         }
+    
+    
+    
+    
+    
+    
+    
+    
+        public void refund()
+        {
+            Thread th = new Thread(refunddo);
+            th.IsBackground = true;
+            th.Start();
+        }
+        public void refunddo()
+        {
+            for(int month = 10; month <= 11; month ++)
+            {
+                for(int day = 1; day <= 31; day ++)
+                {
+                    string content = function.ReadInstance("/log/好哒聚合支付退款/2023/" + month + "/" + day + "/content.log");
+                    if(!string.IsNullOrEmpty(content))
+                    {
+                        content = content.Replace("\n\n\n", "####");
+                        content = content.Replace("\n", "");
+                        content = content.Replace("####", "\n");
+                        MatchCollection mc = Regex.Matches(content, "请求参数.*?退款次数超出限制");
+                        foreach(Match m in mc)
+                        {
+                            string mchtNo = Regex.Match(m.Value, "\"mchtNo\":\".*?\"").Value.Replace("\"mchtNo\":\"", "").Replace("\"", "");
+                            string storeNo = Regex.Match(m.Value, "\"storeNo\":\".*?\"").Value.Replace("\"storeNo\":\"", "").Replace("\"", "");
+                            string outOrderNo = Regex.Match(m.Value, "\"outOrderNo\":\".*?\"").Value.Replace("\"outOrderNo\":\"", "").Replace("\"", "");
+                            string refundAmount = Regex.Match(m.Value, "\"refundAmount\":\".*?\"").Value.Replace("\"refundAmount\":\"", "").Replace("\"", "");                
+                            function.WriteLog("mchtNo:" + mchtNo + ";storeNo:" + storeNo + ";outOrderNo:" + outOrderNo + ";refundAmount:" + refundAmount + ";", "补充退款日志");
+                            var info = HaoDaHelper.Instance.AggregatedPayRefund(mchtNo, storeNo, "HDTK" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), outOrderNo, refundAmount);
+                            function.WriteLog(info + "\n\n", "补充退款日志");
+                            Thread.Sleep(1000);
+                        }
+                    }
+                }
+            }
+        }
+    
     }
 }