|
|
@@ -434,3 +434,27 @@ func ShopOrderPromotion(shopApplyId, wxUid, depart int64) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+//赠品明细写入订单
|
|
|
+func PresentTransferToOrder(orderId string, wxUid int64) {
|
|
|
+ beego.BeeLogger.Warn("******* PresentTransferToOrder shopApplyId:%s wxUid:%d", orderId, wxUid)
|
|
|
+ //获取订单明细
|
|
|
+ order := order_model.GetOrderById(orderId, false)
|
|
|
+ if order == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 获取所有未写入赠品记录
|
|
|
+ presents := promotion_model.GetAllNoPatchPresents(wxUid)
|
|
|
+ for _, item := range presents {
|
|
|
+ item.OrderId = orderId
|
|
|
+ item.Status = true
|
|
|
+ item.Save()
|
|
|
+ //赠送赠品
|
|
|
+ product := product_model.GetProductById(item.SendProd, true)
|
|
|
+ if product != nil {
|
|
|
+ order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, item.SendNums, order.Depart)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ beego.BeeLogger.Warn("******* End PresentTransferToOrder shopApplyId:%s wxUid:%d", orderId, wxUid)
|
|
|
+
|
|
|
+}
|