Ver código fonte

银豆抵扣逻辑

abiao 3 anos atrás
pai
commit
77ca58c3cc

+ 6 - 2
go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go

@@ -143,7 +143,7 @@ func (self *OrderController) Create() {
 
 	//提货券
 	userLeftBalanceCount := balance_model.GetUserTotalBalance(wxUId)
-	if userLeftBalanceCount > int64(0) {
+	if userLeftBalanceCount > int64(0) && product.UseQuan {
 		disAmount = float64(0)
 	}
 
@@ -202,6 +202,7 @@ func (self *OrderController) MultipleCreate() {
 	totalPrice := int64(0)
 	totalPv := int64(0)
 	totalSilver := int64(0)
+	totalQuan := int64(0)
 	c_arr := strings.Split(ids, ",")
 	c_nums := strings.Split(nums, ",")
 
@@ -248,6 +249,9 @@ func (self *OrderController) MultipleCreate() {
 		}
 		//统计总银豆
 		totalSilver += product.Silver * cNums
+		if product.UseQuan {
+			totalQuan += product.Price * cNums
+		}
 	}
 
 	//统计实抵银豆
@@ -291,7 +295,7 @@ func (self *OrderController) MultipleCreate() {
 		dis := (float64(product.Price*cNums) - singleTSilver) * float64(product.Pv) / float64(100)
 		disAmount := int64(math.Round(dis))
 
-		if userLeftBalanceCount > int64(0) {
+		if userLeftBalanceCount > int64(0) && totalQuan > 0 {
 			disAmount = int64(0)
 		}
 		totalDisamout += disAmount

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

@@ -160,7 +160,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
 
 			//微信支付金额统计
 			if product.UseQuan || specialPromotion {
-				total_quan += product.Price * item.Count
+				total_quan += product.Price*item.Count - item.Silver
 			}
 			total_price += product.Price * item.Count
 			paiedSilver += item.Silver
@@ -228,7 +228,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
 		userLeftBalanceCount := balance_model.GetUserTotalBalance(wxUId)
 
 		tp += freight
-		total_quan = total_quan + freight - paiedSilver
+		total_quan = total_quan + freight
 
 		quanLittle := false
 		useCoupon = true