Kaynağa Gözat

提交SLS日志

lcl 1 gün önce
ebeveyn
işleme
5bf33c7fbc
2 değiştirilmiş dosya ile 204 ekleme ve 148 silme
  1. 196 143
      Util/HaoDa/HaoDaHelper.cs
  2. 8 5
      Util/LogHelper.cs

+ 196 - 143
Util/HaoDa/HaoDaHelper.cs

@@ -72,17 +72,19 @@ namespace MySystem
             }
 
             // request.brh = BrhCode;
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒新创建商户");
+            string logString = "";
+            logString += DateTime.Now.ToString();
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
-            LogHelper.Instance.WriteLog(req, "好哒新创建商户");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒新创建商户");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒新创建商户");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/inst/mcht/new_create_mcht", "好哒新创建商户");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/inst/mcht/new_create_mcht";
             string result = PostWebRequest(BoxRequestUrl + "/api/inst/mcht/new_create_mcht", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒新创建商户");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒新创建商户", true);
 
             return result;
         }
@@ -102,20 +104,24 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒查询商户审核状态");
+            
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("instId", instId);
             reqdic.Add("mchtNo", mchtNo);
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒查询商户审核状态");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询商户审核状态");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询商户审核状态");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/inst/mcht/query_mcht_audit", "好哒查询商户审核状态");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/inst/mcht/query_mcht_audit";
             string result = PostWebRequest(BoxRequestUrl + "/api/inst/mcht/query_mcht_audit", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒查询商户审核状态");
+            logString += "返回\n" + result + "\n\n";
+            
+            LogHelper.Instance.WriteLog(logString, "好哒查询商户审核状态", true);
 
             return result;
         }
@@ -131,19 +137,22 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒查询实名认证状态");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             reqdic.Add("storeNo", storeNo); // 慧掌柜门店号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒查询实名认证状态");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询实名认证状态");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询实名认证状态");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/wechat/queryVerifiedResult.json", "好哒查询实名认证状态");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/wechat/queryVerifiedResult.json";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/wechat/queryVerifiedResult.json", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒查询实名认证状态");
+            logString += "返回\n" + result + "\n\n";
+            
+            LogHelper.Instance.WriteLog(logString, "好哒查询实名认证状态", true);
 
             return result;
         }
@@ -159,19 +168,21 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒查询实名认证二维码");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             reqdic.Add("storeNo", storeNo); // 慧掌柜门店号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒查询实名认证二维码");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询实名认证二维码");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询实名认证二维码");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/wechat/queryVerifiedQrcode.json", "好哒查询实名认证二维码");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/wechat/queryVerifiedQrcode.json";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/wechat/queryVerifiedQrcode.json", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒查询实名认证二维码");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒查询实名认证二维码", true);
 
             return result;
         }
@@ -195,7 +206,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒微信公众号和小程序支付");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); //盒子的商户编号
             reqdic.Add("storeNo", storeNo); //盒子的门店编码	
@@ -209,14 +221,15 @@ namespace MySystem
             reqdic.Add("ledgerModel", ledgerModel); //分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒微信公众号和小程序支付");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒微信公众号和小程序支付");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒微信公众号和小程序支付");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", "好哒微信公众号和小程序支付");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒微信公众号和小程序支付");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒微信公众号和小程序支付", true);
 
             return result;
         }
@@ -237,7 +250,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒支付宝服务窗支付");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); //盒子的商户编号
             reqdic.Add("storeNo", storeNo); //盒子的门店编码	
@@ -248,14 +262,15 @@ namespace MySystem
             reqdic.Add("confirmCode", confirmCode); //支付确认码,由4位纯数字组成,每次请求时随机生成
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒支付宝服务窗支付");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒支付宝服务窗支付");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒支付宝服务窗支付");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", "好哒支付宝服务窗支付");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒支付宝服务窗支付");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒新创建商户", true);
 
             return result;
         }
@@ -274,7 +289,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒聚合支付退款");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 盒子的商户编号	
@@ -285,14 +301,15 @@ namespace MySystem
             reqdic.Add("refundReason", "门店消费补贴"); //退款原因        
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒聚合支付退款");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒聚合支付退款");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒聚合支付退款");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/refund", "好哒聚合支付退款");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/refund";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/refund", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒聚合支付退款");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒聚合支付退款", true);
 
             return result;
         }
@@ -308,21 +325,23 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒开通分账");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号	
             reqdic.Add("storeNo", storeNo); // 慧掌柜门店号	
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒开通分账");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒开通分账");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒开通分账");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/mcht/reg", "好哒开通分账");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/mcht/reg";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/mcht/reg", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒开通分账");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒开通分账", true);
 
             return result;
         }
@@ -339,20 +358,22 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账接收方签约");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("acctNo", acctNo); // 账户号	
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             reqdic.Add("storeNo", storeNo); // 慧掌柜门店号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒分账接收方签约");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账接收方签约");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账接收方签约");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/bind_mcht", "好哒分账接收方签约");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/bind_mcht";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/acct/bind_mcht", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账接收方签约");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒分账接收方签约", true);
 
             return result;
         }
