Explorar o código

打日志到阿里云

lcl hai 1 semana
pai
achega
45eceeade5

+ 98 - 50
AppStart/Helper/PublicImportDataService.cs

@@ -264,11 +264,18 @@ namespace MySystem
 
         public string PostKDB(string url, string content)
         {
+            string logString = "";
+            logString += "\n请求参数:" + content;
             content = PublicImportDataService.Instance.AesEncrypt(content);
+            logString += "\n加密参数:" + content;
             string timestamp = function.GetCurTimestamp().ToString();
             string sign = PublicImportDataService.Instance.KDBSign(content + timestamp);
             string req = "{\"agencyId\":\"" + AgencyId + "\",\"content\":\"" + content + "\",\"timestamp\":\"" + timestamp + "\",\"sign\":\"" + sign + "\"}";
+            logString += "\n请求体:" + req;
+            logString += "\n请求地址:" + url;
             string result = PostWebRequest(url, req, new Dictionary<string, string>());
+            logString += "\n返回数据:" + result;
+            LogHelper.Instance.WriteLog(logString, "开店宝设置服务费");
             return result;
         }
 
@@ -429,7 +436,12 @@ namespace MySystem
             req += "\"data\":\"" + LSAesEncrypt(data, aeskey) + "\",";
             req += "\"sign\":\"" + LSEncrypt(aeskey) + "\"";
             req += "}";
+            string logString = "";
+            logString += "\n请求参数:" + req;
+            logString += "\n请求地址:" + LSReqUrl + apiPath;
             string result = function.PostWebRequest(LSReqUrl + apiPath, req, "application/json");
+            logString += "\n返回数据:" + result;
+            LogHelper.Instance.WriteLog(logString, "乐刷设置服务费");
             return result;
         }
 
@@ -482,10 +494,13 @@ namespace MySystem
             string content = LiSAgentId + sn + "N11" + serviceFee + "02";
             string signstr = LiSSign(content);
             dic.Add("signData", signstr);
+            string logString = "";
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(dic);
-            function.WriteLog("请求参数:" + req, "设置立刷云电签服务费");
+            logString += "\n请求参数:" + req;
+            logString += "\n请求地址:" + LiSReqUrl + "FEE003";
             string result = PostWebRequest(LiSReqUrl + "FEE003", req, new Dictionary<string, string>());
-            function.WriteLog("返回报文:" + result + "\n\n\n", "设置立刷云电签服务费");
+            logString += "\n返回报文:" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置立刷云电签服务费");
             return result;
         }
         public string SetLiSWeDeposit(string sn, int serviceFee)
@@ -505,10 +520,13 @@ namespace MySystem
             string content = LiSWeAgentId + sn + "N11" + serviceFee + "02";
             string signstr = LiSWeSign(content);
             dic.Add("signData", signstr);
+            string logString = "";
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(dic);
-            function.WriteLog("请求参数:" + req, "设置立刷微电签服务费");
+            logString += "\n请求参数:" + req;
+            logString += "\n请求地址:" + LiSReqUrl + "FEE003";
             string result = PostWebRequest(LiSReqUrl + "FEE003", req, new Dictionary<string, string>());
-            function.WriteLog("返回报文:" + result + "\n\n\n", "设置立刷微电签服务费");
+            logString += "\n返回报文:" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置立刷微电签服务费");
             return result;
         }
 
@@ -536,9 +554,12 @@ namespace MySystem
             string signstr = LiSSign(content);
             dic.Add("signData", signstr);
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(dic);
-            function.WriteLog("请求参数:" + req, "设置立刷云电签费率");
+            string logString = "";
+            logString += "\n请求参数:" + req;
+            logString += "\n请求地址:" + LiSReqUrl + "FEE002";
             string result = PostWebRequest(LiSReqUrl + "FEE002", req, new Dictionary<string, string>());
