lcl пре 1 година
родитељ
комит
1963644b69
1 измењених фајлова са 30 додато и 0 уклоњено
  1. 30 0
      Util/HaoDa/ProfitHelper.cs

+ 30 - 0
Util/HaoDa/ProfitHelper.cs

@@ -156,6 +156,22 @@ namespace MySystem
                                                     
                                                     //聚合支付退款
                                                     bool BackStatus = false;
+
+                                                    //拆单算法
+                                                    MerchantParamSet splitMerchant = db.MerchantParamSet.FirstOrDefault(m => m.Id == suborder.MerchantId);
+                                                    int CheckTime = SplitOrder(GetMoney,subset.MinPayMoney, splitMerchant.QueryCount);
+                                                    if(CheckTime > 0)
+                                                    {
+                                                        GetMoney = GetMoney * CheckTime;
+                                                        splitMerchant.QueryCount += 1;
+                                                        db.SaveChanges();
+                                                    }
+                                                    else
+                                                    {
+                                                        splitMerchant.QueryCount = 0;
+                                                        db.SaveChanges();
+                                                    }
+
                                                     decimal RefundAmount = GetMoney * 100;
                                                     RefundAmount = Math.Round(RefundAmount, 2);
                                                     if(!orderids.Contains(suborder.Id))
@@ -268,6 +284,20 @@ namespace MySystem
             db.Dispose();            
             function.WriteLog("结束返现:" + orderidstring + "\n\n\n", "返现逻辑日志");
         }
+
+        //拆单算法
+        private int SplitOrder(decimal OrderAmt, decimal MinMoney, int OrderNum)
+        {
+            int Times = 0;
+            OrderNum += 1;
+            if(OrderAmt >= MinMoney + 1.01M * MinMoney * (OrderNum - 1))
+            {
+                decimal percenter = OrderAmt/MinMoney;
+                Times = int.Parse(percenter.ToString().Split('.')[0]);
+                if(Times < 1) Times = 1;
+            }
+            return Times;
+        }
         #endregion