From d3d0c627ffec11e2352032d4bb9628b2921f3481 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 10 May 2023 10:29:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=AF=8F=E6=97=A5=E4=B8=80?= =?UTF-8?q?=E7=BB=83=E5=88=B7=E6=96=B0=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/practice/api_gymrefresh.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/practice/api_gymrefresh.go b/modules/practice/api_gymrefresh.go index ff07ac877..9d7291640 100644 --- a/modules/practice/api_gymrefresh.go +++ b/modules/practice/api_gymrefresh.go @@ -20,6 +20,7 @@ func (this *apiComp) GymRefresh(session comm.IUserSession, req *pb.PracticeGymRe err error room *pb.DBPracticeRoom confs []*cfg.GamePandamasMrylData + temp []*cfg.GamePandamasMrylData refreshAtns []*cfg.Gameatn atn *cfg.Gameatn ) @@ -46,11 +47,11 @@ func (this *apiComp) GymRefresh(session comm.IUserSession, req *pb.PracticeGymRe code = pb.ErrorCode_ConfigNoFound return } + temp = make([]*cfg.GamePandamasMrylData, 0) //过滤掉当前的buff - for i, v := range confs { - if v.Id == room.Gymaction { - confs = append(confs[0:i], confs[i+1:]...) - break + for _, v := range confs { + if v.Id != room.Gymaction { + temp = append(temp, v) } } if len(confs) == 0 { @@ -58,7 +59,7 @@ func (this *apiComp) GymRefresh(session comm.IUserSession, req *pb.PracticeGymRe return } r := rand.New(rand.NewSource(configure.Now().Unix())) - room.Gymaction = confs[r.Perm(len(confs))[0]].Id + room.Gymaction = temp[r.Perm(len(temp))[0]].Id room.Gymrefresh++ room.Lastrefresh = configure.Now().Unix() this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{