From 304ea2c0cc11f6173fa8e9546155fe75e8d78540 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 28 Jul 2023 11:50:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E7=BD=B2=E5=90=8C=E6=AD=A5?= 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 b2d9e63ea..bac43ff96 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 } }