DuGuYang 11 months ago
parent
commit
e4d1dde5ee
1 changed files with 33 additions and 18 deletions
  1. 33 18
      Util/HaoDa/TestHaoDaService.cs

+ 33 - 18
Util/HaoDa/TestHaoDaService.cs

@@ -36,6 +36,7 @@ namespace MySystem
             // WeChatAddInfo(825,"2000002424428809");//查询微信开户意愿申请状态
             // ConfiemMer(1833);//新建商户
             // QueryMerchantStatus(1833);//新建商户查询状态
+            GetTencentAddressInfo(112); //获取商户经纬坐标
             // ChangeMerchantCard(1);//商户修改银行卡
             // AddOpenDivideAccounts(832); //添加分账方
             // QueryAuthStatus(1845);//查询实名认证状态
@@ -46,7 +47,7 @@ namespace MySystem
 
             // HaoDaHelper.Instance.OrderDivideAccountsQuery("FZ2023110315225748140470708", "1492500"); //查询分账结果
             // WebCMSEntities db = new WebCMSEntities();
-            
+
             // List<int> ids = new List<int>();
             // foreach(int id in ids)
             // {
@@ -175,7 +176,7 @@ namespace MySystem
                             int Status = 2;
                             MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantInfo();
                             MerchantParamSet set = db.MerchantParamSet.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantParamSet();
-                            
+
                             MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
                             //发起分账
                             string applyNo = "FZ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //批次号
@@ -186,7 +187,7 @@ namespace MySystem
                             string acctType = "0"; //账户类型(0:商户收款账户(大B),1:分账接收方账户(小B))
                             decimal amount = order.PayMoney * (1M - 0.0038M) * 100;
                             string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amount.ToString().Split('.')[0], "0"));
-                            if(result.Contains("\"resultCode\":\"0\"") && result.Contains("分账金额不足"))
+                            if (result.Contains("\"resultCode\":\"0\"") && result.Contains("分账金额不足"))
                             {
                                 Status = 1;
                             }
@@ -394,7 +395,7 @@ namespace MySystem
                 WebCMSEntities db = new WebCMSEntities();
                 MerchantAddInfo info = db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
                 string result = WeChatFunctionForHD.Instance.QueryMerchant(ApplymentId);
-                
+
                 Dictionary<string, object> reqdic = new Dictionary<string, object>();
                 reqdic.Add("Id", Id); // 商户Id
                 reqdic.Add("ApplymentId", ApplymentId); // 商户Id
@@ -593,14 +594,28 @@ namespace MySystem
             // ZBankNo
             db.Dispose();
         }
-    
-    
-    
-    
-    
-    
-    
-    
+
+        //获取商户经纬坐标
+        public void GetTencentAddressInfo(int MerchantId)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId);
+            string Address = merchant.Areas + merchant.Address;
+            string Key = Library.ConfigurationManager.AppSettings["TencentKey"].ToString();
+            LogHelper.Instance.WriteLog("商户Id\n" + MerchantId + "\n\n", "获取商户经纬坐标");
+            LogHelper.Instance.WriteLog("请求参数\n" + Address + "\n\n", "获取商户经纬坐标");
+            var info = function.GetWebRequest("https://apis.map.qq.com/ws/geocoder/v1/?address=" + Address + "&key=" + Key);
+            LogHelper.Instance.WriteLog("返回\n" + info + "\n\n", "获取商户经纬坐标");
+            db.Dispose();
+        }
+
+
+
+
+
+
+
+
         public void refund()
         {
             Thread th = new Thread(refunddo);
@@ -609,23 +624,23 @@ namespace MySystem
         }
         public void refunddo()
         {
-            for(int month = 10; month <= 11; month ++)
+            for (int month = 10; month <= 11; month++)
             {
-                for(int day = 1; day <= 31; day ++)
+                for (int day = 1; day <= 31; day++)
                 {
                     string content = function.ReadInstance("/log/好哒聚合支付退款/2023/" + month + "/" + day + "/content.log");
-                    if(!string.IsNullOrEmpty(content))
+                    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)
+                        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("\"", "");                
+                            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", "补充退款日志");
@@ -635,6 +650,6 @@ namespace MySystem
                 }
             }
         }
-    
+
     }
 }