-            function.WriteLog("返回报文:" + result + "\n\n\n", "设置立刷云电签费率");
+            logString += "\n返回报文:" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置立刷云电签费率");
             return result;
         }
         public string SetLiSWeFee(string sn, string merchNo, string serviceRate = "0.6", string serviceFee = "0")
@@ -564,9 +585,12 @@ namespace MySystem
             string signstr = LiSWeSign(content);
             dic.Add("signData", signstr);
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(dic);
-            function.WriteLog("请求参数:" + req, "设置立刷微电签费率");
+            string logString = "";
+            logString += "\n请求参数:" + req;
+            logString += "\n请求地址:" + LiSReqUrl + "FEE002";
             string result = PostWebRequest(LiSReqUrl + "FEE002", req, new Dictionary<string, string>());
-            function.WriteLog("返回报文:" + result + "\n\n\n", "设置立刷微电签费率");
+            logString += "\n返回报文:" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置立刷微电签费率");
             return result;
         }
 
@@ -642,7 +666,13 @@ namespace MySystem
             }
             signString = signString.TrimEnd('&');
             req.Add("mac", SftEncrypt(signString));
-            string result = function.PostWebRequest(SftReqUrl + "batchUpdateSnPolicyNo", Newtonsoft.Json.JsonConvert.SerializeObject(req), "application/json");
+            string reqString = Newtonsoft.Json.JsonConvert.SerializeObject(req);
+            string logString = "";
+            logString += "\n请求参数:" + reqString;
+            logString += "\n请求地址:" + SftReqUrl + "batchUpdateSnPolicyNo";
+            string result = function.PostWebRequest(SftReqUrl + "batchUpdateSnPolicyNo", reqString, "application/json");
+            logString += "\n返回数据:" + result;
+            LogHelper.Instance.WriteLog(logString, "设置盛付通服务费");
             return result;
         }
         public string SftSnBindOrUnbind(string snNo, string merchantId)
@@ -753,6 +783,8 @@ namespace MySystem
 
         public string HKReqFunc(string apiPath, string data, int BrandId)
         {
+            string logString = "";
+            logString += "\n请求参数:" + data;
             string aeskey = function.MD5_16(Guid.NewGuid().ToString());
             string req = "{";
             if (BrandId == 8)
@@ -769,7 +801,11 @@ namespace MySystem
             req += "\"data\":\"" + HKAesEncrypt(data, aeskey) + "\",";
             req += "\"sign\":\"" + HKEncrypt(aeskey, BrandId) + "\"";
             req += "}";
+            logString += "\n请求体:" + req;
+            logString += "\n请求地址:" + HKReqUrl + apiPath;
             string result = function.PostWebRequest(HKReqUrl + apiPath, req, "application/json");
+            logString += "\n返回数据:" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置海科机具服务费");
             return result;
         }
 
@@ -817,8 +853,7 @@ namespace MySystem
 
         public string LDServiceFee(string SnList, int ServiceFee, int BrandId)
         {
-            function.WriteLog(DateTime.Now.ToString(), "设置联动机具服务费");
-            function.WriteLog(SnList, "设置联动机具服务费");
+            string logString = "";
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             string RequestId = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
             string TerminalModeName = BrandId == 10 ? "DZA" : "DZDA";
@@ -830,15 +865,16 @@ namespace MySystem
             reqdic.Add("terminalModeName", TerminalModeName); //终端模式名
             reqdic.Add("fwfRate", ServiceFee); //服务费
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            function.WriteLog(req, "设置联动机具服务费");
+            logString += "\n请求参数" + req;
             req = LDEncrypt(req);
-            function.WriteLog(req, "设置联动机具服务费");
+            logString += "\n加密参数" + req;
             Dictionary<string, object> datadic = new Dictionary<string, object>();
             datadic.Add("encryptedData", req);
             string data = Newtonsoft.Json.JsonConvert.SerializeObject(datadic);
-            function.WriteLog("请求地址:" + LDRequestUrl + "terminalSelfDistribute", "设置联动机具服务费");
+            logString += "\n请求地址:" + LDRequestUrl + "terminalSelfDistribute";
             string result = function.PostWebRequest(LDRequestUrl + "terminalSelfDistribute", data, "application/json");
-            function.WriteLog(result + "\n\n", "设置联动机具服务费");
+            logString += "\n返回数据:" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置联动机具服务费");
             return result;
         }
 
