DuGuYang 11 달 전
부모
커밋
dbed7cf2ec

+ 10 - 10
Util/HaoDa/HaoDaExtQueryAuthHelper.cs

@@ -68,11 +68,11 @@ public class HaoDaExtQueryAuthHelper
                     MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
                     info.Status = 2;
                     merchant.Status = 2;
-                    // if (merchant.Latitude == 0)
-                    // {
-                    //     //签约成功调用腾讯地图接口获取地址
-                    //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                    // }
+                    if (merchant.Latitude == 0)
+                    {
+                        //签约成功调用腾讯地图接口获取地址
+                        RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                    }
                     db.SaveChanges();
                     LogHelper.Instance.WriteLog("startsend", "获取微信商户开户意愿确认状态");
                 }
@@ -148,11 +148,11 @@ public class HaoDaExtQueryAuthHelper
                     merchant.QueryCount = 2;
                     db.SaveChanges();
                     LogHelper.Instance.WriteLog("start1end", "获取支付宝商家认证状态");
-                    // if (merchant.Latitude == 0)
-                    // {
-                    //     //签约成功调用腾讯地图接口获取地址
-                    //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                    // }
+                    if (merchant.Latitude == 0)
+                    {
+                        //签约成功调用腾讯地图接口获取地址
+                        RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                    }
                 }
                 // else
                 // {

+ 10 - 10
Util/HaoDa/HaoDaExtQueryHelper.cs

@@ -89,11 +89,11 @@ public class HaoDaExtQueryHelper
                 merchant.Status = 2;
                 info.WeChatRemark = "";
                 LogHelper.Instance.WriteLog("start1end", "查询微信商户意愿申请状态");
-                // if (merchant.Latitude == 0)
-                // {
-                //     //签约成功调用腾讯地图接口获取地址
-                //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                // }
+                if (merchant.Latitude == 0)
+                {
+                    //签约成功调用腾讯地图接口获取地址
+                    RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                }
                 db.SaveChanges();
             }
             // else
@@ -208,11 +208,11 @@ public class HaoDaExtQueryHelper
                     merchant.QueryCount = 2;
                     info.AlipayRemark = "";
                     LogHelper.Instance.WriteLog("start2end", "查询支付宝商户意愿申请状态");
-                    // if (merchant.Latitude == 0)
-                    // {
-                    //     //签约成功调用腾讯地图接口获取地址
-                    //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                    // }
+                    if (merchant.Latitude == 0)
+                    {
+                        //签约成功调用腾讯地图接口获取地址
+                        RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                    }
                     db.SaveChanges();
                 }
                 // else

+ 31 - 9
Util/HaoDa/Tencent/GetTencentAddressInfoService.cs

@@ -6,6 +6,7 @@ using System.Threading;
 using MySystem.Models;
 using Library;
 using LitJson;
+using MySystem.Models.Main;
 
 namespace MySystem
 {
@@ -29,19 +30,40 @@ namespace MySystem
         {
             while (true)
             {
-                try
+                string data = RedisDbconn.Instance.RPop<string>("GetTencentAddressInfoQueue");
+                if (!string.IsNullOrEmpty(data))
                 {
-                    string data = RedisDbconn.Instance.RPop<string>("GetTencentAddressInfoQueue");
-                    JsonData jsonObj = JsonMapper.ToObject(data);
-                    string Address = jsonObj["Data"]["Address"].ToString();
-                    string Key = Library.ConfigurationManager.AppSettings["TencentKey"].ToString();
-                    var info = function.GetWebRequest("https://apis.map.qq.com/ws/geocoder/v1/?address=" + Address + "&key=" + Key);
+                    try
+                    {
+                        JsonData jsonObj = JsonMapper.ToObject(data);
+                        int Id = int.Parse(jsonObj["Data"]["MerchantId"].ToString());
+                        string Address = jsonObj["Data"]["Address"].ToString();
+                        string Key = Library.ConfigurationManager.AppSettings["TencentKey"].ToString();
+                        var info = function.GetWebRequest("https://apis.map.qq.com/ws/geocoder/v1/?address=" + Address + "&key=" + Key);
+                        JsonData result = JsonMapper.ToObject(info);
+                        //创建成功
+                        if (result["status"].ToString() == "0")
+                        {
+                            WebCMSEntities db = new WebCMSEntities();
+                            var merInfo = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+                            if (merInfo.Id > 0)
+                            {
+                                merInfo.Longitude = decimal.Parse(result["result"]["location"]["lng"].ToString());
+                                merInfo.Latitude = decimal.Parse(result["result"]["location"]["lat"].ToString());
+                                db.SaveChanges();
+                                db.Dispose();
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取腾讯地图地址线程异常");
+                    }
                 }
-                catch (Exception ex)
+                else
                 {
-                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取腾讯地图地址线程异常");
+                    Thread.Sleep(60000);
                 }
-                Thread.Sleep(100000);
             }
         }
     }

+ 23 - 23
Util/HaoDa/TestHaoDaService.cs

@@ -46,7 +46,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 +175,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 +186,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;
                             }
@@ -313,11 +313,11 @@ namespace MySystem
                         merchant.QueryCount = 2;
                         info.AlipayRemark = "";
                         LogHelper.Instance.WriteLog("start2end", "查询支付宝商户意愿申请状态");
-                        // if (merchant.Latitude == 0)
-                        // {
-                        //     //签约成功调用腾讯地图接口获取地址
-                        //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                        // }
+                        if (merchant.Latitude == 0)
+                        {
+                            //签约成功调用腾讯地图接口获取地址
+                            RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                        }
                         db.SaveChanges();
                     }
                     // else
@@ -394,7 +394,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 +593,14 @@ namespace MySystem
             // ZBankNo
             db.Dispose();
         }
-    
-    
-    
-    
-    
-    
-    
-    
+
+
+
+
+
+
+
+
         public void refund()
         {
             Thread th = new Thread(refunddo);
@@ -609,23 +609,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 +635,6 @@ namespace MySystem
                 }
             }
         }
-    
+
     }
 }

+ 10 - 10
Util/HaoDa/WeChatPayBackService.cs

@@ -85,22 +85,22 @@ namespace MySystem
                         addinfo.Status = 2;
                         merchant.Status = 2;
                         addinfo.WeChatRemark = "";
-                        // if (merchant.Latitude == 0)
-                        // {
-                        //     //签约成功调用腾讯地图接口获取地址
-                        //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                        // }
+                        if (merchant.Latitude == 0)
+                        {
+                            //签约成功调用腾讯地图接口获取地址
+                            RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                        }
                     }
                     else if (addinfo.QueryCount == 1 && order.PayMode == 1)
                     {
                         addinfo.QueryCount = 2;
                         merchant.QueryCount = 2;
                         addinfo.AlipayRemark = "";
-                        // if (merchant.Latitude == 0)
-                        // {
-                        //     //签约成功调用腾讯地图接口获取地址
-                        //     RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
-                        // }
+                        if (merchant.Latitude == 0)
+                        {
+                            //签约成功调用腾讯地图接口获取地址
+                            RedisDbconn.Instance.AddList("GetTencentAddressInfoQueue", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
+                        }
                     }
                     order.UserId = merchant.UserId;
                     LogHelper.Instance.WriteLog("创客:" + merchant.UserId, "微信支付回调监控");