Pārlūkot izejas kodu

打日志打到控制台

lcl 4 mēneši atpakaļ
vecāks
revīzija
bbe60d46e0

+ 3 - 3
Areas/Api/Controllers/Main/ConsumerOrdersController.cs

@@ -109,7 +109,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             else
             {
                 string result = function.GetWebRequest("https://api.weixin.qq.com/sns/jscode2session?appid=" + new WeChatFunction().AppId + "&secret=" + new WeChatFunction().AppSecret + "&js_code=" + Code + "&grant_type=authorization_code");
-                function.WriteLog(DateTime.Now.ToString() + "\n" + result, "微信小程序获取openid");
+                Utils.WriteLog(DateTime.Now.ToString() + "\n" + result, "微信小程序获取openid");
                 JsonData jsonObj = JsonMapper.ToObject(result);
                 openid = jsonObj["openid"].ToString();
             }
@@ -217,7 +217,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                         order.CurDivi = suborder.CurDivi;
                         maindb.SaveChanges();
                         RedisDbconn.Instance.RemoveFromList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, suborder);
-                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + suborder.Id + "\r\n\r\n", "银联订单取消返现");
+                        Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + suborder.Id + "\r\n\r\n", "银联订单取消返现");
                         order.ReturnFlag = 0;
                         maindb.SaveChanges();
                         return new AppResultJson() { Status = "1", Info = "", Data = Obj };
@@ -262,7 +262,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     if (suborder == null)
                     {
                         RedisDbconn.Instance.AddRightList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + Id + "\r\n\r\n", "银联订单恢复返现");
+                        Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + Id + "\r\n\r\n", "银联订单恢复返现");
                         order.ReturnFlag = 1;
                         maindb.SaveChanges();
                     }

+ 1 - 1
Areas/Api/Controllers/Main/MerchantAddInfoController.cs

@@ -45,7 +45,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         public AppResultJson AddDo(string value, bool sub = false)
         {
-            function.WriteLog(value, "创客-首页-新增商户");
+            Utils.WriteLog(value, "创客-首页-新增商户");
             JsonData data = JsonMapper.ToObject(value);
             int UserId = int.Parse(function.CheckInt(data.getItem("UserId").ToString()));
             string CertMerchantName = data.getItem("CertMerchantName").ToString(); //- 商户名称

+ 5 - 5
Areas/Api/Controllers/Main/MerchantDepositOrderController.cs

@@ -49,12 +49,12 @@ namespace MySystem.Areas.Api.Controllers.v1
                 if (PayMode == 1)
                 {
                     string TotalPrice = query.ActPayPrice.ToString();
-                    function.WriteLog(query.OrderNo, "支付宝支付日志");
-                    function.WriteLog(TotalPrice.ToString(), "支付宝支付日志");
-                    function.WriteLog("商户激活—确认订单", "支付宝支付日志");
+                    Utils.WriteLog(query.OrderNo, "支付宝支付日志");
+                    Utils.WriteLog(TotalPrice.ToString(), "支付宝支付日志");
+                    Utils.WriteLog("商户激活—确认订单", "支付宝支付日志");
                     string ProductName = "商户激活";
                     PayData = new Alipay.AlipayPublicClass(_accessor.HttpContext).GetAlipayInfo(query.OrderNo, TotalPrice, ProductName, LKBAliPayInfo.AppId, LKBAliPayInfo.PrivateKey, SpHost + "/Api/Alipay/NoticePay2");
-                    function.WriteLog(PayData, "支付宝支付日志");
+                    Utils.WriteLog(PayData, "支付宝支付日志");
                 }
                 Obj.Add("PayData", PayData); //支付宝微信SDK所需数据
             }