@@ -863,8 +899,7 @@ namespace MySystem
 
         public string BoxServiceFee(string SnList, string ServiceFee, int UserId = 0)
         {
-            function.WriteLog(DateTime.Now.ToString(), "设置盒易付机具服务费");
-            function.WriteLog(SnList, "设置盒易付机具服务费");
+            string logString = "";
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             Dictionary<string, string> headdic = new Dictionary<string, string>();
             string batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
@@ -896,11 +931,12 @@ namespace MySystem
 
             headdic.Add("X-Sign", SHA256Sign(timestamp + BoxAppSecret + req));
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "设置盒易付机具服务费");
-            function.WriteLog("请求参数\n" + req, "设置盒易付机具服务费");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/inst/register/terms", "设置盒易付机具服务费");
+            logString += "\n请求头\n" + head;
+            logString += "\n请求参数\n" + req;
+            logString += "\n请求地址:" + BoxRequestUrl + "/inst/register/terms";
             string result = PostWebRequest(BoxRequestUrl + "/inst/register/terms", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "设置盒易付机具服务费");
+            logString += "\n返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置盒易付机具服务费");
             return result;
         }
 
@@ -1053,11 +1089,12 @@ namespace MySystem
             param.Add("deposit_id", deposit_id); //政策ID
             param.Add("deposit_name", deposit_name); //政策名称
             string PushData = Newtonsoft.Json.JsonConvert.SerializeObject(param);
-            function.WriteLog("原始数据:" + PushData, "设置POSP机具服务费");
+            string logString = "";
+            logString += "\n原始数据:" + PushData;
             string[] signData = EncryptHelper.Encrypt1(param, AesSecret);
             string content = signData[0];
             string sign = signData[1];
-            function.WriteLog("加密数据:" + content, "设置POSP机具服务费");
+            logString += "\n加密数据:" + content;
             SortedList<string, string> obj = new SortedList<string, string>();
             obj.Add("type", "设置服务费");
             obj.Add("notice_id", Guid.NewGuid().ToString());
@@ -1065,11 +1102,12 @@ namespace MySystem
             obj.Add("content", content);
             obj.Add("sign", sign);
             string requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-            function.WriteLog("请求参数:" + requestJson, "设置POSP机具服务费");
-            function.WriteLog("请求地址:" + PospRequestUrl + "/pos/deposit/modify", "设置POSP机具服务费");
+            logString += "\n请求参数:" + requestJson;
+            logString += "\n请求地址:" + PospRequestUrl + "/pos/deposit/modify";
             string result = function.PostWebRequest(PospRequestUrl + "/pos/deposit/modify", requestJson, "application/json");
-            function.WriteLog("返回报文:" + result, "设置POSP机具服务费");
-            function.WriteLog("\n\n", "设置POSP机具服务费");
+            logString += "\n返回报文:" + result;
+            logString += "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置POSP机具服务费");
             return result;
         }
 
@@ -1080,11 +1118,12 @@ namespace MySystem
             param.Add("plan_id", plan_id); //政策ID
             param.Add("plan_name", plan_name); //政策名称
             string PushData = Newtonsoft.Json.JsonConvert.SerializeObject(param);
-            function.WriteLog("原始数据:" + PushData, "设置POSP机具费率");
+            string logString = "";
+            logString += "\n原始数据:" + PushData;
             string[] signData = EncryptHelper.Encrypt1(param, AesSecret);
             string content = signData[0];
             string sign = signData[1];
