|
|
@@ -38,22 +38,31 @@ func AddOrder(eg *xorm.Engine, req map[string]string) { |
|
|
|
eg.Insert(data) |
|
|
|
} |
|
|
|
} else { |
|
|
|
if price < minMOney { |
|
|
|
return |
|
|
|
} |
|
|
|
var data = &model.MallOrdCapitalPoolTotal{ |
|
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
|
OtherPrice: req["price"], |
|
|
|
LeavePrice: req["price"], |
|
|
|
Num: 1, |
|
|
|
UpdateTime: time.Now(), |
|
|
|
Oid: req["oid"], |
|
|
|
Type: 0, |
|
|
|
} |
|
|
|
eg.Insert(data) |
|
|
|
getPrice(eg, req, minMOney*capitalPoolMul, price) |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
func getPrice(eg *xorm.Engine, req map[string]string, minMoney float64, leavePrice float64) { |
|
|
|
if leavePrice <= 0 { |
|
|
|
return |
|
|
|
} |
|
|
|
max := db.GetMaxPrice(eg, req["uid"], minMoney) |
|
|
|
if max != nil { |
|
|
|
sum := zhios_order_relate_utils.StrToFloat64(max.OtherPrice) + leavePrice |
|
|
|
if sum >= 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 { |
|
|
|