diff --git a/db/db_mall_ord_capital_pool_total.go b/db/db_mall_ord_capital_pool_total.go index 5227d17..26966cb 100644 --- a/db/db_mall_ord_capital_pool_total.go +++ b/db/db_mall_ord_capital_pool_total.go @@ -6,9 +6,9 @@ import ( "xorm.io/xorm" ) -func GetMaxPrice(eg *xorm.Engine, uid string) *model.MallOrdCapitalPoolTotal { +func GetMaxPrice(eg *xorm.Engine, uid string, price float64) *model.MallOrdCapitalPoolTotal { var data model.MallOrdCapitalPoolTotal - get, err := eg.Where("uid=? and type=?", uid, 0).Get(&data) + get, err := eg.Where("uid=? and type=? and other_price= minMoney { //如果超过了498 + leavePrice = sum - minMoney + if leavePrice > 0 { + getPrice(eg, req, minMoney, leavePrice) + } + leavePrice = minMoney - zhios_order_relate_utils.StrToFloat64(max.OtherPrice) + max.Num = 1 + } + max.LeavePrice = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(max.LeavePrice)+leavePrice, 3) + max.OtherPrice = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(max.OtherPrice)+leavePrice, 3) + max.UpdateTime = time.Now() + eg.Where("id=?", max.Id).AllCols().Update(max) + } +} func Pool(eg *xorm.Engine, price string) error { if zhios_order_relate_utils.StrToFloat64(price) == 0 {