-            function.WriteLog("加密数据:" + content, "设置POSP机具费率");
+            logString += "\n加密数据:" + content;
             SortedList<string, string> obj = new SortedList<string, string>();
             obj.Add("type", "设置费率");
             obj.Add("notice_id", Guid.NewGuid().ToString());
@@ -1092,11 +1131,12 @@ namespace MySystem
             obj.Add("content", content);
             obj.Add("sign", sign);
             string requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-            function.WriteLog("请求参数:" + requestJson, "设置POSP机具费率");
-            function.WriteLog("请求地址:" + PospRequestUrl + "/marketing/plan/modify", "设置POSP机具费率");
+            logString += "\n请求参数:" + requestJson;
+            logString += "\n请求地址:" + PospRequestUrl + "/marketing/plan/modify";
             string result = function.PostWebRequest(PospRequestUrl + "/marketing/plan/modify", requestJson, "application/json");
-            function.WriteLog("返回报文:" + result, "设置POSP机具费率");
-            function.WriteLog("\n\n", "设置POSP机具费率");
+            logString += "\n返回报文:" + result;
+            logString += "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置POSP机具费率");
             return result;
         }
 
@@ -1161,16 +1201,18 @@ namespace MySystem
             string rfc1123FormattedTime = currentTime.ToString("r");
             headers.Add("X-Time", rfc1123FormattedTime);
             headers.Add("X-Trace", function.get_Random(32));
-            function.WriteLog("请求地址\n" + lkbReqUrl, "来客吧L吧设置服务费");
+            string logString = "";
+            logString += "\n请求地址\n" + lkbReqUrl;
             string content = "{\"factorySequenceNo\":\"" + sn + "\",\"serviceFee\":\"" + serviceFee.ToString("f0") + "\",\"agencyNo\":\"" + lkbClientId + "\"}";
-            function.WriteLog("明文参数\n" + content, "来客吧L吧设置服务费");
+            logString += "\n明文参数\n" + content;
             content = LkbEncrypt(content);
             string signstr = LkbSign(content);
             headers.Add("X-Sign", signstr);
             string req = "{\"param\":\"" + content + "\"}";
-            function.WriteLog("加密参数\n" + req, "来客吧L吧设置服务费");
+            logString += "\n加密参数\n" + req;
             string result = function.PostWebRequest(lkbReqUrl, req, headers, "application/json");
-            function.WriteLog("返回报文\n" + result + "\n\n\n", "来客吧L吧设置服务费");
+            logString += "\n返回报文\n" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "来客吧L吧设置服务费");
             return result;
         }
         public string LkbSetFee(string sn, decimal rate = 0.6M, int fee = 0)
@@ -1208,21 +1250,23 @@ namespace MySystem
             string rfc1123FormattedTime = currentTime.ToString("r");
             headers.Add("X-Time", rfc1123FormattedTime);
             headers.Add("X-Trace", function.get_Random(32));
-            function.WriteLog("请求地址\n" + lkbReqUrl2, "来客吧L吧设置费率");
+            string logString = "";
+            logString += "\n请求地址\n" + lkbReqUrl2;
             Dictionary<string, object> obj = new Dictionary<string, object>();
             obj.Add("factorySequenceNo", sn);
             obj.Add("productCode", "100");
             obj.Add("productName", "来客吧");
             obj.Add("innerParamList", innerParamList);
             string content = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-            function.WriteLog("明文参数\n" + content, "来客吧L吧设置费率");
+            logString += "\n明文参数\n" + content;
             content = LkbEncrypt2(content);
             string signstr = LkbSign(content);
             headers.Add("X-Sign", signstr);
             string req = "{\"param\":\"" + content + "\"}";
-            function.WriteLog("加密参数\n" + req, "来客吧L吧设置费率");
+            logString += "\n加密参数\n" + req;
             string result = function.PostWebRequest(lkbReqUrl2, req, headers, "application/json");
