Просмотр исходного кода

修复好哒认证状态获取流程

lichunlei 1 год назад
Родитель
Сommit
9bb4a5c461

+ 27 - 27
Util/HaoDa/HaoDaAuthQueryHelper.cs

@@ -9,6 +9,7 @@ using MySystem.Models;
 using LitJson;
 using Library;
 using MySystem.Models.Main;
+using System.Data;
 
 public class HaoDaAuthQueryHelper
 {
@@ -28,16 +29,13 @@ public class HaoDaAuthQueryHelper
     {
         while (true)
         {
-            string content = RedisDbconn.Instance.RPop<string>("HaoDaAuthQueryHelper");
-            if (!string.IsNullOrEmpty(content))
+            DataTable dt = CustomerSqlConn.dtable("select Id,OutMchtNo,StoreNo from MerchantAddInfo where HdStatus=3 and OutMchtNo is not null and StoreNo is not null and ((`Status`=1 and WeChatMerchantId is null) or (`QueryCount`=1 and AliMerchantId is null)) order by Id desc", AppConfig.Base.SqlConnStr);
+            foreach(DataRow dr in dt.Rows)
             {
-                JsonData json = JsonMapper.ToObject(content);
-                QueryAuthStatus(json["MerchantId"].ToString(), json["MchtNo"].ToString(), json["StoreNo"].ToString());
-            }
-            else
-            {
-                Thread.Sleep(10000);
+                QueryAuthStatus(dr["Id"].ToString(), dr["OutMchtNo"].ToString(), dr["StoreNo"].ToString());
+                Thread.Sleep(2000);
             }
+            Thread.Sleep(10000);
         }
     }
 
@@ -52,27 +50,29 @@ public class HaoDaAuthQueryHelper
             {
                 WebCMSEntities db = new WebCMSEntities();
                 MerchantAddInfo info = db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
-                MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+                // MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
                 var wxcheck = jsonObj["wechatVerifyState"].ToString();
                 var alicheck = jsonObj["aliVerifyState"].ToString();
-                if (wxcheck == "1")
-                {
-                    info.Status = 2;
-                    info.WeChatMerchantId = jsonObj["wechatMerchantId"].ToString();
-                    merchant.Status = 2;
-                    info.WeChatRemark = "";
-                }
-                if (alicheck == "1")
-                {
-                    info.QueryCount = 2;
-                    info.AliMerchantId = jsonObj["aliMerchantId"].ToString();
-                    merchant.QueryCount = 2;
-                    info.AlipayRemark = "";
-                }
-                if (wxcheck != "1" || alicheck != "1")
-                {
-                    RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + MerchantId + "\",\"MchtNo\":\"" + info.OutMchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
-                }
+                info.WeChatMerchantId = jsonObj["wechatMerchantId"].ToString();
+                info.AliMerchantId = jsonObj["aliMerchantId"].ToString();
+                // if (wxcheck == "1")
+                // {
+                //     info.Status = 2;
+                //     info.WeChatMerchantId = jsonObj["wechatMerchantId"].ToString();
+                //     merchant.Status = 2;
+                //     info.WeChatRemark = "";
+                // }
+                // if (alicheck == "1")
+                // {
+                //     info.QueryCount = 2;
+                //     info.AliMerchantId = jsonObj["aliMerchantId"].ToString();
+                //     merchant.QueryCount = 2;
+                //     info.AlipayRemark = "";
+                // }
+                // if (wxcheck != "1" || alicheck != "1")
+                // {
+                //     RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + MerchantId + "\",\"MchtNo\":\"" + info.OutMchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
+                // }
 
                 db.SaveChanges();
             }

+ 2 - 2
Util/HaoDa/HaoDaExtQueryHelper.cs

@@ -68,7 +68,7 @@ public class HaoDaExtQueryHelper
                 info.WeChatRemark = "";
                 info.WeChatSignUrl = jsonObj["qrcode_data"].ToString();
                 db.SaveChanges();
-                RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
+                // RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
                 LogHelper.Instance.WriteLog("startsend", "查询微信商户意愿申请状态");
             }
             else if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_REJECTED")
@@ -162,7 +162,7 @@ public class HaoDaExtQueryHelper
                     info.AlipayRemark = "";
                     info.AlipaySignUrl = jsonObj["alipay_merchant_indirect_authorder_querystatus_response"]["qr_code"].ToString();
                     db.SaveChanges();
-                    RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
+                    // RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
                     LogHelper.Instance.WriteLog("start1end", "查询支付宝商户意愿申请状态");
                 }
                 else if (order_status == "AUDIT_FREEZE")

+ 5 - 5
Util/HaoDa/TestHaoDaService.cs

@@ -35,12 +35,12 @@ namespace MySystem
             // WeChatAddInfo(826);//提交微信开户意愿申请单
             // WeChatAddInfo(825,"2000002424428809");//查询微信开户意愿申请状态
             // QueryMerchantStatus(832);//新建商户查询状态
-            // QueryAuthStatus(827);//查询实名认证状态
             // ConfiemMer(808);//新建商户
             // ChangeMerchantCard(1);//商户修改银行卡
             // AddOpenDivideAccounts(832); //添加分账方
-            // WeChatFunctionForHD.Instance.QueryAuthMerchant("599626767");
-            // AlipayFunctionForHD.Instance.AuthOrderAuthQuery("2088820527237169");
+            QueryAuthStatus(5);//查询实名认证状态
+            // WeChatFunctionForHD.Instance.QueryAuthMerchant("600955391");
+            // AlipayFunctionForHD.Instance.AuthOrderAuthQuery("2088820718243322");
         }
 
         //新建商户查询状态
@@ -131,7 +131,7 @@ namespace MySystem
                         info.AlipayRemark = "";
                         info.AlipaySignUrl = jsonObj["alipay_merchant_indirect_authorder_querystatus_response"]["qr_code"].ToString();
                         db.SaveChanges();
-                        RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
+                        // RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
                         LogHelper.Instance.WriteLog("start1end", "查询支付宝商户意愿申请状态");
                     }
                     else if (order_status == "AUDIT_REJECT" || order_status == "AUDIT_FREEZE")
@@ -247,7 +247,7 @@ namespace MySystem
                     info.WeChatRemark = "";
                     info.WeChatSignUrl = jsonObj["qrcode_data"].ToString();
                     db.SaveChanges();
-                    RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
+                    // RedisDbconn.Instance.AddList("HaoDaAuthQueryHelper", "{\"MerchantId\":\"" + Id + "\",\"MchtNo\":\"" + info.MchtNo + "\",\"StoreNo\":\"" + info.StoreNo + "\"}");
                 }
                 else if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_REJECTED")
                 {