From e78d2590e5eac4b773354984a8531fd0bcea601b Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 28 Jul 2023 11:50:01 +0800 Subject: [PATCH] =?UTF-8?q?float64=20=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/library/api_usegift.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index be4492d75..d4c19a917 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/utils" + "math" ) // 参数校验 @@ -97,7 +98,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe for _, v := range _c.LikesFood { // 喜欢的食物 if v == req.Items { likeStates = 1 - addExp *= this.module.ModuleTools.GetGlobalConf().FavorabilityLikes * req.Counts / 1000 + addExp = int32(math.Floor(float64(addExp*this.module.ModuleTools.GetGlobalConf().FavorabilityLikes*req.Counts) / 1000)) break } } @@ -105,7 +106,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe for _, v := range _c.DislikingFood { //不喜欢 if v == req.Items { likeStates = 2 - addExp *= this.module.ModuleTools.GetGlobalConf().FavorabilityDislikes * req.Counts / 1000 + addExp = int32(math.Floor(float64(addExp*this.module.ModuleTools.GetGlobalConf().FavorabilityDislikes*req.Counts) / 1000)) break } }