|
|
@@ -56,6 +56,8 @@ func SetOrderPromotion(orderId string, wxUid int64) {
|
|
|
nums2 := int64(99)
|
|
|
nums3 := int64(99)
|
|
|
nums4 := int64(99)
|
|
|
+ nums5 := int64(99)
|
|
|
+ nums6 := int64(99)
|
|
|
if item.Prod1 > 0 {
|
|
|
nums1 = int64(0)
|
|
|
detail1 := order_model.GetDetailsByOrderIdAndPid(orderId, item.Prod1)
|
|
|
@@ -81,9 +83,25 @@ func SetOrderPromotion(orderId string, wxUid int64) {
|
|
|
}
|
|
|
if item.MinTotal > 0 {
|
|
|
nums4 = int64(order.TotalPrice / item.MinTotal)
|
|
|
+ }
|
|
|
+
|
|
|
+ if item.Prod4 > 0 {
|
|
|
+ nums5 = int64(0)
|
|
|
+ detail4 := order_model.GetDetailsByOrderIdAndPid(orderId, item.Prod3)
|
|
|
+ if detail4 != nil && item.Prod4 > 0 && item.Nums4 > 0 {
|
|
|
+ nums5 = int64(detail4.Count / item.Nums4)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if item.Prod5 > 0 {
|
|
|
+ nums6 = int64(0)
|
|
|
+ detail5 := order_model.GetDetailsByOrderIdAndPid(orderId, item.Prod5)
|
|
|
+ if detail5 != nil && item.Prod5 > 0 && item.Nums5 > 0 {
|
|
|
+ nums6 = int64(detail5.Count / item.Nums4)
|
|
|
+ }
|
|
|
}
|
|
|
- val := []int64{nums1, nums2, nums3, nums4}
|
|
|
+
|
|
|
+ val := []int64{nums1, nums2, nums3, nums4, nums5, nums6}
|
|
|
nums = min(val...)
|
|
|
if !item.IsMore {
|
|
|
val := []int64{nums, 1}
|
|
|
@@ -120,6 +138,20 @@ func SetOrderPromotion(orderId string, wxUid int64) {
|
|
|
product := product_model.GetProductById(item.SendProd3, true)
|
|
|
go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3)
|
|
|
}
|
|
|
+
|
|
|
+ if item.SendProd4 > 0 && item.SendNums4 > 0 {
|
|
|
+ sendNums4 := nums * item.SendNums4
|
|
|
+ //赠送赠品1
|
|
|
+ product := product_model.GetProductById(item.SendProd4, true)
|
|
|
+ go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums4)
|
|
|
+ }
|
|
|
+
|
|
|
+ if item.SendProd5 > 0 && item.SendNums5 > 0 {
|
|
|
+ sendNums5 := nums * item.SendNums5
|
|
|
+ //赠送赠品1
|
|
|
+ product := product_model.GetProductById(item.SendProd5, true)
|
|
|
+ go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums5)
|
|
|
+ }
|
|
|
//赠送积分 or 代办费
|
|
|
if item.Cash > 0 {
|
|
|
totalCash := nums * item.Cash
|