Sfoglia il codice sorgente

打日志打到控制台

lcl 4 mesi fa
parent
commit
4bad35a112

+ 16 - 16
AppStart/Alipay/AlipayFunction.cs

@@ -54,7 +54,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                Utils.WriteLog(ex.ToString(), "接口创建应用事务异常");
                 result = "";
             }
             return result;
@@ -120,7 +120,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "代签约产品通用接口异常");
+                Utils.WriteLog(ex.ToString(), "代签约产品通用接口异常");
                 result = "";
             }
             return result;
@@ -142,7 +142,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                Utils.WriteLog(ex.ToString(), "接口创建应用事务异常");
                 result = "";
             }
             return result;
@@ -166,7 +166,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "查询签约申请的结果异常");
+                Utils.WriteLog(ex.ToString(), "查询签约申请的结果异常");
                 result = "";
             }
             return result;
@@ -192,7 +192,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建(获取authtoken)异常");
+                Utils.WriteLog(ex.ToString(), "支付宝统一收单交易创建(获取authtoken)异常");
                 result = "";
             }
             return result;
@@ -230,11 +230,11 @@ namespace MySystem
             {
                 AlipayTradeCreateResponse response = client.Execute(request, null, MerToken);
                 result = response.Body;
-                function.WriteLog(DateTime.Now.ToString() + "\n" + Contentjson + "\n" + result, "支付宝统一收单交易创建");
+                Utils.WriteLog(DateTime.Now.ToString() + "\n" + Contentjson + "\n" + result, "支付宝统一收单交易创建");
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建异常");
+                Utils.WriteLog(ex.ToString(), "支付宝统一收单交易创建异常");
                 result = "";
             }
             return result;
@@ -255,7 +255,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(ex.ToString(), "统一收单线下交易查询异常");
+                Utils.WriteLog(ex.ToString(), "统一收单线下交易查询异常");
                 result = "";
             }
             return result;
@@ -294,7 +294,7 @@ 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;
@@ -303,7 +303,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;
         }
@@ -311,7 +311,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;
@@ -354,7 +354,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")
@@ -366,7 +366,7 @@ namespace MySystem
             catch (Exception ex)
             {
                 //解密异常, 记录日志        
-                function.WriteLog(ex.ToString(), "获取手机号解密异常");
+                Utils.WriteLog(ex.ToString(), "获取手机号解密异常");
             }
             return result;
             // 如果是加密的报文则需要在密文的前后添加双引号
@@ -440,7 +440,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;
         }
@@ -465,7 +465,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;
         }
@@ -489,7 +489,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;
         }

+ 1 - 1
AppStart/GlobalExceptions.cs

@@ -10,7 +10,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全局异常处理日志");
         }
     }
 }

+ 11 - 11
AppStart/Helper/PublicImportDataService.cs

@@ -276,9 +276,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;
@@ -309,7 +309,7 @@ namespace MySystem
                 srcString = reader.ReadToEnd();
                 ret = srcString;   //返回值赋值
                 reader.Close();
-                function.WriteLog(srcString, "请求开店宝API日志");
+                Utils.WriteLog(srcString, "请求开店宝API日志");
             }
             catch (System.Net.WebException ex)
             {
@@ -323,7 +323,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;
         }
@@ -716,8 +716,8 @@ namespace MySystem
 
         public string LDServiceFee(string SnList, int ServiceFee, int BrandId)
         {
-            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 RequestId = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
             string TerminalModeName = BrandId == 10 ? "DZA" : "DZDA";
@@ -729,15 +729,15 @@ namespace MySystem
             reqdic.Add("terminalModeName", TerminalModeName); //终端模式名
             reqdic.Add("fwfRate", ServiceFee); //服务费
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
-            function.WriteLog(req, "设置联动机具服务费");
+            Utils.WriteLog(req, "设置联动机具服务费");
             req = LDEncrypt(req);
-            function.WriteLog(req, "设置联动机具服务费");
+            Utils.WriteLog(req, "设置联动机具服务费");
             Dictionary<string, object> datadic = new Dictionary<string, object>();
             datadic.Add("encryptedData", req);
             string data = Newtonsoft.Json.JsonConvert.SerializeObject(datadic);
-            function.WriteLog("请求地址:" + LDRequestUrl + "terminalSelfDistribute", "设置联动机具服务费");
+            Utils.WriteLog("请求地址:" + LDRequestUrl + "terminalSelfDistribute", "设置联动机具服务费");
             string result = function.PostWebRequest(LDRequestUrl + "terminalSelfDistribute", data, "application/json");
-            function.WriteLog(result + "\n\n", "设置联动机具服务费");
+            Utils.WriteLog(result + "\n\n", "设置联动机具服务费");
             return result;
         }
 

+ 1 - 1
AppStart/Order/PayHelper.cs

@@ -29,7 +29,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + ex.ToString(), "支付回调队列异常");
+                Utils.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + ex.ToString(), "支付回调队列异常");
             }
         }
 

+ 4 - 4
AppStart/OtherApi/BankCardCheckForThree.cs

@@ -29,8 +29,8 @@ namespace MySystem
         public string Do(string bankcard, string idcard, string name)
         {
             String querys = "bankcard=" + bankcard + "&idcard=" + idcard + "&name=" + name;
-            function.WriteLog(DateTime.Now.ToString(), "验证三要素日志");
-            function.WriteLog(querys, "验证三要素日志");
+            Utils.WriteLog(DateTime.Now.ToString(), "验证三要素日志");
+            Utils.WriteLog(querys, "验证三要素日志");
             String bodys = "";
             String url = host + path;
             HttpWebRequest httpRequest = null;
@@ -72,8 +72,8 @@ namespace MySystem
             Stream st = httpResponse.GetResponseStream();
             StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
             string result = reader.ReadToEnd();
-            function.WriteLog(result, "验证三要素日志");
-            function.WriteLog("\n\n", "验证三要素日志");
+            Utils.WriteLog(result, "验证三要素日志");
+            Utils.WriteLog("\n\n", "验证三要素日志");
             return result;
         }
 

+ 4 - 4
AppStart/OtherApi/IdCardCheckForThree.cs

@@ -28,8 +28,8 @@ namespace MySystem
         public string Do(string mobile, string idcard, string name)
         {
             String querys = "";
-            function.WriteLog(DateTime.Now.ToString(), "IdCard验证三要素日志");
-            function.WriteLog(querys, "IdCard验证三要素日志");
+            Utils.WriteLog(DateTime.Now.ToString(), "IdCard验证三要素日志");
+            Utils.WriteLog(querys, "IdCard验证三要素日志");
             String bodys = "id_number=" + idcard + "&name=" + name + "&phone_number=" + mobile + "";
             String url = host + path;
             HttpWebRequest httpRequest = null;
@@ -73,8 +73,8 @@ namespace MySystem
             Stream st = httpResponse.GetResponseStream();
             StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
             string result = reader.ReadToEnd();
-            function.WriteLog(result, "IdCard验证三要素日志");
-            function.WriteLog("\n\n", "IdCard验证三要素日志");
+            Utils.WriteLog(result, "IdCard验证三要素日志");
+            Utils.WriteLog("\n\n", "IdCard验证三要素日志");
             return result;
         }
 

+ 1 - 1
AppStart/RabbitMQClient.cs

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

+ 1 - 1
AppStart/RabbitMQClientV2.cs

@@ -238,7 +238,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                Library.function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "发送MQ队列消息异常");
+                Library.Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "发送MQ队列消息异常");
                 return false;
             }
         }

+ 9 - 9
AppStart/WeChatFunction.cs

@@ -85,13 +85,13 @@ namespace MySystem
             par.Add("payer", payer); //支付者
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(par);
-            function.WriteLog(req, "服务商平台JSAPI下单请求参数");
+            Utils.WriteLog(req, "服务商平台JSAPI下单请求参数");
             try
             {
-                function.WriteLog(serialNo, "服务商平台JSAPI下单请求参数");
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(par), "服务商平台JSAPI下单请求参数");
+                Utils.WriteLog(serialNo, "服务商平台JSAPI下单请求参数");
+                Utils.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(par), "服务商平台JSAPI下单请求参数");
                 string result = postJson("https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi", req, prikey, MchId, serialNo);
-                function.WriteLog(result, "服务商平台JSAPI下单请求参数");
+                Utils.WriteLog(result, "服务商平台JSAPI下单请求参数");
                 JsonData jsonObj = JsonMapper.ToObject(result);
                 string timeStamp = function.ConvertDateTimeInt(DateTime.Now).ToString();
                 string nonce_str = function.get_Random(12);
@@ -120,7 +120,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商品台JSAPI下单异常");
+                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商品台JSAPI下单异常");
             }
             return return_result;
         }
@@ -146,13 +146,13 @@ namespace MySystem
             par.Add("amount", amountDic); //金额信息
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(par);
-            function.WriteLog(req, "服务商平台申请退款API");
+            Utils.WriteLog(req, "服务商平台申请退款API");
             try
             {
                 string merchantId = MchId;   //商户号
                 string serialNo = "62B64854B768D344249FDB9E6EF4A1232C000E84";  //证书编号                
                 string result = postJson("https://api.mch.weixin.qq.com/v3/refund/domestic/refunds", req, prikey, merchantId, serialNo);
-                function.WriteLog(result, "服务商平台申请退款API");
+                Utils.WriteLog(result, "服务商平台申请退款API");
                 JsonData jsonObj = JsonMapper.ToObject(result);
                 return_result.Add("refund_id", jsonObj["refund_id"].ToString()); //微信支付退款单号
                 return_result.Add("channel", jsonObj["channel"].ToString()); //退款渠道
@@ -166,7 +166,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商平台申请退款API异常");
+                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商平台申请退款API异常");
             }
             return return_result;
         }
@@ -197,7 +197,7 @@ namespace MySystem
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商平台查询单笔退款API异常");
+                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商平台查询单笔退款API异常");
             }
             return return_result;
         }

+ 7 - 7
Areas/Api/Controllers/AlipayController.cs

@@ -29,18 +29,18 @@ namespace MySystem.Areas.Api.Controllers.v1
         {
             StreamReader sr = new StreamReader(Request.Body);
             string requestMes = sr.ReadToEnd();
-            function.WriteLog(DateTime.Now.ToString() + "\r\n" + requestMes + "\r\n\r\n", "支付宝服务平台支付回调");
+            Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + requestMes + "\r\n\r\n", "支付宝服务平台支付回调");
             return PayCallBack(new AlipayFunction(_accessor.HttpContext).AlipayPublicKey, requestMes);
         }
 
         public string PayCallBack(string publickey, string requestMes, bool IsRedis = false)
         {
-            // Library.function.WriteLog(requestMes, "支付宝回调日志");
+            // Library.Utils.WriteLog(requestMes, "支付宝回调日志");
             var result = "fail";
             var sPara = GetRequestPost(requestMes);
             if (sPara.Count > 0) //判断是否有带返回参数
             {
-                // Library.function.WriteLog("有参数", "支付宝回调日志");
+                // Library.Utils.WriteLog("有参数", "支付宝回调日志");
                 bool verifyResult = false;
                 var aliNotify = new Com.Alipay.Notify();
                 string signtype = sPara["sign_type"];
@@ -48,10 +48,10 @@ namespace MySystem.Areas.Api.Controllers.v1
                 string strPrice = sPara["total_amount"];//金额
                 decimal.TryParse(strPrice, out total_fee);
                 verifyResult = AlipaySignature.RSACheckV1(sPara, publickey, "UTF-8", signtype, false);
-                // Library.function.WriteLog(verifyResult.ToString(), "支付宝回调日志");
+                // Library.Utils.WriteLog(verifyResult.ToString(), "支付宝回调日志");
                 if (verifyResult) //验证成功
                 {
-                    // Library.function.WriteLog("验证成功\r\n\r\n", "支付宝回调日志");
+                    // Library.Utils.WriteLog("验证成功\r\n\r\n", "支付宝回调日志");
                     //商户订单号
                     string out_trade_no = sPara["out_trade_no"];
                     //支付宝交易号
@@ -72,9 +72,9 @@ namespace MySystem.Areas.Api.Controllers.v1
 
         public string MerAuth(string app_auth_code)
         {
-            function.WriteLog(DateTime.Now.ToString() + "\n" + Request.QueryString.ToString(), "支付宝代商家授权回调日志");
+            Utils.WriteLog(DateTime.Now.ToString() + "\n" + Request.QueryString.ToString(), "支付宝代商家授权回调日志");
             string result = new AlipayFunction().GetToken(app_auth_code);
-            function.WriteLog(result, "支付宝代商家授权回调日志");
+            Utils.WriteLog(result, "支付宝代商家授权回调日志");
             //{"alipay_open_auth_token_app_response":{"code":"10000","msg":"Success","app_auth_token":"202306BB5e2aa2157bef47b7a8d918cadb0f1X25","app_refresh_token":"202306BB57fdb346273840b7aca1d63b34110D25","auth_app_id":"2021004102667228","expires_in":31536000,"re_expires_in":32140800,"tokens":[{"app_auth_token":"202306BB5e2aa2157bef47b7a8d918cadb0f1X25","app_refresh_token":"202306BB57fdb346273840b7aca1d63b34110D25","auth_app_id":"2021004102667228","expires_in":31536000,"re_expires_in":32140800,"user_id":"2088402028451259"}],"user_id":"2088402028451259"},"sign":"NLGZMLHbvb39KXeTBj0UPMVCeIYdxKymSXSBJAdRnuE8zCdJJTkk+flaclj63ljhK2WC/KOue/K1RSAjCepjtLVJaQxBfnTD/YXWHMRwcd8MM3aOX2D/wfl4VBgvzMJ2/fNAgycZ7ps2TiWyDrLz82DXtWpvXIRq0/NuZ6gILIdIl1jS/h4rgUB44ld+23ihNUuyqn1zV2EEm8ZZScEObnwg48sZ7Kd0PfOoXTJX/vfotFm3QXOzUwMNRDm6I2q+UvCGA355QaUvZhUzHOVUldvM4MaZom2TQDvpYf5EFTxSOZ7OglWjvJim1/ZcjUbqY00mTgoMoorrOH7p0OQyfA=="}
             JsonData jsonObj = JsonMapper.ToObject(result);
             if(jsonObj["alipay_open_auth_token_app_response"]["code"].ToString() == "10000")

+ 1 - 1
Areas/Api/Controllers/PublicMethodController.cs

@@ -40,7 +40,7 @@ namespace MySystem.Areas.Api.Controllers
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now + ":" + ex.ToString(), "系统上传图片异常");
+                Utils.WriteLog(DateTime.Now + ":" + ex.ToString(), "系统上传图片异常");
                 return Json(new AppResultJson() { Status = "1", Info = "", Data = "" });
             }
         }

+ 1 - 1
Areas/Api/Controllers/WeChatController.cs

@@ -30,7 +30,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         {
             StreamReader sr = new StreamReader(Request.Body);
             string requestMes = sr.ReadToEnd();
-            function.WriteLog(DateTime.Now.ToString() + "\r\n" + requestMes + "\r\n\r\n", "微信服务平台支付回调");
+            Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + requestMes + "\r\n\r\n", "微信服务平台支付回调");
             RedisDbconn.Instance.AddList("WeChatPayBack", requestMes);
             Dictionary<string, string> dic = new Dictionary<string, string>();
             dic.Add("code", "SUCCESS");

+ 3 - 3
Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs

@@ -296,7 +296,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();
                 }
@@ -421,7 +421,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                         order.CurDivi = suborder.CurDivi;
                         maindb.SaveChanges();
                         RedisDbconn.Instance.RemoveFromList("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId, suborder);
-                        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 = 0;
                         maindb.SaveChanges();
                         return new AppResultJson() { Status = "1", Info = "", Data = Obj };
@@ -462,7 +462,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     if (suborder == null)
                     {
                         RedisDbconn.Instance.AddRightList("ConsumerOrders: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();
                     }

+ 8 - 8
Areas/Api/Controllers/v1/MainServer/ConsumersController.cs

@@ -52,9 +52,9 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             // PublicAccountSet set = RedisDbconn.Instance.Get<PublicAccountSet>("PublicAccountSet") ?? new PublicAccountSet();
             string url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + new WeChatFunction().AppId + "&secret=" + new WeChatFunction().AppSecret + "&js_code=" + code + "&grant_type=authorization_code";
-            function.WriteLog(url, "微信小程序通过code获取openid");
+            Utils.WriteLog(url, "微信小程序通过code获取openid");
             string result = function.GetWebRequest(url);
-            function.WriteLog(result + "\n", "微信小程序通过code获取openid");
+            Utils.WriteLog(result + "\n", "微信小程序通过code获取openid");
             JsonData jsonObj = JsonMapper.ToObject(result);
             string openid = jsonObj["openid"].ToString();
             string session_key = jsonObj["session_key"].ToString();
@@ -123,12 +123,12 @@ namespace MySystem.Areas.Api.Controllers.v1
             catch(Exception ex)
             {
                 Obj.Add("Mobile", "err");
-                function.WriteLog(DateTime.Now.ToString(), "微信小程序获取手机号异常");
-                function.WriteLog(encryptedData, "微信小程序获取手机号异常");
-                function.WriteLog(iv, "微信小程序获取手机号异常");
-                function.WriteLog(session_key, "微信小程序获取手机号异常");
-                function.WriteLog(ex.ToString(), "微信小程序获取手机号异常");
-                function.WriteLog("\r\n\r\n", "微信小程序获取手机号异常");
+                Utils.WriteLog(DateTime.Now.ToString(), "微信小程序获取手机号异常");
+                Utils.WriteLog(encryptedData, "微信小程序获取手机号异常");
+                Utils.WriteLog(iv, "微信小程序获取手机号异常");
+                Utils.WriteLog(session_key, "微信小程序获取手机号异常");
+                Utils.WriteLog(ex.ToString(), "微信小程序获取手机号异常");
+                Utils.WriteLog("\r\n\r\n", "微信小程序获取手机号异常");
             }
             return Obj;
         }

+ 13 - 13
Areas/Api/Controllers/v1/MainServer/MachineApplyController.cs

@@ -128,8 +128,8 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
         }
         public AppResultJson ConfirmApplyDo(string value)
         {
-            function.WriteLog("\r\n\r\n" + DateTime.Now.ToString(), "机具申请-确认申请-V2");
-            function.WriteLog(value, "机具申请-确认申请-V2");
+            Utils.WriteLog("\r\n\r\n" + DateTime.Now.ToString(), "机具申请-确认申请-V2");
+            Utils.WriteLog(value, "机具申请-确认申请-V2");
             JsonData data = JsonMapper.ToObject(value);
             int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
             int Kind = int.Parse(function.CheckInt(data["Kind"].ToString())); //申请类型,1-机具SN,2-200兑换码,3-300券
@@ -149,7 +149,7 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
             int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
             var brand = maindb.KqProducts.ToList();
             string SnIdString = "";
-            function.WriteLog("SnIdString:" + SnIdString, "机具申请-确认申请-V2");
+            Utils.WriteLog("SnIdString:" + SnIdString, "机具申请-确认申请-V2");
             int DeliveryType = int.Parse(function.CheckInt(data["DeliveryType"].ToString())); //提货类型
             string Remark = data["Remark"].ToString(); //订单备注
             int AddressId = int.Parse(function.CheckInt(data["AddressId"].ToString()));  //收货地址Id
@@ -199,7 +199,7 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                     {
                         return new AppResultJson() { Status = "-1", Info = "请选择机具" };
                     }
-                    function.WriteLog("Kind:" + Kind, "机具申请-确认申请-V2");
+                    Utils.WriteLog("Kind:" + Kind, "机具申请-确认申请-V2");
                     string ApplyNo = "BA" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
                     int BrandId = int.Parse(function.CheckInt(ProductType));
                     KqProducts protype = KqProductsDbconn.Instance.GetList().FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
@@ -236,8 +236,8 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                         OperateId = OpId,
                     }).Entity;
                     maindb.SaveChanges();
-                    function.WriteLog("in", "机具申请-确认申请-V2");
-                    function.WriteLog("applyid:" + query.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
+                    Utils.WriteLog("in", "机具申请-确认申请-V2");
+                    Utils.WriteLog("applyid:" + query.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
                     RedisDbconn.Instance.ReleaseLock("MachineApply:" + UserId);
                     Products product = ProductsDbconn.Instance.Get(protype.QueryCount) ?? new Products();
                     Orders order = maindb.Orders.Add(new Orders()
@@ -267,8 +267,8 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                         OpId = OpId,
                     }).Entity;
                     maindb.SaveChanges();
-                    function.WriteLog("in2", "机具申请-确认申请-V2");
-                    function.WriteLog("orderid:" + order.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
+                    Utils.WriteLog("in2", "机具申请-确认申请-V2");
+                    Utils.WriteLog("orderid:" + order.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
                     MachineApply edit = maindb.MachineApply.FirstOrDefault(m => m.Id == query.Id);
                     if (edit != null)
                     {
@@ -295,8 +295,8 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                         OrderIds = order.Id.ToString(),
                     }).Entity;
                     maindb.SaveChanges();
-                    function.WriteLog("2", "首页-客小爽产品-机具管理-机具申请-确认申请");
-                    function.WriteLog("ok\r\n\r\n", "首页-客小爽产品-机具管理-机具申请-确认申请");
+                    Utils.WriteLog("2", "首页-客小爽产品-机具管理-机具申请-确认申请");
+                    Utils.WriteLog("ok\r\n\r\n", "首页-客小爽产品-机具管理-机具申请-确认申请");
                     return new AppResultJson() { Status = "1", Info = "", Data = Obj };
                 }
                 return new AppResultJson() { Status = "-1", Info = "请选择机具", Data = Obj };
@@ -329,7 +329,7 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                     {
                         return new AppResultJson() { Status = "-1", Info = "请选择兑换码" };
                     }
-                    function.WriteLog("Kind:" + Kind, "机具申请-确认申请-V2");
+                    Utils.WriteLog("Kind:" + Kind, "机具申请-确认申请-V2");
                     string ApplyNo = "BA" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
                     int BrandId = int.Parse(function.CheckInt(ProductType));
                     KqProducts protype = KqProductsDbconn.Instance.GetList().FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
@@ -373,7 +373,7 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                     }).Entity;
                     maindb.SaveChanges();
                     RedisDbconn.Instance.ReleaseLock("MachineApply:" + UserId);
-                    function.WriteLog("in", "机具申请-确认申请-V2");
+                    Utils.WriteLog("in", "机具申请-确认申请-V2");
                     Products product = ProductsDbconn.Instance.Get(protype.Sort) ?? new Products();
                     Orders order = maindb.Orders.Add(new Orders()
                     {
@@ -401,7 +401,7 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
                         OpId = OpId,
                     }).Entity;
                     maindb.SaveChanges();
-                    function.WriteLog("in2", "机具申请-确认申请-V2");
+                    Utils.WriteLog("in2", "机具申请-确认申请-V2");
                     MachineApply edit = maindb.MachineApply.FirstOrDefault(m => m.Id == query.Id);
                     if (edit != null)
                     {

+ 5 - 5
Areas/Api/Controllers/v1/MainServer/MerchantDepositOrderController.cs

@@ -48,12 +48,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/v1/MainServer/MerchantInfoController.cs

@@ -874,7 +874,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();

+ 11 - 11
Areas/Api/Controllers/v1/MainServer/OrdersController.cs

@@ -56,9 +56,9 @@ namespace MySystem.Areas.Api.Controllers.v1
                     {
                         TotalPrice = "0.01";
                     }
-                    function.WriteLog(query.OrderNo, "支付宝支付日志");
-                    function.WriteLog(TotalPrice.ToString(), "支付宝支付日志");
-                    function.WriteLog(product.ProductName, "支付宝支付日志");
+                    Utils.WriteLog(query.OrderNo, "支付宝支付日志");
+                    Utils.WriteLog(TotalPrice.ToString(), "支付宝支付日志");
+                    Utils.WriteLog(product.ProductName, "支付宝支付日志");
                     string ProductName = product.ProductName;
                     if(string.IsNullOrEmpty(ProductName) && query.OrderNo.StartsWith("CBJ"))
                     {
@@ -70,7 +70,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                         ProductName = ppro.ProductName;
                     }
                     PayData = new Alipay.AlipayPublicClass(_accessor.HttpContext).GetAlipayInfo(query.OrderNo, TotalPrice, ProductName, set.AlipayAppId, set.AlipayPrivateKey, SourceHost + "/Api/Alipay/NoticePay");
-                    function.WriteLog(PayData, "支付宝支付日志");
+                    Utils.WriteLog(PayData, "支付宝支付日志");
                 }
                 else if (PayMode == 2)
                 {
@@ -126,9 +126,9 @@ namespace MySystem.Areas.Api.Controllers.v1
                     {
                         if (userAccount.BalanceAmount >= PayTotal)
                         {
-                            function.WriteLog(query.OrderNo, "余额支付日志");
-                            function.WriteLog(TotalPrice.ToString(), "余额支付日志");
-                            function.WriteLog(product.ProductName, "余额支付日志");
+                            Utils.WriteLog(query.OrderNo, "余额支付日志");
+                            Utils.WriteLog(TotalPrice.ToString(), "余额支付日志");
+                            Utils.WriteLog(product.ProductName, "余额支付日志");
                             RedisDbconn.Instance.AddList("BalancePayQueue", Id.ToString());
                         }
                         else
@@ -154,9 +154,9 @@ namespace MySystem.Areas.Api.Controllers.v1
                     {
                         if (userAccount.LeaderReserve >= PayTotal)
                         {
-                            function.WriteLog(query.OrderNo, "盟主储蓄金支付日志");
-                            function.WriteLog(TotalPrice.ToString(), "盟主储蓄金支付日志");
-                            function.WriteLog(product.ProductName, "盟主储蓄金支付日志");
+                            Utils.WriteLog(query.OrderNo, "盟主储蓄金支付日志");
+                            Utils.WriteLog(TotalPrice.ToString(), "盟主储蓄金支付日志");
+                            Utils.WriteLog(product.ProductName, "盟主储蓄金支付日志");
                             RedisDbconn.Instance.AddList("ReservePayQueue", Id.ToString());
                         }
                         else
@@ -182,7 +182,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         public AppResultJson ConfirmOrderDo(string value)
         {
-            function.WriteLog(value, "创客-商城-确认订单");
+            Utils.WriteLog(value, "创客-商城-确认订单");
             JsonData data = JsonMapper.ToObject(value);
             int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
             int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库

+ 1 - 1
Areas/Api/Controllers/v1/MainServer/UsersController.cs

@@ -513,7 +513,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     user.Mobile += "d";
                     user.CertId += "d";
                 }
-                function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
+                Utils.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
                 // TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
                 // TODO: 清除token,token登录返回
                 maindb.SaveChanges();

+ 3 - 3
Filter/GlobalActionFilter.cs

@@ -23,12 +23,12 @@ namespace MySystem
             // foreach (var keyValue in stringArgs)
             // {
             //     string path = context.ActionDescriptor.AttributeRouteInfo.Template.ToLower();
-            //     function.WriteLog(path, "拦截器日志");
+            //     Utils.WriteLog(path, "拦截器日志");
             //     if(keyValue.Key == "value" && AllowApiList().Contains(path))
             //     {
-            //         function.WriteLog(keyValue.Value.ToString(), "拦截器日志");
+            //         Utils.WriteLog(keyValue.Value.ToString(), "拦截器日志");
             //         string result = function.PostWebRequest(AppConfig.Base.Host2 + path, "value=" + keyValue.Value.ToString());
-            //         function.WriteLog(result, "拦截器日志");
+            //         Utils.WriteLog(result, "拦截器日志");
             //         result = result.Replace("null", "\"\"");
             //         result = result.Replace("\"status\"", "\"Status\"");
             //         result = result.Replace("\"data\"", "\"Data\"");

+ 1 - 1
Filter/GlobalExceptionsFilter.cs

@@ -10,7 +10,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全局异常处理日志");
         }
     }
 }

+ 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;

+ 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/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", "推送绑定数据异常");
             }
         }
 

+ 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
+
+    
+    }
+}