ソースを参照

添加操作日志和剩余返现金额

DuGuYang 1 年間 前
コミット
b0c5de037e

+ 16 - 14
Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs

@@ -135,7 +135,7 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
-        
+
 
 
 
@@ -243,10 +243,10 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             string SnNo = data["Sn"].ToString(); //码牌SN
             // string Machine = data["Machine"].ToString();
-            if(SnNo.Length > 20)
+            if (SnNo.Length > 20)
             {
                 SnNo = System.Web.HttpUtility.UrlDecode(SnNo);
-                if(!SnNo.EndsWith("="))
+                if (!SnNo.EndsWith("="))
                 {
                     SnNo += "=";
                 }
@@ -274,14 +274,14 @@ namespace MySystem.Areas.Api.Controllers.v1
             PosMachinesTwo pos = PosMachinesTwoDbconn.Instance.Get(SnNo) ?? new PosMachinesTwo();
             // PosMachines machine = PosMachinesDbconn.Instance.Get(qrcode.SnId) ?? new PosMachines();
             // if (machine.BindMerchantId == 0) machine.BindMerchantId = 1; // TODO: 需要绑定二维码
-            if(pos.OpId == 1)
+            if (pos.OpId == 1)
             {
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantInfo();
                 MerchantAddInfo merchantAdd = MerchantAddInfoDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantAddInfo();
                 MerchantParamSet merchantset = MerchantParamSetDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantParamSet();
                 string openid = "";
                 if (PayMode == 1)
-                { 
+                {
                     openid = new AlipayFunction(_accessor.HttpContext).GetAlipayUserId(Code);
                     if (openid.Contains("|"))
                     {
@@ -321,7 +321,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 maindb.SaveChanges();
                 string OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
                 bool ActFlag = merchantset.IsAll == 1 ? false : true;
-                if(PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
+                if (PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
                 {
                     ActFlag = false;
                 }
@@ -350,7 +350,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 });
                 maindb.SaveChanges();
                 if (PayMode == 1)
-                { 
+                {
                     string backString = new AlipayFunction(_accessor.HttpContext).CreateTrade(OrderNo, merchant.Name, PayMoney, openid, merchantAdd.AlipayAuthToken, SpHost + "/api/alipay/notice");
                     JsonData obj = JsonMapper.ToObject(backString);
                     if (obj["alipay_trade_create_response"]["code"].ToString() == "10000")
@@ -360,7 +360,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                         Obj.Add("tradeNo", tradeNo);
                     }
                     else
-                    { 
+                    {
                         Obj.Add("respCode", obj["alipay_trade_create_response"]["code"].ToString());
                         Obj.Add("tradeNo", "");
                         return new AppResultJson() { Status = "-1", Info = obj["alipay_trade_create_response"]["sub_msg"].ToString(), Data = Obj };
@@ -409,17 +409,18 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["id"].ToString()));
             ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
-            if(order != null)
+            if (order != null)
             {
                 List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId);
-                if(suborders.Count > 0)
+                if (suborders.Count > 0)
                 {
                     ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
-                    if(suborder != null)
+                    if (suborder != null)
                     {
                         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", "直连订单取消返现");
                         return new AppResultJson() { Status = "1", Info = "", Data = Obj };
                     }
                 }
@@ -443,15 +444,16 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["id"].ToString()));
             ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
-            if(order != null)
+            if (order != null)
             {
                 List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId);
-                if(suborders.Count > 0)
+                if (suborders.Count > 0)
                 {
                     ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
-                    if(suborder == null)
+                    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", "直连订单恢复返现");
                     }
                     return new AppResultJson() { Status = "1", Info = "", Data = Obj };
                 }

+ 2 - 0
Util/BusinessUtil.cs

@@ -118,12 +118,14 @@ namespace MySystem
             List<Dictionary<string, object>> source = new ConsumerOrdersService().List(new List<FieldItem>(), condition, 1, 999);
             foreach (Dictionary<string, object> subdata in source)
             {
+                var leaveAmount = decimal.Parse(subdata["MaxDivi"].ToString()) - decimal.Parse(subdata["CurDivi"].ToString());
                 obj.Add("TradeDate", DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //日期
                 obj.Add("PayMode", subdata["PayMode"].ToString()); //支付方式(1 微信 2 支付宝)
                 obj.Add("PayMoney", subdata["PayMoney"].ToString()); //是否活动(1 是 0 否)
                 obj.Add("IsAct", subdata["IsAct"].ToString()); //是否活动(1 是 0 否)
                 obj.Add("OrderNo", subdata["OrderNo"].ToString()); //订单号
                 obj.Add("Kind", 1); //通道(1 直连 2 银联)
+                obj.Add("LeaveAmount", leaveAmount); //剩余返现金额
                 List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
                 List<Dictionary<string, object>> dics = new ConsumerProfitService().List(new List<FieldItem>(), " and OrderId=" + int.Parse(subdata["Id"].ToString()) + "", 1, 999);