diff --git a/modules/library/api_activationfetter.go b/modules/library/api_activationfetter.go index 5ddb169be..9054828d8 100644 --- a/modules/library/api_activationfetter.go +++ b/modules/library/api_activationfetter.go @@ -36,6 +36,6 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library mapData := make(map[string]interface{}, 0) mapData["activation"] = fetter.Activation this.module.modelLibrary.modifyLibraryDataByObjId(session.GetUserId(), fetter.Id, mapData) - + rsp.Data = fetter return } diff --git a/modules/library/api_getreward.go b/modules/library/api_getreward.go index 2841d3995..3579caf6f 100644 --- a/modules/library/api_getreward.go +++ b/modules/library/api_getreward.go @@ -22,13 +22,13 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.LibraryGetRewa return // 参数校验失败直接返回 } rsp := &pb.LibraryGetListResp{} - defer session.SendMsg(string(this.module.GetType()), LibraryGetListResp, rsp) + defer session.SendMsg(string(this.module.GetType()), LibraryGetRewardResp, rsp) fetter := this.module.getLibraryByObjID(session.GetUserId(), req.ObjId) if fetter == nil { code = pb.ErrorCode_LibraryNoData return } - conf := this.configure.GetLibraryFetter(fetter.Fid, req.Fetterlv) + conf := this.module.configure.GetLibraryFetter(fetter.Fid, req.Fetterlv) if conf == nil { code = pb.ErrorCode_ConfigNoFound return diff --git a/modules/library/module.go b/modules/library/module.go index 8956169c2..814585969 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -66,31 +66,29 @@ func (this *Library) GetLibraryListByFid(uid string, fid int32) *pb.DBLibrary { } //通过羁绊id 创建多个羁绊信息 -func (this *Library) CreateLibrary(uid string, fids []int32, heroConfId string) (code pb.ErrorCode, objLibrary []*pb.DBLibrary) { - for _, fid := range fids { - obj := &pb.DBLibrary{ - Id: primitive.NewObjectID().Hex(), - Uid: uid, - Fid: fid, - Hero: map[string]int32{}, - Prize: map[int32]int32{}, - Fetterlv: 0, - } +func (this *Library) CreateLibrary(uid string, fid int32, heroConfId string) (code pb.ErrorCode, objLibrary []*pb.DBLibrary) { + obj := &pb.DBLibrary{ + Id: primitive.NewObjectID().Hex(), + Uid: uid, + Fid: fid, + Hero: map[string]int32{}, + Prize: map[int32]int32{}, + Fetterlv: 0, + } - conf := this.configure.GetLibraryFetter(fid, 1) - if conf != nil { - for _, v := range conf.Hid { - obj.Hero[v] = 0 // 默认值 - if v == heroConfId { - obj.Hero[heroConfId] = 1 // 获得的英雄好感度等级为1级 - } + conf := this.configure.GetLibraryFetter(fid, 1) + if conf != nil { + for _, v := range conf.Hid { + obj.Hero[v] = 0 // 默认值 + if v == heroConfId { + obj.Hero[heroConfId] = 1 // 获得的英雄好感度等级为1级 } - if err := this.modelLibrary.createLibrary(uid, obj); err != nil { - code = pb.ErrorCode_DBError - break - } - objLibrary = append(objLibrary, obj) } + if err := this.modelLibrary.createLibrary(uid, obj); err != nil { + code = pb.ErrorCode_DBError + + } + objLibrary = append(objLibrary, obj) } return @@ -108,7 +106,7 @@ func (this *Library) GetHeroFetterList(uid string) []*pb.DBHeroFetter { // 创建一条英雄羁绊信息 func (this *Library) createHeroFetter(uid string, heroConfId string) (code pb.ErrorCode) { - + this.modelFetter.getHeroFetterList(uid) obj := &pb.DBHeroFetter{ Id: primitive.NewObjectID().Hex(), Uid: uid, @@ -149,12 +147,12 @@ func (this *Library) AddHeroFetterData(uid string, heroConfId string) { obj := this.GetLibraryListByFid(uid, fid) if obj == nil { // 没有羁绊信息 this.createHeroFetter(uid, heroConfId) - this.CreateLibrary(uid, []int32{fid}, heroConfId) + this.CreateLibrary(uid, fid, heroConfId) } else { // 羁绊信息中没有这个heroid 也需要加进来 for k, v := range obj.Hero { if v == 0 && k == heroConfId { - v = 1 + obj.Hero[k] = 1 } } // 重新计算最低等级 diff --git a/pb/moonfantasy_msg.pb.go b/pb/moonfantasy_msg.pb.go index d7a564575..c69e25d43 100644 --- a/pb/moonfantasy_msg.pb.go +++ b/pb/moonfantasy_msg.pb.go @@ -20,7 +20,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -//获取装备列表请求 +//获取秘境列表请求 type MoonfantasyGetListReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -59,7 +59,7 @@ func (*MoonfantasyGetListReq) Descriptor() ([]byte, []int) { return file_moonfantasy_moonfantasy_msg_proto_rawDescGZIP(), []int{0} } -//获取装备列表请求 回应 +//获取秘境列表请求 回应 type MoonfantasyGetListResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -123,7 +123,7 @@ func (x *MoonfantasyGetListResp) GetDfantasys() []*DBMoonFantasy { return nil } -///触发秘境 +///推送触发秘境 type MoonfantasyTriggerPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache