فهرست منبع

监听支付接口时间

lcl 1 سال پیش
والد
کامیت
f6713333c6
2فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 11 0
      Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs
  2. 5 0
      global.json

+ 11 - 0
Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs

@@ -227,16 +227,20 @@ namespace MySystem.Areas.Api.Controllers.v1
         [Authorize]
         public JsonResult Pay(string value)
         {
+            function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-1", "支付时间监控");
             if (string.IsNullOrEmpty(value))
             {
                 System.IO.StreamReader sr = new System.IO.StreamReader(Request.Body);
                 value = sr.ReadToEnd();
                 value = value.Split('=')[1];
             }
+            function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-2", "支付时间监控");
             // value = "BplaaoWS0BIaiDoBUavO7+V+TuwfZwqMyMceCjNxKX8WAdNPI4nbsWRweXeisqtFeVwrmUBHvii5+aPGmATw35XnmHbnPfOGcFGStB89zjssftNRosanfYpr1rdYgcaxNuBw2fpAL4HNV9eTFyRdWsJADF+tD4dTSkfh/VK2od4Ze4coidlUyA==";
             value = DesDecrypt(value);
+            function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-3", "支付时间监控");
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = PayDo(value);
+            function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-end", "支付时间监控");
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
         }
         public AppResultJson PayDo(string value)
@@ -255,6 +259,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 SnNo = SnNo.TrimEnd('\0');
                 SnNo = SnNo.Substring(0, 20);
             }
+            function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-4", "支付时间监控");
             int PayMode = int.Parse(function.CheckInt(data["PayMode"].ToString())); //支付方式
             decimal PayMoney = decimal.Parse(function.CheckNum(data["PayMoney"].ToString())); //支付金额
             string Code = data["Code"].ToString();
@@ -274,6 +279,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             MerchantQrCode qrcode = MerchantQrCodeDbconn.Instance.Get(SnNo) ?? new MerchantQrCode();
             PosMachinesTwo pos = PosMachinesTwoDbconn.Instance.Get(SnNo) ?? new PosMachinesTwo();
             PosMachines machine = PosMachinesDbconn.Instance.Get(SnNo) ?? new PosMachines();
+            function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-5", "支付时间监控");
             int MerchantId = pos.BindMerchantId;
             if(machine.DeviceKind == "1")
             {
@@ -284,6 +290,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(MerchantId) ?? new MerchantInfo();
                 MerchantAddInfo merchantAdd = MerchantAddInfoDbconn.Instance.Get(MerchantId) ?? new MerchantAddInfo();
                 MerchantParamSet merchantset = MerchantParamSetDbconn.Instance.Get(MerchantId) ?? new MerchantParamSet();
+                function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-6", "支付时间监控");
                 string openid = "";
                 if (PayMode == 1)
                 { 
@@ -300,6 +307,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     JsonData jsonObj = JsonMapper.ToObject(result);
                     openid = jsonObj["openid"].ToString();
                 }
+                function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-7", "支付时间监控");
                 int ConsumerId = 0;
                 ConsumerOpenIds check = maindb.ConsumerOpenIds.FirstOrDefault(m => m.OpenId == openid);
                 if (check == null)
@@ -324,6 +332,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     ConsumerId = check.ConsumerId;
                 }
                 maindb.SaveChanges();
+                function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-8", "支付时间监控");
                 string OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
                 bool ActFlag = merchantset.IsAll == 1 ? false : true;
                 if(PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
@@ -347,6 +356,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     SeoDescription = Newtonsoft.Json.JsonConvert.SerializeObject(merchantset),
                 }).Entity;
                 maindb.SaveChanges();
+                function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-9", "支付时间监控");
                 maindb.ConsumerOrderForNo.Add(new ConsumerOrderForNo()
                 {
                     OrderNo = OrderNo,
@@ -385,6 +395,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     Obj.Add("paySign", dic["paySign"]); //支付签名
                     Obj.Add("ConsumerId", ConsumerId);
                 }
+                function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "10", "支付时间监控");
             }
             else
             {

+ 5 - 0
global.json

@@ -0,0 +1,5 @@
+{
+  "sdk": {
+    "version": "3.0.100"
+  }
+}