@@ -74,7 +74,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         private AppResultJson ConfirmOrderDo(string value)
         {
-            function.WriteLog(value, "商户激活—确认订单");
+            Utils.WriteLog(value, "商户激活—确认订单");
             JsonData data = JsonMapper.ToObject(value);
             int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
             Dictionary<string, object> Obj = new Dictionary<string, object>();

+ 1 - 1
Areas/Api/Controllers/Main/MerchantInfoController.cs

@@ -848,7 +848,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         public Dictionary<string, object> DetailBySnDo(string value)
         {
-            function.WriteLog(value, "商户-通过sn获取商户详情");
+            Utils.WriteLog(value, "商户-通过sn获取商户详情");
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             string Sn = data["Sn"].ToString();

+ 1 - 1
Filter/GlobalExceptionsFilter.cs

@@ -11,7 +11,7 @@ namespace MySystem
         {
             string Message = context.Exception.Message;
             string StackTrace = context.Exception.StackTrace;
-            function.WriteLog(DateTime.Now.ToString() + "\r\n" + Message + "\r\n" + StackTrace, "Global全局异常处理日志");
+            Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + Message + "\r\n" + StackTrace, "Global全局异常处理日志");
             context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
             context.ExceptionHandled = true;
         }

+ 4 - 4
Util/Aliyun/AliyunOcr.cs

@@ -53,9 +53,9 @@ namespace MySystem
             {
                 // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
                 // 错误 message
-                function.WriteLog(error.Message, "OCR异常");
+                Utils.WriteLog(error.Message, "OCR异常");
                 // 诊断地址
-                function.WriteLog(error.Data["Recommend"].ToString(), "OCR异常");
+                Utils.WriteLog(error.Data["Recommend"].ToString(), "OCR异常");
                 AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
             }
             catch (Exception _error)
@@ -66,9 +66,9 @@ namespace MySystem
                 });
                 // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
                 // 错误 message
-                function.WriteLog(error.Message, "OCR异常");
+                Utils.WriteLog(error.Message, "OCR异常");
                 // 诊断地址
-                function.WriteLog(error.Data["Recommend"].ToString(), "OCR异常");
+                Utils.WriteLog(error.Data["Recommend"].ToString(), "OCR异常");
                 AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
             }
             return result;

+ 8 - 8
Util/HaoDa/Alipay/AliIotFunction.cs

@@ -36,7 +36,7 @@ namespace MySystem
             "  \"device_id\":\"" + DeviceId + "\"," +
             "  \"supplier_id\":\"202208101504455785\"" +
             "}";
-            function.WriteLog(request.BizContent, "间连iot设备和间连商户绑定");
+            Utils.WriteLog(request.BizContent, "间连iot设备和间连商户绑定");
 
             string result = "";
             try
@@ -46,7 +46,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "间连iot设备和间连商户绑定异常");
+                Utils.WriteLog(ex.ToString(), "间连iot设备和间连商户绑定异常");
                 result = "";
             }
             return result;
@@ -65,7 +65,7 @@ namespace MySystem
             "  \"device_id\":\"" + DeviceId + "\"," +
             "  \"supplier_id\":\"202208101504455785\"" +
             "}";
-            function.WriteLog(request.BizContent, "间连iot设备和间连商户解绑");
+            Utils.WriteLog(request.BizContent, "间连iot设备和间连商户解绑");
 
             string result = "";
             try
@@ -75,7 +75,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "间连iot设备和间连商户解绑异常");
+                Utils.WriteLog(ex.ToString(), "间连iot设备和间连商户解绑异常");
                 result = "";
             }
             return result;
@@ -92,7 +92,7 @@ namespace MySystem
             "  \"sn\":\"" + Sn + "\"," +
             "  \"supplier_id\":\"202208101504455785\"" +
             "}";
-            function.WriteLog(request.BizContent, "查询设备基础信息");
+            Utils.WriteLog(request.BizContent, "查询设备基础信息");
 
             string result = "";
             try
@@ -102,7 +102,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "查询设备基础信息异常");
+                Utils.WriteLog(ex.ToString(), "查询设备基础信息异常");
                 result = "";
             }
             return result;
@@ -123,7 +123,7 @@ namespace MySystem
             "  \"amount\":\"" + Amount + "\"," +
             "  \"msg_id\":\"202309190006284875\"" +
             "}";
-            function.WriteLog(request.BizContent, "到账播报");
+            Utils.WriteLog(request.BizContent, "到账播报");
 
             string result = "";
             try
@@ -133,7 +133,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "到账播报异常");
+                Utils.WriteLog(ex.ToString(), "到账播报异常");
                 result = "";
             }
             return result;

+ 2 - 2
Util/HaoDa/AlipayFunction.cs

@@ -50,14 +50,14 @@ namespace MySystem
                 requestAccess_token.GrantType = "authorization_code";
                 requestAccess_token.Code = Auth_code;
                 AlipaySystemOauthTokenResponse responseAccess_token = client.Execute(requestAccess_token);
-                function.WriteLog(responseAccess_token.Body, "支付宝授权");
+                Utils.WriteLog(responseAccess_token.Body, "支付宝授权");
                 string AlipayUserId = responseAccess_token.AlipayUserId; //20881043611849171819285350010300
                 string UserId = responseAccess_token.UserId; //2088222145274001
                 result = UserId + "|" + AlipayUserId;
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
+                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
             }
             return result;
         }

+ 35 - 35
Util/HaoDa/HaoDaHelper.cs

