From 9157de94710e82cbf9b3c65a5ca268c19319b49c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 13 Oct 2022 18:59:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=A5=96=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/library/api_getreward.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/library/api_getreward.go b/modules/library/api_getreward.go index 3579caf6f..44a956652 100644 --- a/modules/library/api_getreward.go +++ b/modules/library/api_getreward.go @@ -21,7 +21,7 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.LibraryGetRewa if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } - rsp := &pb.LibraryGetListResp{} + rsp := &pb.LibraryGetRewardResp{} defer session.SendMsg(string(this.module.GetType()), LibraryGetRewardResp, rsp) fetter := this.module.getLibraryByObjID(session.GetUserId(), req.ObjId) if fetter == nil { @@ -41,11 +41,15 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.LibraryGetRewa } fetter.Prize[req.Fetterlv] = 1 // 发奖 - if code = this.module.DispenseRes(session, conf.Prize, true); code != pb.ErrorCode_Success { // - return + if len(conf.Prize) != 0 { + if code = this.module.DispenseRes(session, conf.Prize, true); code != pb.ErrorCode_Success { // + return + } } + mapData := make(map[string]interface{}, 0) mapData["prize"] = fetter.Prize this.module.ModifyLibraryData(session.GetUserId(), fetter.Id, mapData) // 更新内存信息 + rsp.Data = fetter return }