-            function.WriteLog("返回报文\n" + result + "\n\n\n", "来客吧L吧设置费率");
+            logString += "\n返回报文\n" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "来客吧L吧设置费率");
             return result;
         }
         public string LkbEncrypt(string data)
@@ -1326,12 +1370,14 @@ namespace MySystem
             req.Add("type", "ACTIVITY");
             req.Add("target", target);
             string reqStr = Newtonsoft.Json.JsonConvert.SerializeObject(req);
-            function.WriteLog("请求参数\n" + reqStr, "拉卡拉设置服务费");
+            string logString = "";
+            logString += "\n请求参数\n" + reqStr;
             reqStr = "{\"data\":\"" + LklEncrypt(reqStr) + "\"}";
-            function.WriteLog("加密参数\n" + reqStr, "拉卡拉设置服务费");
-            function.WriteLog("请求地址\n" + lklReqUrl + "/htkterminal/open/terminal/change/activity/amount", "拉卡拉设置服务费");
+            logString += "\n加密参数\n" + reqStr;
+            logString += "\n请求地址\n" + lklReqUrl + "/htkterminal/open/terminal/change/activity/amount";
             string result = PostWebRequest(lklReqUrl + "/htkterminal/open/terminal/change/activity/amount", reqStr, headers);
-            function.WriteLog("返回报文\n" + result + "\n\n\n", "拉卡拉设置服务费");
+            logString += "\n返回报文\n" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "拉卡拉设置服务费");
             return result;
             //{"code":"000000","data":"Oa4NF8tNLKthg9Q9klCLxyWtNJdAuL8n7NH5yM8VgM2eekpkzJ8/sFiY31NBo8qXGDcNi9GAiALsTZcEO5PAAZPsErhYQTeHoZ/cRkySVXm50r1aZ0osZfXysjrwvkP3lPLZzjeB21JldrUKviJ4k7YQunWC+B2Y4MX1ApZoTCw=","message":"SUCCESS","timestamp":1731552629806,"success":true,"fail":false}
         }
@@ -1349,18 +1395,20 @@ namespace MySystem
             innerParamList.Add(item);
             Dictionary<string, string> headers = new Dictionary<string, string>();
             headers.Add("Authorization", "bearer " + LkLGetToken2());
-            function.WriteLog("请求地址\n" + lklReqUrl + "/htkmerchants/channel/customer/update/fee/" + merNo, "拉卡拉设置费率");
-            function.WriteLog("header\n" + Newtonsoft.Json.JsonConvert.SerializeObject(headers), "拉卡拉设置费率");
+            string logString = "";
+            logString += "\n请求地址\n" + lklReqUrl + "/htkmerchants/channel/customer/update/fee/" + merNo;
+            logString += "\nheader\n" + Newtonsoft.Json.JsonConvert.SerializeObject(headers);
             Dictionary<string, object> obj = new Dictionary<string, object>();
             // obj.Add("productCode", "");
             obj.Add("fees", innerParamList);
             string content = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-            function.WriteLog("明文参数\n" + content, "拉卡拉设置费率");
+            logString += "\n明文参数\n" + content;
             // content = LklEncrypt(content);
             // content = "{\"dto\":\"" + content + "\"}";
-            // function.WriteLog("加密参数\n" + req, "拉卡拉设置费率");
+            // logString += "\n加密参数\n" + req;
             string result = PostWebRequest(lklReqUrl + "/htkmerchants/channel/customer/update/fee/" + merNo, content, headers);
-            function.WriteLog("返回报文\n" + result + "\n\n\n", "拉卡拉设置费率");
+            logString += "\n返回报文\n" + result + "\n\n\n";
+            LogHelper.Instance.WriteLog(logString, "拉卡拉设置费率");
             return result;
             //{"message":"SUCCESS","reviewRelatedId":130200781873162}
         }

+ 39 - 25
AppStart/Helper/SetDepositPostService.cs

@@ -174,7 +174,7 @@ namespace MySystem
                                     string msg = obj["ret_msg"].ToString();
                                 }
                             }
