|
|
@@ -3,6 +3,7 @@ package order_controller
|
|
|
import (
|
|
|
"fmt"
|
|
|
"fohow.com/apps/models/base_config"
|
|
|
+ "fohow.com/apps/models/cent_model"
|
|
|
"fohow.com/libs/lib_redis"
|
|
|
// "fmt"
|
|
|
"strconv"
|
|
|
@@ -286,6 +287,11 @@ func (self *OrderController) MultCentCreate() {
|
|
|
if totalPrice < base_config.GetOrderLimit() {
|
|
|
self.ReturnError(403, []string{apps.OrderNotEnough[0], fmt.Sprintf("订单金额不能低于%d积分", base_config.GetOrderLimit()/int64(100))}, "", nil)
|
|
|
}
|
|
|
+ //直接抵扣积分,积分不够则报错
|
|
|
+ userLeftCent := cent_model.GetCentTotalBalance(wxUId)
|
|
|
+ if userLeftCent < totalPrice {
|
|
|
+ self.ReturnError(403, apps.CentNotEnough, "", nil)
|
|
|
+ }
|
|
|
order.TotalPrice = totalPrice
|
|
|
order.Freight = freight
|
|
|
order.Save()
|