From c31dcd3a23f35b33257a4659b1bf49ce940d8435 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 12 Mar 2024 10:02:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=93=E6=AD=A6=E8=84=B1?= =?UTF-8?q?=E8=A3=85=E5=A4=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/exclusive/api_starup.go | 7 +++++++ modules/exclusive/api_wear.go | 34 +++++++++++++++++---------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/modules/exclusive/api_starup.go b/modules/exclusive/api_starup.go index e33b6c47f..c23943875 100644 --- a/modules/exclusive/api_starup.go +++ b/modules/exclusive/api_starup.go @@ -34,6 +34,13 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe if v.Id == req.Oid { info = v } else { + if v.Islock { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: fmt.Sprintf("Exclusives:%s is lock", v.Id), + } + return + } stars += v.Star } } diff --git a/modules/exclusive/api_wear.go b/modules/exclusive/api_wear.go index 2cad9c775..678599dbf 100644 --- a/modules/exclusive/api_wear.go +++ b/modules/exclusive/api_wear.go @@ -34,24 +34,26 @@ func (this *apiComp) Wear(session comm.IUserSession, req *pb.ExclusiveWearReq) ( info.Hero = "" change = append(change, info) } - if info, err = this.module.model.getExclusivesById(session.GetUserId(), req.Oid); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Message: err.Error(), + if req.Oid != "" { + if info, err = this.module.model.getExclusivesById(session.GetUserId(), req.Oid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return } - return - } - info.Hero = hero.Id - change = append(change, info) - if err = this.module.model.updateExclusive(session.GetUserId(), change...); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Message: err.Error(), + info.Hero = hero.Id + change = append(change, info) + if err = this.module.model.updateExclusive(session.GetUserId(), change...); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, info); errdata != nil { + return } - return - } - if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, info); errdata != nil { - return } this.module.equipmentsChangePush(session, change) session.SendMsg(string(this.module.GetType()), "wear", &pb.ExclusiveWearResp{Exclusives: info})