abiao 1 rok temu
rodzic
commit
8c672cdea0

+ 1 - 23
go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go

@@ -318,7 +318,7 @@ func (self *OrderController) MultipleCreate() {
 	}
 	order.Save()
 	//购物册清理
-	ClearCart(order.WxUserId, order.OrderId)
+	//ClearCart(order.WxUserId, order.OrderId)
 
 	//发放赠品
 	helpers.SetOrderPromotionPro(order.OrderId, wxUser.Id)
@@ -521,28 +521,6 @@ func (self *OrderController) MultCentCreate() {
 	self.ServeJSON()
 }
 
-func ClearCart(wxUserId int64, orderId string) {
-	orderDetails := order_model.GetAllDetailsOrderId(orderId, false)
-	for _, item := range orderDetails {
-		cartItem := order_model.GetCartByWxUidAndPid(wxUserId, item.ProductId)
-		if cartItem != nil {
-			cartItem.Delete()
-		}
-	}
-	//清除过期的秒杀商品项
-	list := order_model.GetCartItemsByWxUserId(wxUserId)
-	for _, item := range list {
-		product := product_model.GetProductById(item.ProductId, true)
-		if product != nil {
-			if product.SeckilShowPrice > 0 && product.SeckillEnd.Unix() < time.Now().Unix() {
-				cartItem := order_model.GetCartByWxUidAndPid(wxUserId, item.ProductId)
-				cartItem.Delete()
-			}
-		}
-
-	}
-}
-
 // 获取用户订单详情
 func (self *OrderController) Detail() {
 

+ 3 - 0
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go

@@ -175,6 +175,9 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
 	if resultStore {
 		self.ReturnError(403, []string{apps.ProductStockNotEnough[0], fmt.Sprintf("%s商品库存不足", prdName)}, "", nil)
 	}
+	//购物册清理
+	order_model.ClearCart(order.WxUserId, order.OrderId)
+
 	//订单公共信息更新
 	order.AddressId = addressId
 	order.Remark = remark

+ 21 - 0
go/gopath/src/fohow.com/apps/models/order_model/order.go

@@ -963,3 +963,24 @@ func UpdateOrderPromotions(promotions, noInvovedAmount, orderId string) {
 	o.Raw(sql, promotions, noInvovedAmount, orderId).Exec()
 
 }
+
+func ClearCart(wxUserId int64, orderId string) {
+	orderDetails := GetAllDetailsOrderId(orderId, false)
+	for _, item := range orderDetails {
+		cartItem := GetCartByWxUidAndPid(wxUserId, item.ProductId)
+		if cartItem != nil {
+			cartItem.Delete()
+		}
+	}
+	//清除过期的秒杀商品项
+	list := GetCartItemsByWxUserId(wxUserId)
+	for _, item := range list {
+		product := product_model.GetProductById(item.ProductId, true)
+		if product != nil {
+			if product.SeckilShowPrice > 0 && product.SeckillEnd.Unix() < time.Now().Unix() {
+				cartItem := GetCartByWxUidAndPid(wxUserId, item.ProductId)
+				cartItem.Delete()
+			}
+		}
+	}
+}