@@ -36,8 +36,8 @@ namespace MySystem
 
         public string BoxServiceFee(string SnList, string ServiceFee)
         {
-            function.WriteLog(DateTime.Now.ToString(), "设置盒易付机具服务费");
-            function.WriteLog(SnList, "设置盒易付机具服务费");
+            Utils.WriteLog(DateTime.Now.ToString(), "设置盒易付机具服务费");
+            Utils.WriteLog(SnList, "设置盒易付机具服务费");
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             string batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
 
@@ -54,11 +54,11 @@ namespace MySystem
 
             Dictionary<string, string> headdic = GetHeader(reqdic);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "设置盒易付机具服务费");
-            function.WriteLog("请求参数\n" + req, "设置盒易付机具服务费");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/inst/register/terms", "设置盒易付机具服务费");
+            Utils.WriteLog("请求头\n" + head, "设置盒易付机具服务费");
+            Utils.WriteLog("请求参数\n" + req, "设置盒易付机具服务费");
+            Utils.WriteLog("请求地址:" + BoxRequestUrl + "/inst/register/terms", "设置盒易付机具服务费");
             string result = PostWebRequest(BoxRequestUrl + "/inst/register/terms", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "设置盒易付机具服务费");
+            Utils.WriteLog("返回\n" + result + "\n\n", "设置盒易付机具服务费");
             return result;
         }
 
@@ -244,9 +244,9 @@ namespace MySystem
             string ret = string.Empty;
             try
             {
-                function.WriteLog(DateTime.Now.ToString(), "请求开店宝API日志");
-                function.WriteLog(postUrl, "请求开店宝API日志");
-                function.WriteLog(paramData, "请求开店宝API日志");
+                Utils.WriteLog(DateTime.Now.ToString(), "请求开店宝API日志");
+                Utils.WriteLog(postUrl, "请求开店宝API日志");
+                Utils.WriteLog(paramData, "请求开店宝API日志");
                 byte[] postData = System.Text.Encoding.UTF8.GetBytes(paramData);
                 // 设置提交的相关参数 
                 System.Net.HttpWebRequest request = System.Net.WebRequest.Create(postUrl) as System.Net.HttpWebRequest;
@@ -277,7 +277,7 @@ namespace MySystem
                 srcString = reader.ReadToEnd();
                 ret = srcString;   //返回值赋值
                 reader.Close();
-                function.WriteLog(srcString, "请求开店宝API日志");
+                Utils.WriteLog(srcString, "请求开店宝API日志");
             }
             catch (System.Net.WebException ex)
             {
@@ -291,7 +291,7 @@ namespace MySystem
             catch (Exception ex)
             {
                 ret = "fail";
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "请求开店宝API异常");
+                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "请求开店宝API异常");
             }
             return ret;
         }
@@ -316,7 +316,7 @@ namespace MySystem
             var BoxRequestUrl = HaodaParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
 
-            function.WriteLog(DateTime.Now.ToString(), "好哒微信公众号和小程序支付");
+            Utils.WriteLog(DateTime.Now.ToString(), "好哒微信公众号和小程序支付");
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); //盒子的商户编号
             reqdic.Add("storeNo", storeNo); //盒子的门店编码	
@@ -331,14 +331,14 @@ namespace MySystem
             reqdic.Add("ledgerModel", ledgerModel); //分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            function.WriteLog(req, "好哒微信公众号和小程序支付");
+            Utils.WriteLog(req, "好哒微信公众号和小程序支付");
             Dictionary<string, string> headdic = GetHeader(req);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "好哒微信公众号和小程序支付");
-            function.WriteLog("请求参数\n" + req, "好哒微信公众号和小程序支付");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", "好哒微信公众号和小程序支付");
+            Utils.WriteLog("请求头\n" + head, "好哒微信公众号和小程序支付");
+            Utils.WriteLog("请求参数\n" + req, "好哒微信公众号和小程序支付");
+            Utils.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", "好哒微信公众号和小程序支付");
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "好哒微信公众号和小程序支付");
+            Utils.WriteLog("返回\n" + result + "\n\n", "好哒微信公众号和小程序支付");
 
             return result;
         }
@@ -360,7 +360,7 @@ namespace MySystem
             var BoxRequestUrl = HaodaParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
 
-            function.WriteLog(DateTime.Now.ToString(), "好哒支付宝服务窗支付");
+            Utils.WriteLog(DateTime.Now.ToString(), "好哒支付宝服务窗支付");
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); //盒子的商户编号
             reqdic.Add("storeNo", storeNo); //盒子的门店编码	