-                            else if(BrandId == 22 || BrandId == 33) //立刷微电签
+                            else if(BrandId == 22) //立刷微电签
                             {
                                 addRate = addRate * 100;
                                 string content = PublicImportDataService.Instance.SetLiSWeFee(PosSn, MerNo, Fee.ToString("f2"), addRate.ToString());
@@ -624,12 +624,19 @@ namespace MySystem
         }
 
         public string PostKDB(string url, string content)
-        {
+        {            
+            string logString = "";
+            logString += "\n请求参数:" + content;
             content = AesEncrypt(content);
+            logString += "\n加密参数:" + content;
             string timestamp = function.GetCurTimestamp().ToString();
             string sign = KDBSign(content + timestamp);
             string req = "{\"agencyId\":\"" + AgencyId + "\",\"content\":\"" + content + "\",\"timestamp\":\"" + timestamp + "\",\"sign\":\"" + sign + "\"}";
+            logString += "\n请求体:" + req;
+            logString += "\n请求地址:" + url;
             string result = PostWebRequestKdb(url, req, new Dictionary<string, string>());
+            logString += "\n返回数据:" + result;
+            LogHelper.Instance.WriteLog(logString, "开店宝设置费率");
             return result;
         }
 
@@ -781,8 +788,8 @@ namespace MySystem
 
         public string LSReqFunc(string apiPath, string data, int BrandId)
         {
-            function.WriteLog(DateTime.Now.ToString(), "设置乐刷机具费率");
-            function.WriteLog(data, "设置乐刷机具费率");
+            string logString = "";
+            logString += "\n请求参数:" + data;
             string aeskey = function.MD5_16(Guid.NewGuid().ToString());
             string req = "{";
             if (BrandId == 4)
@@ -799,9 +806,11 @@ namespace MySystem
             req += "\"data\":\"" + LSAesEncrypt(data, aeskey) + "\",";
             req += "\"sign\":\"" + LSEncrypt(aeskey) + "\"";
             req += "}";
-            function.WriteLog(req, "设置乐刷机具费率");
+            logString += "\n请求体:" + req;
+            logString += "\n请求地址:" + LSReqUrl + apiPath;
             string result = function.PostWebRequest(LSReqUrl + apiPath, req, "application/json");
-            function.WriteLog(result + "\n\n", "设置乐刷机具费率");
+            logString += "\n返回数据:" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置乐刷机具费率");
             return result;
         }
 
@@ -981,9 +990,12 @@ namespace MySystem
             }
             signString = signString.TrimEnd('&');
             req.Add("mac", SftEncrypt(signString));
-            function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(req), "设置盛付通机具费率");
+            string logString = "";
+            logString += "\n请求参数:" + Newtonsoft.Json.JsonConvert.SerializeObject(req);
+            logString += "\n请求地址:" + SftReqUrl + "batchChangeMerchantFee";
             string result = function.PostWebRequest(SftReqUrl + "batchChangeMerchantFee", Newtonsoft.Json.JsonConvert.SerializeObject(req), "application/json");
-            function.WriteLog(result + "\n\n", "设置盛付通机具费率");
+            logString += "\n返回数据:" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置盛付通机具费率");
             return result;
         }
 
@@ -1069,9 +1081,9 @@ namespace MySystem
         }
 
         public string HKReqFunc(string apiPath, string data, int BrandId)
