From 23d44b7c00081c1e81b2b84b6ed5d0a661bdb024 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 2 Dec 2022 10:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=BA=97=E8=B4=AD=E4=B9=B0=E6=89=93?= =?UTF-8?q?=E6=8A=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_buy.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/hero/api_buy.go b/modules/hero/api_buy.go index df951e7cc..dcd6e13e4 100644 --- a/modules/hero/api_buy.go +++ b/modules/hero/api_buy.go @@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb totalCount int32 // 当前购买的总次数 update map[string]interface{} price []int32 // 购买所需的价钱 - totalCost float32 // 购买打折系数 + totalCost float64 // 购买打折系数 udata *pb.DBUser ) update = make(map[string]interface{}) @@ -75,16 +75,17 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb for i := record.Onebuy; i < req.BuyCount; i++ { if i >= int32(len(price)) { - totalCost += float32(price[len(price)-1]) / 1000 + totalCost += float64(price[len(price)-1]) / 1000 + continue } - totalCost += float32(price[i]) / 1000 + totalCost += float64(price[i]) / 1000 } need = make([]*cfg.Gameatn, len(conf.Need)) for i, v := range conf.Need { need[i] = &cfg.Gameatn{ A: v.A, T: v.T, - N: int32(math.Ceil(float64(v.N) * float64(totalCost))), + N: int32(math.Ceil(float64(v.N) * totalCost)), } } // 消耗