@@ -373,14 +373,14 @@ namespace MySystem
             reqdic.Add("ledgerModel", ledgerModel); //分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            function.WriteLog(req, "好哒支付宝服务窗支付");
+            Utils.WriteLog(req, "好哒支付宝服务窗支付");
             Dictionary<string, string> headdic = GetHeader(req);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "好哒支付宝服务窗支付");
-            function.WriteLog("请求参数\n" + req, "好哒支付宝服务窗支付");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/ali_js_pay", "好哒支付宝服务窗支付");
+            Utils.WriteLog("请求头\n" + head, "好哒支付宝服务窗支付");
+            Utils.WriteLog("请求参数\n" + req, "好哒支付宝服务窗支付");
+            Utils.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/ali_js_pay", "好哒支付宝服务窗支付");
             string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/ali_js_pay", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "好哒支付宝服务窗支付");
+            Utils.WriteLog("返回\n" + result + "\n\n", "好哒支付宝服务窗支付");
 
             return result;
         }
@@ -402,7 +402,7 @@ namespace MySystem
             var BoxRequestUrl = HaodaParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
 
-            function.WriteLog(DateTime.Now.ToString(), "好哒到账记录查询");
+            Utils.WriteLog(DateTime.Now.ToString(), "好哒到账记录查询");
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
             reqdic.Add("mchtNo", mchtNo); //商户号
             reqdic.Add("startTime", startTime); //查询开始时间(yyyy-MM-dd)
@@ -414,14 +414,14 @@ namespace MySystem
             reqdic.Add("rows", rows); //每页大小,默认10,最大500
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            function.WriteLog(req, "好哒到账记录查询");
+            Utils.WriteLog(req, "好哒到账记录查询");
             Dictionary<string, string> headdic = GetHeader(req);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "好哒到账记录查询");
-            function.WriteLog("请求参数\n" + req, "好哒到账记录查询");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", "好哒到账记录查询");
+            Utils.WriteLog("请求头\n" + head, "好哒到账记录查询");
+            Utils.WriteLog("请求参数\n" + req, "好哒到账记录查询");
+            Utils.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", "好哒到账记录查询");
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "好哒到账记录查询");
+            Utils.WriteLog("返回\n" + result + "\n\n", "好哒到账记录查询");
 
             return result;
         }
@@ -437,20 +437,20 @@ namespace MySystem
             var BoxRequestUrl = HaodaParam.BoxRequestUrl;
             if (BrandId == 1) BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
 
-            function.WriteLog(DateTime.Now.ToString(), "好哒到账记录详情");
+            Utils.WriteLog(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);
-            function.WriteLog(req, "好哒到账记录详情");
+            Utils.WriteLog(req, "好哒到账记录详情");
             Dictionary<string, string> headdic = GetHeader(req);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
-            function.WriteLog("请求头\n" + head, "好哒到账记录详情");
-            function.WriteLog("请求参数\n" + req, "好哒到账记录详情");
-            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", "好哒到账记录详情");
+            Utils.WriteLog("请求头\n" + head, "好哒到账记录详情");
+            Utils.WriteLog("请求参数\n" + req, "好哒到账记录详情");
+            Utils.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", "好哒到账记录详情");
             string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", req, headdic);
-            function.WriteLog("返回\n" + result + "\n\n", "好哒到账记录详情");
+            Utils.WriteLog("返回\n" + result + "\n\n", "好哒到账记录详情");
 
             return result;
         }

+ 13 - 13
Util/Kxs/AlipayFunctionForKxs.cs

@@ -50,7 +50,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                Utils.WriteLog(ex.ToString(), "接口创建应用事务异常");
                 result = "";
             }
             return result;
@@ -116,7 +116,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "代签约产品通用接口异常");
+                Utils.WriteLog(ex.ToString(), "代签约产品通用接口异常");
                 result = "";
             }
             return result;
@@ -138,7 +138,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                Utils.WriteLog(ex.ToString(), "接口创建应用事务异常");
                 result = "";
             }
             return result;
@@ -162,7 +162,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "查询签约申请的结果异常");
+                Utils.WriteLog(ex.ToString(), "查询签约申请的结果异常");
                 result = "";
             }
             return result;
@@ -188,7 +188,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建(获取authtoken)异常");
+                Utils.WriteLog(ex.ToString(), "支付宝统一收单交易创建(获取authtoken)异常");
                 result = "";
             }
             return result;
