|
@@ -1,6 +1,9 @@
|
|
|
package helpers
|
|
package helpers
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "fmt"
|
|
|
|
|
+ "fohow.com/apps/models/balance_model"
|
|
|
|
|
+ "fohow.com/apps/models/cent_model"
|
|
|
"fohow.com/apps/models/order_model"
|
|
"fohow.com/apps/models/order_model"
|
|
|
"fohow.com/apps/models/product_model"
|
|
"fohow.com/apps/models/product_model"
|
|
|
"github.com/astaxie/beego"
|
|
"github.com/astaxie/beego"
|
|
@@ -91,6 +94,7 @@ func SetOrderPromotion(orderId string, wxUid int64) {
|
|
|
beego.Warn("totalFlag%v", totalFlag)
|
|
beego.Warn("totalFlag%v", totalFlag)
|
|
|
beego.Warn("numsFlag%v", numsFlag)
|
|
beego.Warn("numsFlag%v", numsFlag)
|
|
|
beego.Warn("nums%d", nums)*/
|
|
beego.Warn("nums%d", nums)*/
|
|
|
|
|
+ //满足促销条件
|
|
|
if firstFlag && totalFlag && numsFlag {
|
|
if firstFlag && totalFlag && numsFlag {
|
|
|
if item.SendProd1 > 0 && item.SendNums1 > 0 {
|
|
if item.SendProd1 > 0 && item.SendNums1 > 0 {
|
|
|
sendNums1 := nums * item.SendNums1
|
|
sendNums1 := nums * item.SendNums1
|
|
@@ -111,6 +115,17 @@ func SetOrderPromotion(orderId string, wxUid int64) {
|
|
|
product := product_model.GetProductById(item.SendProd3, true)
|
|
product := product_model.GetProductById(item.SendProd3, true)
|
|
|
go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3)
|
|
go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3)
|
|
|
}
|
|
}
|
|
|
|
|
+ //赠送积分 or 代办费
|
|
|
|
|
+ if item.Cash > 0 {
|
|
|
|
|
+ source := balance_model.BALANCE_SOURCE_PROMOTION
|
|
|
|
|
+ remark := fmt.Sprintf("促销赠送代金券")
|
|
|
|
|
+ new(balance_model.Balance).Create(order.WxUserId, order.UserId, item.Cash, source, order.OrderId, remark)
|
|
|
|
|
+ }
|
|
|
|
|
+ if item.Cent > 0 {
|
|
|
|
|
+ source := cent_model.PROMOTION_SEND
|
|
|
|
|
+ remark := fmt.Sprintf("促销活动赠送")
|
|
|
|
|
+ new(cent_model.CentBalance).Create(order.WxUserId, item.Cent, source, order.OrderId, remark)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|