@@ -367,17 +388,19 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒添加分账接收方账户");
+            string logString = "";
+            logString += DateTime.Now.ToString();
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
-            LogHelper.Instance.WriteLog(req, "好哒添加分账接收方账户");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒添加分账接收方账户");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒添加分账接收方账户");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/register", "好哒添加分账接收方账户");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/register";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/acct/register", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒添加分账接收方账户");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒添加分账接收方账户", true);
 
             return result;
         }
@@ -393,19 +416,21 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账交易详情查询");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             reqdic.Add("orderNo", orderNo); // 交易订单号	
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒分账交易详情查询");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账交易详情查询");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账交易详情查询");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/bind_mcht", "好哒分账交易详情查询");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/bind_mcht";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/acct/bind_mcht", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账交易详情查询");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒分账交易详情查询", true);
 
             return result;
         }
@@ -421,19 +446,21 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账交易详情查询");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             reqdic.Add("orderNo", orderNo); // 交易订单号	
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒分账交易详情查询");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账交易详情查询");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账交易详情查询");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/trade/clear/get", "好哒分账交易详情查询");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/trade/clear/get";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/trade/clear/get", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账交易详情查询");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒分账交易详情查询", true);
 
             return result;
         }
@@ -449,17 +476,19 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒订单分账申请");
+            string logString = "";
+            logString += DateTime.Now.ToString();
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
-            LogHelper.Instance.WriteLog(req, "好哒订单分账申请");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒订单分账申请");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒订单分账申请");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/order/apply", "好哒订单分账申请");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/order/apply";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/order/apply", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒订单分账申请");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒订单分账申请", true);
 
             return result;
         }
@@ -475,19 +504,21 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒订单分账结果查询");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("applyNo", applyNo); // 账户号	
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒订单分账结果查询");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒订单分账结果查询");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒订单分账结果查询");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/apply/query", "好哒订单分账结果查询");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/apply/query";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/apply/query", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒订单分账结果查询");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒订单分账结果查询", true);
 
             return result;
         }
@@ -502,17 +533,19 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒商户修改银行卡");
+            string logString = "";
+            logString += DateTime.Now.ToString();
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
-            LogHelper.Instance.WriteLog(req, "好哒商户修改银行卡");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒商户修改银行卡");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒商户修改银行卡");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/inst/mcht/update_acct", "好哒商户修改银行卡");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/inst/mcht/update_acct";
             string result = PostWebRequest(BoxRequestUrl + "/api/inst/mcht/update_acct", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒商户修改银行卡");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒商户修改银行卡", true);
 
             return result;
         }
@@ -528,20 +561,22 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒查询修改银行卡任务审核状态");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo);
             reqdic.Add("taskId", taskId);
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒查询修改银行卡任务审核状态");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询修改银行卡任务审核状态");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询修改银行卡任务审核状态");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/inst/mcht/query_acct_task", "好哒查询修改银行卡任务审核状态");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/inst/mcht/query_acct_task";
             string result = PostWebRequest(BoxRequestUrl + "/api/inst/mcht/query_acct_task", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒查询修改银行卡任务审核状态");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒查询修改银行卡任务审核状态", true);
 
             return result;
         }
@@ -559,7 +594,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒绑定微信appid接口");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 盒子商户号	
@@ -567,14 +603,16 @@ namespace MySystem
             reqdic.Add("subAppId", subAppId); // 公众号appid或者小程序appid	
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒绑定微信appid接口");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒绑定微信appid接口");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒绑定微信appid接口");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/wechat/add_sub_config", "好哒绑定微信appid接口");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/wechat/add_sub_config";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/wechat/add_sub_config", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒绑定微信appid接口");
+            logString += "返回\n" + result + "\n\n";
+            
+            LogHelper.Instance.WriteLog(logString, "好哒绑定微信appid接口", true);
 
             return result;
         }
@@ -596,7 +634,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒到账记录查询");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 盒子商户号	
@@ -609,14 +648,15 @@ namespace MySystem
             reqdic.Add("rows", rows); // 每页大小,默认10,最大500	
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒到账记录查询");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒到账记录查询");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒到账记录查询");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", "好哒到账记录查询");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/query";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒到账记录查询");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒到账记录查询", true);
 
             return result;
         }
@@ -632,21 +672,23 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒到账记录详情");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 商户号	
             reqdic.Add("id", id); // id	
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒到账记录详情");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒到账记录详情");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒到账记录详情");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", "好哒到账记录详情");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/get";
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒到账记录详情");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒到账记录详情", true);
 
             return result;
         }
@@ -662,21 +704,23 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒聚合支付查询");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 商户号	
             reqdic.Add("outOrderNo", outOrderNo); // 商户订单号
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒聚合支付查询");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒聚合支付查询");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒聚合支付查询");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/query_status", "好哒聚合支付查询");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/query_status";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/query_status", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒聚合支付查询");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒聚合支付查询", true);
 
             return result;
         }