@@ -211,11 +211,11 @@ namespace MySystem
             {
                 AlipayTradeCreateResponse response = client.Execute(request, null, Token);
                 result = response.Body;
-                function.WriteLog(DateTime.Now.ToString() + "\n" + result, "支付宝统一收单交易创建");
+                Utils.WriteLog(DateTime.Now.ToString() + "\n" + result, "支付宝统一收单交易创建");
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建异常");
+                Utils.WriteLog(ex.ToString(), "支付宝统一收单交易创建异常");
                 result = "";
             }
             return result;
@@ -236,7 +236,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "统一收单线下交易查询异常");
+                Utils.WriteLog(ex.ToString(), "统一收单线下交易查询异常");
                 result = "";
             }
             return result;
@@ -280,7 +280,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
+                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
             }
             return result;
         }
@@ -288,7 +288,7 @@ namespace MySystem
 
         public string GetAlipayMobile(string response)
         {
-            function.WriteLog(response, "解密报文");
+            Utils.WriteLog(response, "解密报文");
             //1. 获取验签和解密所需要的参数
             IDictionary openapiResult = Jayrock.Json.Conversion.JsonConvert.Import(response) as IDictionary;
             string signType;
@@ -331,7 +331,7 @@ namespace MySystem
             string result = "";
             try
             {
-                function.WriteLog(content, "解密报文");
+                Utils.WriteLog(content, "解密报文");
                 result = AlipayEncrypt.AesDencrypt(Key, content, charset);
                 JsonData obj = JsonMapper.ToObject(result);
                 if (obj["code"].ToString() == "10000")
@@ -343,7 +343,7 @@ namespace MySystem
             catch (Exception ex)
             {
                 //解密异常, 记录日志        
-                function.WriteLog(ex.ToString(), "获取手机号解密异常");
+                Utils.WriteLog(ex.ToString(), "获取手机号解密异常");
             }
             return result;
             // 如果是加密的报文则需要在密文的前后添加双引号
@@ -404,7 +404,7 @@ namespace MySystem
             catch (Exception ex)
             {
                 //解密异常, 记录日志        
-                function.WriteLog(ex.ToString(), "获取手机号解密异常");
+                Utils.WriteLog(ex.ToString(), "获取手机号解密异常");
             }
             return result;
         }

+ 1 - 1
Util/LogHelper.cs

@@ -24,7 +24,7 @@ public class LogHelper
         }
         else
         {
-            function.WriteLog(Content, FileName);
+            Utils.WriteLog(Content, FileName);
         }
     }
 }

+ 1 - 1
Util/OssHelper.cs

@@ -49,7 +49,7 @@ namespace MySystem
                         }
                         catch (Exception ex)
                         {
-                            function.WriteLog(ex.ToString(), "OSS上传队列异常");
+                            Utils.WriteLog(ex.ToString(), "OSS上传队列异常");
                         }
                     }
                 }

+ 1 - 1
Util/PosPushDataNewHelper.cs

@@ -30,7 +30,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送绑定数据异常");
+                Utils.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送绑定数据异常");
             }
         }
         public static void Bind(MerchantAddInfo mer,  MySystem.Models.Main1.PosMachinesTwo pos)

+ 2 - 2
Util/RabbitMQClient.cs

@@ -49,7 +49,7 @@ namespace MySystem
             EventingBasicConsumer consumer = new EventingBasicConsumer(channel);
             consumer.Received += (a, e) =>
             {
-                Library.function.WriteLog(Encoding.Default.GetString(e.Body.ToArray()), "接收到的MQ消息");
+                Utils.WriteLog(Encoding.Default.GetString(e.Body.ToArray()), "接收到的MQ消息");
                 channel.BasicAck(e.DeliveryTag, true); //收到回复后,RabbitMQ会直接在队列中删除这条消息
             };
             channel.BasicConsume(QueueName, false, consumer);
@@ -100,7 +100,7 @@ namespace MySystem
             var consumer = new EventingBasicConsumer(channel);
             consumer.Received += (a, e) =>
             {
-                Library.function.WriteLog(Encoding.Default.GetString(e.Body.ToArray()), "接收到的MQ消息");
+                Utils.WriteLog(Encoding.Default.GetString(e.Body.ToArray()), "接收到的MQ消息");
                 channel.BasicAck(e.DeliveryTag, true); //收到回复后,RabbitMQ会直接在队列中删除这条消息
             };
             channel.BasicConsume(QueueName, false, consumer);

+ 19 - 0
Util/Utils.cs

@@ -0,0 +1,19 @@
+using System;
+
+namespace MySystem
+{
+    public class Utils
+    {
+        
+        #region 打控制台日志
+
+        public static void WriteLog(string msg, string filename = "message")
+        {
+            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "--" + filename + "--" + msg);
+        }
+
+        #endregion
+
+    
+    }
+}