Pārlūkot izejas kodu

优化返现逻辑

lcl 1 gadu atpakaļ
vecāks
revīzija
73d50b6aa0
2 mainītis faili ar 48 papildinājumiem un 8 dzēšanām
  1. 10 8
      AppStart/Helper/Profit/ProfitHelper.cs
  2. 38 0
      AppStart/Tables/TmpOrder.cs

+ 10 - 8
AppStart/Helper/Profit/ProfitHelper.cs

@@ -212,13 +212,13 @@ namespace MySystem
                             if (IsAll == 0 && PayMoney >= MinPayMoney && GetPercent < 1)
                             if (IsAll == 0 && PayMoney >= MinPayMoney && GetPercent < 1)
                             {
                             {
                                 decimal DiviMoney = PayMoney * (1 - GetPercent - cusumerFeePercent - profitPercent);
                                 decimal DiviMoney = PayMoney * (1 - GetPercent - cusumerFeePercent - profitPercent);
-                                DiviMoney = Math.Round(DiviMoney, 2);
                                 if (DiviMoney > 0)
                                 if (DiviMoney > 0)
                                 {
                                 {
                                     order.ReturnFlag = 1;
                                     order.ReturnFlag = 1;
                                     RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:" + PayMode + ":" + order.MerchantId, order);
                                     RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:" + PayMode + ":" + order.MerchantId, order);
                                     db.SaveChanges();
                                     db.SaveChanges();
                                     DiviMoney = DiviMoney / DiviPersons;
                                     DiviMoney = DiviMoney / DiviPersons;
+                                    DiviMoney = Math.Round(DiviMoney, 2);
                                     List<int> deletes = new List<int>();
                                     List<int> deletes = new List<int>();
                                     long CurDiviPersons = DiviPersons;
                                     long CurDiviPersons = DiviPersons;
                                     long QueueCount = RedisDbconn.Instance.Count("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId);
                                     long QueueCount = RedisDbconn.Instance.Count("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId);
@@ -312,34 +312,36 @@ namespace MySystem
                                                     {
                                                     {
                                                         // RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);
                                                         // RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);
                                                         RedisDbconn.Instance.SetList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, 0, suborder);
                                                         RedisDbconn.Instance.SetList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, 0, suborder);
+                                                        RedisDbconn.Instance.AddList("ConsumerOrdersSetDivi", "{\"OrderId\":\"" + suborder.Id + "\",\"DiviAmt\":\"" + suborder.CurDivi + "\"}");
                                                     }
                                                     }
                                                     else
                                                     else
                                                     {
                                                     {
-                                                        suborder.CurDivi = TmpCurDivi;
-                                                        RedisDbconn.Instance.RemoveFromList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);                                                        
+                                                        suborder.CurDivi = TmpCurDivi;                                         
                                                         ConsumerOrders editOrder = db.ConsumerOrders.FirstOrDefault(m => m.Id == suborder.Id);
                                                         ConsumerOrders editOrder = db.ConsumerOrders.FirstOrDefault(m => m.Id == suborder.Id);
                                                         if (editOrder != null)
                                                         if (editOrder != null)
                                                         {
                                                         {
                                                             editOrder.ReturnFlag = 0;
                                                             editOrder.ReturnFlag = 0;
-                                                            editOrder.CurDivi = editOrder.MaxDivi;
                                                             db.SaveChanges();
                                                             db.SaveChanges();
+                                                            RedisDbconn.Instance.AddList("ConsumerOrdersSetDiviHd", "{\"OrderId\":\"" + suborder.Id + "\",\"DiviAmt\":\"" + suborder.MaxDivi + "\"}");
                                                         }
                                                         }
+                                                        RedisDbconn.Instance.RemoveFromList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);               
                                                     }
                                                     }
-                                                    RedisDbconn.Instance.AddList("ConsumerOrdersSetDivi", "{\"OrderId\":\"" + suborder.Id + "\",\"DiviAmt\":\"" + suborder.CurDivi + "\"}");
                                                 }
                                                 }
                                             }
                                             }
                                             else
                                             else
                                             { 
                                             { 
                                                 //否者计算人数不计入退款名额
                                                 //否者计算人数不计入退款名额
-                                                suborder.CurDivi = TmpCurDivi;
-                                                RedisDbconn.Instance.RemoveFromList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);                                                        
+                                                suborder.CurDivi = TmpCurDivi;                                                   
                                                 ConsumerOrders editOrder = db.ConsumerOrders.FirstOrDefault(m => m.Id == suborder.Id);
                                                 ConsumerOrders editOrder = db.ConsumerOrders.FirstOrDefault(m => m.Id == suborder.Id);
                                                 if (editOrder != null)
                                                 if (editOrder != null)
                                                 {
                                                 {
                                                     editOrder.ReturnFlag = 0;
                                                     editOrder.ReturnFlag = 0;
-                                                    editOrder.CurDivi = editOrder.MaxDivi;
                                                     db.SaveChanges();
                                                     db.SaveChanges();
+                                                    RedisDbconn.Instance.AddList("ConsumerOrdersSetDiviHd", "{\"OrderId\":\"" + suborder.Id + "\",\"DiviAmt\":\"" + suborder.MaxDivi + "\"}");
                                                 }
                                                 }
+                                                RedisDbconn.Instance.RemoveFromList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);
+                                                TmpOrder tmporder = Newtonsoft.Json.JsonConvert.DeserializeObject<TmpOrder>(Newtonsoft.Json.JsonConvert.SerializeObject(order));
+                                                RedisDbconn.Instance.RemoveFromList("ConsumerOrdersHd:Divi:" + PayMode + ":" + MerchantId, tmporder);
                                                 CurDiviPersons += 1;
                                                 CurDiviPersons += 1;
                                             }
                                             }
                                         }
                                         }

+ 38 - 0
AppStart/Tables/TmpOrder.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models
+{
+    public partial class TmpOrder
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public decimal CurDivi { get; set; }
+        public decimal MaxDivi { get; set; }
+        public string SnNo { get; set; }
+        public decimal ReturnMoney { get; set; }
+        public decimal PayMoney { get; set; }
+        public int PayMode { get; set; }
+        public string OrderNo { get; set; }
+        public int ConsumerId { get; set; }
+        public int MerchantId { get; set; }
+        public ulong IsAct { get; set; }
+        public int UserId { get; set; }
+        public decimal MerchantActualAmount { get; set; }
+        public string DivideLog { get; set; }
+        public string TradePayNo { get; set; }
+        public int SetRecordId { get; set; }
+        public int DivideFlag { get; set; }
+        public DateTime? DivideDate { get; set; }
+    }
+}