发奖判断

This commit is contained in:
meixiongfeng 2022-10-13 18:59:06 +08:00
parent 153ffd253f
commit 9157de9471

View File

@ -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
}