@@ -693,7 +737,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒退款查询");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("mchtNo", mchtNo); // 商户号	
@@ -701,14 +746,15 @@ namespace MySystem
             reqdic.Add("outRefundNo", outRefundNo);
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒退款查询");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒退款查询");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒退款查询");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/refund_query", "好哒退款查询");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/refund_query";
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/refund_query", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒退款查询");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒退款查询", true);
 
             return result;
         }
@@ -723,7 +769,8 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒商户修改费率");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             
             Dictionary<string, object> request = new Dictionary<string, object>();
 
@@ -733,14 +780,15 @@ namespace MySystem
             request.Add("unionPayRate", feeRate);
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
-            LogHelper.Instance.WriteLog(req, "好哒商户修改费率");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒商户修改费率");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒商户修改费率");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/inst/mcht/update_disc", "好哒商户修改费率");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/inst/mcht/update_disc";
             string result = PostWebRequest(BoxRequestUrl + "/api/inst/mcht/update_disc", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒商户修改费率");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒商户修改费率", true);
 
             return result;
         }
@@ -828,9 +876,10 @@ namespace MySystem
             string ret = string.Empty;
             try
             {
-                LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "请求好哒API日志");
-                LogHelper.Instance.WriteLog(postUrl, "请求好哒API日志");
-                LogHelper.Instance.WriteLog(paramData, "请求好哒API日志");
+                string logString = "";
+                logString += DateTime.Now.ToString();
+                logString += postUrl;
+                logString += paramData;
                 byte[] postData = System.Text.Encoding.UTF8.GetBytes(paramData);
                 // 设置提交的相关参数 
                 System.Net.HttpWebRequest request = System.Net.WebRequest.Create(postUrl) as System.Net.HttpWebRequest;
@@ -861,7 +910,9 @@ namespace MySystem
                 srcString = reader.ReadToEnd();
                 ret = srcString;   //返回值赋值
                 reader.Close();
-                LogHelper.Instance.WriteLog(srcString, "请求好哒API日志");
+                logString += srcString;
+                
+                LogHelper.Instance.WriteLog(logString, "请求好哒API日志", true);
             }
             catch (System.Net.WebException ex)
             {
@@ -875,7 +926,7 @@ namespace MySystem
             catch (Exception ex)
             {
                 ret = "fail";
-                LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "请求好哒API异常");
+                LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "请求好哒API异常", true);
             }
             return ret;
         }
@@ -891,21 +942,23 @@ namespace MySystem
             var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
 
-            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒获取文件令牌接口");
+            string logString = "";
+            logString += DateTime.Now.ToString();
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
             reqdic.Add("fileName", fileName); // 文件名	
             reqdic.Add("action", action); // 操作类型 0 上传图片
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            LogHelper.Instance.WriteLog(req, "好哒获取文件令牌接口");
+            logString += req;
             Dictionary<string, string> headdic = GetHeader(req, BrandId, AgentTag);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒获取文件令牌接口");
-            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒获取文件令牌接口");
-            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/auth/v1/get_file_token", "好哒获取文件令牌接口");
+            logString += "请求头\n" + head;
+            logString += "请求参数\n" + req;
+            logString += "请求地址:" + BoxRequestUrl + "/api/auth/v1/get_file_token";
             string result = PostWebRequest(BoxRequestUrl + "/api/auth/v1/get_file_token", req, headdic);
-            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒获取文件令牌接口");
+            logString += "返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "好哒获取文件令牌接口", true);
 
             return result;
         }

+ 8 - 5
Util/LogHelper.cs

@@ -15,7 +15,7 @@ public class LogHelper
 
     string[] BlackList = { "好哒查询商户审核状态", "好哒查询实名认证状态", "好哒分账交易详情查询", "间连商户开户意愿确认(提交申请单)查询申请单状态-请求参数", "查询支付宝商家认证申请单状态", "查询支付宝商户意愿申请状态", "获取微信商户开户意愿确认状态", "获取支付宝商家认证状态" };
 
-    public void WriteLog(string Content, string FileName)
+    public void WriteLog(string Content, string FileName, bool sls = false)
     {
         if(BlackList.Contains(FileName) && Library.ConfigurationManager.EnvironmentFlag == 2)
         {
@@ -28,10 +28,13 @@ public class LogHelper
             RedisDbconn.Instance.SetExpire(key, 600);
         }
         function.WriteLog(Content, FileName);
-        Dictionary<string, string> dic = new Dictionary<string, string>();
-        dic.Add("Topic", FileName);
-        dic.Add("Content", Content);
-        KxsRedisDbconn.Instance.AddList("SlsLogQueue", Newtonsoft.Json.JsonConvert.SerializeObject(dic));
+        if(sls)
+        {
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            dic.Add("Topic", FileName);
+            dic.Add("Content", Content);
+            KxsRedisDbconn.Instance.AddList("SlsLogQueue", Newtonsoft.Json.JsonConvert.SerializeObject(dic));
+        }
     }
 
     public void Start()