Bladeren bron

盛付通0押金需要先请求换绑接口

lcl 11 maanden geleden
bovenliggende
commit
b10ae40479
3 gewijzigde bestanden met toevoegingen van 39 en 7 verwijderingen
  1. 5 0
      AppStart/Helper/ChangePosFeeUtil.cs
  2. 24 0
      AppStart/Helper/PublicImportDataService.cs
  3. 10 7
      Controllers/HomeController.cs

+ 5 - 0
AppStart/Helper/ChangePosFeeUtil.cs

@@ -297,6 +297,11 @@ namespace MySystem
                 function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + DepositId, "盛付通-设置押金-返回报文");
                 string DepositIdString = DepositId;
                 if(DepositIdString == "0") DepositIdString = "000";
+                if(DepositId == "0")
+                {
+                    PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
+                    PublicImportDataService.Instance.SftSnBindOrUnbind(pos.PosSn, merchant.KqMerNo);
+                }
                 string content = PublicImportDataService.Instance.SetDepositForSft(pos.PosSn, "2024POS" + DepositIdString);
                 function.WriteLog(DateTime.Now.ToString() + "\n" + content, "盛付通-设置押金-返回报文");
                 JsonData jsonObj = JsonMapper.ToObject(content);

+ 24 - 0
AppStart/Helper/PublicImportDataService.cs

@@ -568,6 +568,30 @@ namespace MySystem
             string result = function.PostWebRequest(SftReqUrl + "batchUpdateSnPolicyNo", Newtonsoft.Json.JsonConvert.SerializeObject(req), "application/json");
             return result;
         }
+        public string SftSnBindOrUnbind(string snNo, string merchantId)
+        {
+            Dictionary<string, object> req = new Dictionary<string, object>();
+            req.Add("orgPromoterId", OrgId);
+            req.Add("promoterId", OrgId);
+            req.Add("merchantId", merchantId);
+            req.Add("terminalId", snNo);
+            req.Add("sn", snNo);
+            req.Add("hasServiceFee", "0");
+            req.Add("signType", "RSA");
+            req.Add("charType", "UTF-8");
+            req.Add("requestId", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8));
+            req.Add("requestTime", function.GetCurTimestamp());
+            req = req.OrderBy(m => m.Key).ToDictionary(m => m.Key, m => m.Value);
+            string signString = "";
+            foreach (string key in req.Keys)
+            {
+                signString += key + "=" + req[key].ToString() + "&";
+            }
+            signString = signString.TrimEnd('&');
+            req.Add("mac", SftEncrypt(signString));
+            string result = function.PostWebRequest(SftReqUrl + "batchUpdateSnPolicyNo", Newtonsoft.Json.JsonConvert.SerializeObject(req), "application/json");
+            return result;
+        }
 
         #endregion
             

+ 10 - 7
Controllers/HomeController.cs

@@ -72,14 +72,17 @@ namespace MySystem.Controllers
 
             // {"plan_change_time":"2023-12-26 21:51:04","agent_id":"V1703471325","plan_list":[{"plan_id":"LKB_000","plan_name":"联客宝","supplement_info":"LKB_000"},{"plan_id":"LKB_99","plan_name":"联客宝","supplement_info":"LKB_99"},{"plan_id":"LKB_199","plan_name":"联客宝","supplement_info":"LKB_199"},{"plan_id":"LKB_0.63+3","plan_name":"联客宝","supplement_info":"LKB_0.63+3"},{"plan_id":"LKB_0.6+0","plan_name":"联客宝0.6+0","supplement_info":"LKB_0.6+0"},{"plan_id":"LKB_0.63+0","plan_name":"联客宝0.63+0","supplement_info":"LKB_0.63+0"},{"plan_id":"LKB_299","plan_name":"联客宝299押金","supplement_info":"LKB_299"}]}
 
-            List<string> list = new List<string>();
-            // list.Add("{\"RecordId\":\"65707\",\"PosId\":\"197929\",\"Fee\": \"0.63\",\"Kind\": \"2\",\"OpMan\": \"系统\"}");
-            foreach(string sub in list)
-            {
-                RedisDbconn.Instance.AddList("SetDepositPostQueue", sub);
-            }
+            // List<string> list = new List<string>();
+            // // list.Add("{\"RecordId\":\"65707\",\"PosId\":\"197929\",\"Fee\": \"0.63\",\"Kind\": \"2\",\"OpMan\": \"系统\"}");
+            // foreach(string sub in list)
+            // {
+            //     RedisDbconn.Instance.AddList("SetDepositPostQueue", sub);
+            // }
+
+            string content = PublicImportDataService.Instance.SftSnBindOrUnbind("00003102722312244609541", "42196871");
+            content += "\n" + PublicImportDataService.Instance.SetDepositForSft("00003102722312244609541", "2024POS0");
 
-            return "ok";
+            return content;
         }