-        {
-            function.WriteLog(DateTime.Now.ToString(), "设置海科机具费率");
-            function.WriteLog(data, "设置海科机具费率");
+        {            
+            string logString = "";
+            logString += "\n请求参数:" + data;
             string aeskey = function.MD5_16(Guid.NewGuid().ToString());
             string req = "{";
             if (BrandId == 8)
@@ -1088,9 +1100,11 @@ namespace MySystem
             req += "\"data\":\"" + HKAesEncrypt(data, aeskey) + "\",";
             req += "\"sign\":\"" + HKEncrypt(aeskey, BrandId) + "\"";
             req += "}";
-            function.WriteLog(req, "设置海科机具费率");
+            logString += "\n请求体:" + req;
+            logString += "\n请求地址:" + HKReqUrl + apiPath;
             string result = function.PostWebRequest(HKReqUrl + apiPath, req, "application/json");
-            function.WriteLog(result + "\n\n", "设置海科机具费率");
+            logString += "\n返回数据:" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置海科机具费率");
             return result;
         }
 
@@ -1165,8 +1179,7 @@ namespace MySystem
 
         public string LDFeeRate(string MerNo, string Fee, int BrandId, int addRate = 0)
         {
-            function.WriteLog(DateTime.Now.ToString(), "设置联动机具费率");
-            function.WriteLog(MerNo, "设置联动机具费率");
+            string logString = "";
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             string RequestId = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
             string MercModel = BrandId == 10 ? "DZA" : "DZDA";
@@ -1180,15 +1193,16 @@ namespace MySystem
             reqdic.Add("mercId", MerNo); // 商户编号
             reqdic.Add("cardType", "01"); // 01 贷记卡 02 扫码
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            function.WriteLog(req, "设置联动机具费率");
+            logString += "\n请求参数:" + req;
             req = LDEncrypt(req);
-            function.WriteLog(req, "设置联动机具费率");
+            logString += "\n加密参数" + req;
             Dictionary<string, object> datadic = new Dictionary<string, object>();
             datadic.Add("encryptedData", req);
             string data = Newtonsoft.Json.JsonConvert.SerializeObject(datadic);
-            function.WriteLog("请求地址:" + LDRequestUrl + "updateMercRate", "设置联动机具费率");
+            logString += "\n请求地址:" + LDRequestUrl + "updateMercRate";
             string result = function.PostWebRequest(LDRequestUrl + "updateMercRate", data, "application/json");
-            function.WriteLog(result + "\n\n", "设置联动机具费率");
+            logString += "\n返回数据:" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置联动机具费率");
             return result;
         }
 
@@ -1212,8 +1226,6 @@ namespace MySystem
 
         public string BoxFee(string MerNo, string Fee)
         {
-            function.WriteLog(DateTime.Now.ToString(), "设置盒易付机具费率");
-            function.WriteLog(MerNo, "设置盒易付机具费率");
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             Dictionary<string, string> headdic = new Dictionary<string, string>();
             string batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
@@ -1234,11 +1246,13 @@ namespace MySystem
 
             headdic.Add("X-Sign", BoxSHA256Sign(timestamp + BoxAppSecret + req));
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "设置盒易付机具费率");
-            function.WriteLog("请求参数\n" + req, "设置盒易付机具费率");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/inst/mcht/update_disc", "设置盒易付机具费率");
+            string logString = "";
+            logString += "\n请求头\n" + head;
+            logString += "\n请求参数\n" + req;
+            logString += "\n请求地址:" + BoxRequestUrl + "/inst/mcht/update_disc";
             string result = PostWebRequest(BoxRequestUrl + "/inst/mcht/update_disc", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "设置盒易付机具费率");
+            logString += "\n返回\n" + result + "\n\n";
+            LogHelper.Instance.WriteLog(logString, "设置盒易付机具费率");
             return result;
         }
 

+ 23 - 0
AppStart/LogHelper.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using Library;
+using LitJson;
+using MySystem;
+
+public class LogHelper
+{
+    public readonly static LogHelper Instance = new LogHelper();
+    private LogHelper()
+    { }
+
+    public void WriteLog(string Content, string Topic)
+    {
+        Dictionary<string, string> dic = new Dictionary<string, string>();
+        dic.Add("Topic", Topic);
+        dic.Add("Content", Content);
+        RedisDbconn.Instance.AddList("SlsLogQueue", Newtonsoft.Json.JsonConvert.SerializeObject(dic));
+    }
+
+}