diff --git a/comm/const.go b/comm/const.go index 2c2df8e4f..29cbb354d 100644 --- a/comm/const.go +++ b/comm/const.go @@ -332,6 +332,8 @@ const ( //Rpc RPC_ParkourTrusteeship core.Rpc_Key = "RPC_ParkourTrusteeship" //捕羊大赛托管 Rpc_ModuleCaravanSettlement core.Rpc_Key = "Rpc_ModuleCaravanSettlement" //商队比赛结算信息 + + Rpc_ModuleBuriedTrigger core.Rpc_Key = "Rpc_ModuleBuriedTrigger" //埋点跨服触发通知 ) // 事件类型定义处 diff --git a/comm/imodule.go b/comm/imodule.go index d3bd790eb..d9f9f1b64 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -506,7 +506,7 @@ type ( //埋点中心 IBuried interface { //埋点中心触发 - TriggerBuried(uid string, burieds ...*BuriedParam) + TriggerBuried(uid string, burieds ...*pb.BuriedParam) //校验条件是否达成 CheckCondition(uid string, condiIds ...int32) (condIds []int32, err error) //激活条件 diff --git a/comm/pool.go b/comm/pool.go index 0ae009f2a..0d514f6e7 100644 --- a/comm/pool.go +++ b/comm/pool.go @@ -1,6 +1,7 @@ package comm import ( + "go_dreamfactory/pb" "sync" ) @@ -25,7 +26,7 @@ func PuttaskParam(r *TaskParam) { var buriedParamPool = &sync.Pool{ New: func() interface{} { - return &BuriedParam{ + return &pb.BuriedParam{ Value: 0, Filter: make([]int32, 0), } @@ -33,9 +34,9 @@ var buriedParamPool = &sync.Pool{ } //普通任务 -func GetBuriedParam(t TaskType, vaule int32, p ...int32) *BuriedParam { - task := buriedParamPool.Get().(*BuriedParam) - task.Btype = t +func GetBuriedParam(t TaskType, vaule int32, p ...int32) *pb.BuriedParam { + task := buriedParamPool.Get().(*pb.BuriedParam) + task.TaskType = int32(t) task.Value = vaule if len(p) > 0 { task.Filter = append(task.Filter, p...) @@ -44,9 +45,9 @@ func GetBuriedParam(t TaskType, vaule int32, p ...int32) *BuriedParam { } //统计型任务 -func GetBuriedParam2(t TaskType, statistics string, p ...int32) *BuriedParam { - task := buriedParamPool.Get().(*BuriedParam) - task.Btype = t +func GetBuriedParam2(t TaskType, statistics string, p ...int32) *pb.BuriedParam { + task := buriedParamPool.Get().(*pb.BuriedParam) + task.TaskType = int32(t) task.Statistics = statistics if len(p) > 0 { task.Filter = append(task.Filter, p...) @@ -54,7 +55,7 @@ func GetBuriedParam2(t TaskType, statistics string, p ...int32) *BuriedParam { return task } -func PutburiedParam(r *BuriedParam) { +func PutburiedParam(r *pb.BuriedParam) { r.Filter = r.Filter[:0] r.Value = 0 r.Statistics = "" diff --git a/modules/buried/configure.go b/modules/buried/configure.go index 21f2e62fb..7fc5266a2 100644 --- a/modules/buried/configure.go +++ b/modules/buried/configure.go @@ -21,7 +21,7 @@ type configureComp struct { modules.MCompConfigure module *Buried lock sync.RWMutex - group map[comm.TaskType][]*cfg.GameBuriedCondiData //安排点类型 分组 + group map[int32][]*cfg.GameBuriedCondiData //安排点类型 分组 } //组件初始化接口 @@ -75,7 +75,7 @@ func (this *configureComp) checkconfig() (err error) { } //读取埋点配置数据 -func (this *configureComp) getburiedtypedata(tt comm.TaskType) (result *cfg.GameBuriedTypeData, err error) { +func (this *configureComp) getburiedtypedata(tt int32) (result *cfg.GameBuriedTypeData, err error) { var ( v interface{} ok bool @@ -84,7 +84,7 @@ func (this *configureComp) getburiedtypedata(tt comm.TaskType) (result *cfg.Game this.module.Errorf("err:%v", err) return } else { - if result, ok = v.(*cfg.GameBuriedType).GetDataMap()[int32(tt)]; !ok { + if result, ok = v.(*cfg.GameBuriedType).GetDataMap()[tt]; !ok { err = comm.NewNotFoundConfErr(moduleName, game_buriedtype, tt) this.module.Errorf("err:%v", err) return @@ -121,12 +121,12 @@ func (this *configureComp) updateconfigure() { err = fmt.Errorf("%T is *cfg.GameBuriedCondi", v) return } else { - group := map[comm.TaskType][]*cfg.GameBuriedCondiData{} + group := map[int32][]*cfg.GameBuriedCondiData{} for _, v := range data.GetDataList() { - if _, ok = group[comm.TaskType(v.Type)]; !ok { - group[comm.TaskType(v.Type)] = make([]*cfg.GameBuriedCondiData, 0) + if _, ok = group[v.Type]; !ok { + group[v.Type] = make([]*cfg.GameBuriedCondiData, 0) } - group[comm.TaskType(v.Type)] = append(group[comm.TaskType(v.Type)], v) + group[v.Type] = append(group[v.Type], v) } this.lock.Lock() this.group = group @@ -136,7 +136,7 @@ func (this *configureComp) updateconfigure() { } //读取埋点条件配置 -func (this *configureComp) getCondiDatas(tt comm.TaskType) (result []*cfg.GameBuriedCondiData) { +func (this *configureComp) getCondiDatas(tt int32) (result []*cfg.GameBuriedCondiData) { result = make([]*cfg.GameBuriedCondiData, 0) this.lock.RLock() if _, ok := this.group[tt]; ok { diff --git a/modules/buried/core.go b/modules/buried/core.go index dbbc02fbc..9d99337b8 100644 --- a/modules/buried/core.go +++ b/modules/buried/core.go @@ -1,8 +1,8 @@ package buried import ( - "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" + "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" ) @@ -32,7 +32,7 @@ const ( ) //判断埋点数据的有效性 -func checkburied(buried *comm.BuriedParam, bconf *cfg.GameBuriedTypeData, conf *cfg.GameBuriedCondiData) (efficient bool) { +func checkburied(buried *pb.BuriedParam, bconf *cfg.GameBuriedTypeData, conf *cfg.GameBuriedCondiData) (efficient bool) { if !(len(buried.Filter) == len(conf.Filter) && len(bconf.Filter) == len(conf.Filter)) { log.Error("校验埋点错误!", log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf}) return diff --git a/modules/buried/module.go b/modules/buried/module.go index d415ef847..6a42ba2c6 100644 --- a/modules/buried/module.go +++ b/modules/buried/module.go @@ -1,6 +1,7 @@ package buried import ( + "context" "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/base" @@ -10,6 +11,7 @@ import ( "go_dreamfactory/modules" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" + "go_dreamfactory/sys/db" "time" "go.mongodb.org/mongo-driver/bson/primitive" @@ -188,9 +190,28 @@ func (this *Buried) CheckAndActiveCondition(uid string, condiIds ...int32) (cond } //触发埋点 -func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) { +func (this *Buried) TriggerBuried(uid string, burieds ...*pb.BuriedParam) { + if db.IsCross() { + stag, _ := comm.UidToSTag(uid) + if _, err := this.service.AcrossClusterRpcGo( + context.Background(), + stag, + comm.Service_Worker, + string(comm.Rpc_ModuleBuriedTrigger), + pb.Rpc_ModuleBuriedTriggerReq{ + Burieds: burieds, + }, + nil); err != nil { + this.Error("远程触发埋点错误!", log.Field{Key: "burieds", Value: burieds}, log.Field{Key: "err", Value: err.Error()}) + } + } else { + this.trigger(uid, burieds...) + } +} + +func (this *Buried) trigger(uid string, burieds ...*pb.BuriedParam) { var ( - pass map[*comm.BuriedParam][]*cfg.GameBuriedCondiData = make(map[*comm.BuriedParam][]*cfg.GameBuriedCondiData) + pass map[*pb.BuriedParam][]*cfg.GameBuriedCondiData = make(map[*pb.BuriedParam][]*cfg.GameBuriedCondiData) bconf *cfg.GameBuriedTypeData model *buriedModel bdatas map[int32]*pb.DBBuried @@ -208,9 +229,9 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) { return } for _, buried := range burieds { - conds := this.configure.getCondiDatas(buried.Btype) - if bconf, err = this.configure.getburiedtypedata(buried.Btype); err != nil { - this.Error("未找到目标埋点类型配置", log.Field{Key: "type", Value: buried.Btype}) + conds := this.configure.getCondiDatas(buried.TaskType) + if bconf, err = this.configure.getburiedtypedata(buried.TaskType); err != nil { + this.Error("未找到目标埋点类型配置", log.Field{Key: "type", Value: buried.TaskType}) continue } for _, cond := range conds { @@ -231,18 +252,18 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) { change = make([]*pb.DBBuried, 0) //处理校验通过埋点数据 for buried, conds := range pass { - if bconf, err = this.configure.getburiedtypedata(buried.Btype); err != nil { - this.Error("未找到目标埋点类型配置", log.Field{Key: "type", Value: buried.Btype}) + if bconf, err = this.configure.getburiedtypedata(buried.TaskType); err != nil { + this.Error("未找到目标埋点类型配置", log.Field{Key: "type", Value: buried.TaskType}) continue } - if bdata, ok = bdatas[int32(buried.Btype)]; !ok { - bdatas[int32(buried.Btype)] = &pb.DBBuried{ + if bdata, ok = bdatas[int32(buried.TaskType)]; !ok { + bdatas[int32(buried.TaskType)] = &pb.DBBuried{ Id: primitive.NewObjectID().Hex(), Uid: uid, - Btype: int32(buried.Btype), + Btype: int32(buried.TaskType), Items: make(map[int32]*pb.DBBuriedItem), } - bdata = bdatas[int32(buried.Btype)] + bdata = bdatas[int32(buried.TaskType)] } for _, cond := range conds { if cond.Rtype == rtype1 { //创号后入录 @@ -273,7 +294,7 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) { } //更新并校验完成 -func (this *Buried) updateAndCheckBuried(bconf *cfg.GameBuriedTypeData, bdata *pb.DBBuried, collec *comm.BuriedParam, cond *cfg.GameBuriedCondiData, autoActivated bool) (complete bool, err error) { +func (this *Buried) updateAndCheckBuried(bconf *cfg.GameBuriedTypeData, bdata *pb.DBBuried, collec *pb.BuriedParam, cond *cfg.GameBuriedCondiData, autoActivated bool) (complete bool, err error) { var ( ok bool bitem *pb.DBBuriedItem diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index 13bbe809b..837743345 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -30,8 +30,8 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) minstr int32 = 9999 minlv int32 = 9999 hero *pb.DBHero - suite1Str, suite1Lv, suite2Str, suite2Lv int32 = math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32 - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + suite1Str, suite1Lv, suite2Str, suite2Lv int32 = math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32 + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success { diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go index 512232f6e..7cd770a36 100644 --- a/modules/equipment/api_upgrade.go +++ b/modules/equipment/api_upgrade.go @@ -35,7 +35,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade issucc bool suite1Lv, suite2Lv int32 = math.MaxInt32, math.MaxInt32 user *pb.DBUser - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success { return diff --git a/modules/equipment/modelEquipment.go b/modules/equipment/modelEquipment.go index 0e405efc1..0a1e41f1f 100644 --- a/modules/equipment/modelEquipment.go +++ b/modules/equipment/modelEquipment.go @@ -96,8 +96,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma var ( configure *cfg.GameEquip add map[string]*pb.DB_Equipment - uId string = session.GetUserId() - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + uId string = session.GetUserId() + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil { return diff --git a/modules/friend/api_cross_agree.go b/modules/friend/api_cross_agree.go index 6d699b53b..cf9e469f8 100644 --- a/modules/friend/api_cross_agree.go +++ b/modules/friend/api_cross_agree.go @@ -135,7 +135,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c // 拥有xx个好友 // this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds))) - var sz []*comm.BuriedParam + var sz []*pb.BuriedParam for _, v := range req.FriendIds { sz = append(sz, comm.GetBuriedParam2(comm.Rtype10, v)) } diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index 4305ece8c..27f090a1a 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -105,7 +105,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam2(comm.Rtype34, _hero.HeroID, _hero.JuexingLv)) - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam //szTask = append(szTask, comm.GetBuriedParam(comm.Rtype34, 1, _hero.JuexingLv)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID))) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID))) @@ -114,7 +114,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c szTask = append(szTask, comm.GetBuriedParam(comm.Rtype122, _hero.JuexingLv, _hero.Star)) cfg, err := this.module.configure.GetHeroConfig(_hero.HeroID) if err == nil { - var sz []*comm.BuriedParam + var sz []*pb.BuriedParam // 校验共鸣满级 var _l int32 talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) diff --git a/modules/hero/api_buy.go b/modules/hero/api_buy.go index 3ff4d85e9..677a03dd1 100644 --- a/modules/hero/api_buy.go +++ b/modules/hero/api_buy.go @@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb price []int32 // 购买所需的价钱 totalCost float64 // 购买打折系数 udata *pb.DBUser - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) update = make(map[string]interface{}) if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index 3937952e7..760e51c48 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -118,7 +118,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt } // 推送 世界任务消息 - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam szTask = append(szTask, comm.GetBuriedParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID))) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype53, 1)) diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index fbb92c226..dd6bb0ec1 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -90,7 +90,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr } // 推送 世界任务消息 - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam szTask = append(szTask, comm.GetBuriedParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID))) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam2(comm.Rtype25, _hero.HeroID, _hero.Star)) diff --git a/modules/hero/api_talentlearn.go b/modules/hero/api_talentlearn.go index d34e4bbad..97d8a2ad9 100644 --- a/modules/hero/api_talentlearn.go +++ b/modules/hero/api_talentlearn.go @@ -136,10 +136,10 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe Telnet: talent, TalentID: req.TalentID, // 返回刚学习过的天赋ID }) - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam // 查询英雄相关信息 if heroObj := this.module.QueryHeroByConfId(session.GetUserId(), talent.HeroId); heroObj != nil { - var sz []*comm.BuriedParam + var sz []*pb.BuriedParam sz = append(sz, comm.GetBuriedParam2(comm.Rtype123, heroObj.HeroID, heroObj.Star)) sz = append(sz, comm.GetBuriedParam2(comm.Rtype124, heroObj.HeroID)) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index e2d3aa9ee..e1d679ed5 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -586,7 +586,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex } if curLv-preLv > 0 { // 升级了 统计任务 - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam szTask = append(szTask, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, curLv-preLv)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID))) @@ -615,7 +615,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex } if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { //szTask = append(szTask, comm.GetBuriedParam(comm.Rtype37, 1, cfg.Color)) - var sz []*comm.BuriedParam + var sz []*pb.BuriedParam sz = append(sz, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) sz = append(sz, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), sz...) diff --git a/modules/hero/module.go b/modules/hero/module.go index 600797f31..044eb870b 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -96,7 +96,7 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, // 查品质 cfg, _ := this.configure.GetHeroConfig(heroCfgId) if cfg != nil { - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam szTask = append(szTask, comm.GetBuriedParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId))) go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam2(comm.Rtype30, heroCfgId, cfg.Color)) @@ -168,7 +168,7 @@ func (this *Hero) SendRdTask(session comm.IUserSession) { equipmap[v.SuiteExtId][v.Suite2Star]++ } } - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam for k, v := range equipmap { for k1, v1 := range v { szTask = append(szTask, comm.GetBuriedParam(comm.Rtype46, v1, k1, k)) @@ -722,7 +722,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) { func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCount int32, itype bool) { // 任务统计 var ( - szTask []*comm.BuriedParam + szTask []*pb.BuriedParam ) if itype { //普通招募 if drawCount == 10 { diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go index af0195c67..4aee59de6 100644 --- a/modules/hunting/api_challengeover.go +++ b/modules/hunting/api_challengeover.go @@ -23,11 +23,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha mapData map[string]interface{} newChallenge bool // 新的关卡 reward []*cfg.Gameatn - bWin bool // 战斗是否胜利 - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) - del []string // 自动出售的装备 - atno []*pb.UserAtno // atno 类型 - res []*cfg.Gameatn // 最后获得的资源 + bWin bool // 战斗是否胜利 + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) + del []string // 自动出售的装备 + atno []*pb.UserAtno // atno 类型 + res []*cfg.Gameatn // 最后获得的资源 ) mapData = make(map[string]interface{}, 0) reward = make([]*cfg.Gameatn, 0) diff --git a/modules/items/module.go b/modules/items/module.go index 6aac7372c..9e0ea1d88 100644 --- a/modules/items/module.go +++ b/modules/items/module.go @@ -137,7 +137,7 @@ func (this *Items) AddItem(session comm.IUserSession, itemid string, addnum int3 ///添加多个物品到背包 (可以加物品和减物品) func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, bPush bool) (change []*pb.DB_UserItemData, code pb.ErrorCode) { var ( - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) err error ) diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index af5fa8c1a..b9e7ccd9a 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -161,7 +161,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe return } } - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam szTask = append(szTask, comm.GetBuriedParam(comm.Rtype132, 1, _heroObj.Favorlv)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid))) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype134, upLv)) diff --git a/modules/mline/api_challengeover.go b/modules/mline/api_challengeover.go index 6fa341858..611e9340a 100644 --- a/modules/mline/api_challengeover.go +++ b/modules/mline/api_challengeover.go @@ -26,8 +26,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall first bool // 判断是否是首通 update map[string]interface{} rsp *pb.MlineChallengeOverResp - star int32 // 评星 - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + star int32 // 评星 + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) rsp = &pb.MlineChallengeOverResp{} update = make(map[string]interface{}) diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go index cc7f55108..15d5f8f5d 100644 --- a/modules/shop/api_buy.go +++ b/modules/shop/api_buy.go @@ -26,7 +26,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb record *pb.UserShopData need []*cfg.Gameatn give []*cfg.Gameatn - tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0) + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { return diff --git a/modules/smithy/api_atlasactivate.go b/modules/smithy/api_atlasactivate.go index 013ecad9f..b01c8916c 100644 --- a/modules/smithy/api_atlasactivate.go +++ b/modules/smithy/api_atlasactivate.go @@ -17,7 +17,7 @@ func (this *apiComp) AtlasActivateCheck(session comm.IUserSession, req *pb.Smith func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtlasActivateReq) (code pb.ErrorCode, data *pb.ErrorData) { var ( addScore int32 // 更新图鉴增加的积分 - szTask []*comm.BuriedParam + szTask []*pb.BuriedParam ) code = this.AtlasActivateCheck(session, req) if code != pb.ErrorCode_Success { diff --git a/modules/smithy/api_rise.go b/modules/smithy/api_rise.go index 204ebaf26..d33ada951 100644 --- a/modules/smithy/api_rise.go +++ b/modules/smithy/api_rise.go @@ -60,7 +60,7 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (cod update["temperature"] = stove.Temperature this.module.modelStove.updateSmithyStove(session.GetUserId(), update) session.SendMsg(string(this.module.GetType()), "rise", &pb.SmithyRiseResp{Data: stove}) - tasks := make([]*comm.BuriedParam, 0) + tasks := make([]*pb.BuriedParam, 0) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype175, stove.Temperature)) this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...) } diff --git a/modules/smithy/module.go b/modules/smithy/module.go index f6e06724f..921c0982f 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -123,7 +123,7 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) { func (this *Smithy) SendRdTask(session comm.IUserSession, Items []*pb.UserAtno) { var equip map[int32]int32 // key xingji value 数量 equip = make(map[int32]int32, 0) - tasks := make([]*comm.BuriedParam, 0) + tasks := make([]*pb.BuriedParam, 0) for _, v := range Items { if cfg := this.configure.GetEquipmentConfigureById(v.T); cfg != nil { equip[cfg.Star]++ diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index a09723ad7..7c48787c0 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -170,7 +170,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal this.module.Errorf("no found userdata uid:%s", session.GetUserId()) } // 随机任务统计 - var szTask []*comm.BuriedParam + var szTask []*pb.BuriedParam szTask = append(szTask, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty)) //szTask = append(szTask, comm.GetBuriedParam(comm.Rtype74, req.BossId, req.Difficulty)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype78, req.BossId, req.Difficulty, req.Report.Costtime)) diff --git a/modules/viking/module.go b/modules/viking/module.go index bc6f30ed2..3c5a30d49 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -255,7 +255,7 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR difficulty := autoBattle.Difficulty atno = make([]*pb.UserAtno, 0) conf := this.configure.GetVikingBossConfigData(bossId, difficulty) - tasks := make([]*comm.BuriedParam, 0) + tasks := make([]*pb.BuriedParam, 0) // costRes := this.ModuleTools.GetGlobalConf().VikingExpeditionCos // if costRes == nil { // code = pb.ErrorCode_ConfigNoFound diff --git a/pb/buried_db.pb.go b/pb/buried_db.pb.go index a37f2f6f6..b612ad9d1 100644 --- a/pb/buried_db.pb.go +++ b/pb/buried_db.pb.go @@ -225,6 +225,77 @@ func (x *DBBuried) GetItems() map[int32]*DBBuriedItem { return nil } +type BuriedParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskType int32 `protobuf:"varint,1,opt,name=taskType,proto3" json:"taskType"` //埋点类型 + Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value"` //累加或者覆盖参数 + Statistics string `protobuf:"bytes,3,opt,name=statistics,proto3" json:"statistics"` //统计类型 传递参数 + Filter []int32 `protobuf:"varint,4,rep,packed,name=filter,proto3" json:"filter"` //埋点过滤参数 +} + +func (x *BuriedParam) Reset() { + *x = BuriedParam{} + if protoimpl.UnsafeEnabled { + mi := &file_buried_buried_db_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BuriedParam) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BuriedParam) ProtoMessage() {} + +func (x *BuriedParam) ProtoReflect() protoreflect.Message { + mi := &file_buried_buried_db_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BuriedParam.ProtoReflect.Descriptor instead. +func (*BuriedParam) Descriptor() ([]byte, []int) { + return file_buried_buried_db_proto_rawDescGZIP(), []int{2} +} + +func (x *BuriedParam) GetTaskType() int32 { + if x != nil { + return x.TaskType + } + return 0 +} + +func (x *BuriedParam) GetValue() int32 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *BuriedParam) GetStatistics() string { + if x != nil { + return x.Statistics + } + return "" +} + +func (x *BuriedParam) GetFilter() []int32 { + if x != nil { + return x.Filter + } + return nil +} + var File_buried_buried_db_proto protoreflect.FileDescriptor var file_buried_buried_db_proto_rawDesc = []byte{ @@ -251,12 +322,20 @@ var file_buried_buried_db_proto_rawDesc = []byte{ 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, - 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63, - 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, - 0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x10, 0x03, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x77, 0x0a, 0x0b, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, + 0x74, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, + 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2a, 0x48, + 0x0a, 0x0f, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, + 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, + 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -272,16 +351,17 @@ func file_buried_buried_db_proto_rawDescGZIP() []byte { } var file_buried_buried_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_buried_buried_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_buried_buried_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_buried_buried_db_proto_goTypes = []interface{}{ (BuriedItemState)(0), // 0: BuriedItemState (*DBBuriedItem)(nil), // 1: DBBuriedItem (*DBBuried)(nil), // 2: DBBuried - nil, // 3: DBBuried.ItemsEntry + (*BuriedParam)(nil), // 3: BuriedParam + nil, // 4: DBBuried.ItemsEntry } var file_buried_buried_db_proto_depIdxs = []int32{ 0, // 0: DBBuriedItem.state:type_name -> BuriedItemState - 3, // 1: DBBuried.items:type_name -> DBBuried.ItemsEntry + 4, // 1: DBBuried.items:type_name -> DBBuried.ItemsEntry 1, // 2: DBBuried.ItemsEntry.value:type_name -> DBBuriedItem 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type @@ -320,6 +400,18 @@ func file_buried_buried_db_proto_init() { return nil } } + file_buried_buried_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BuriedParam); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -327,7 +419,7 @@ func file_buried_buried_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_buried_buried_db_proto_rawDesc, NumEnums: 1, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/buried_msg.pb.go b/pb/buried_msg.pb.go index 163287d6b..58a244011 100644 --- a/pb/buried_msg.pb.go +++ b/pb/buried_msg.pb.go @@ -10,6 +10,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" + sync "sync" ) const ( @@ -19,21 +20,132 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type Rpc_ModuleBuriedTriggerReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Burieds []*BuriedParam `protobuf:"bytes,1,rep,name=burieds,proto3" json:"burieds"` +} + +func (x *Rpc_ModuleBuriedTriggerReq) Reset() { + *x = Rpc_ModuleBuriedTriggerReq{} + if protoimpl.UnsafeEnabled { + mi := &file_buried_buried_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Rpc_ModuleBuriedTriggerReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Rpc_ModuleBuriedTriggerReq) ProtoMessage() {} + +func (x *Rpc_ModuleBuriedTriggerReq) ProtoReflect() protoreflect.Message { + mi := &file_buried_buried_msg_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Rpc_ModuleBuriedTriggerReq.ProtoReflect.Descriptor instead. +func (*Rpc_ModuleBuriedTriggerReq) Descriptor() ([]byte, []int) { + return file_buried_buried_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *Rpc_ModuleBuriedTriggerReq) GetBurieds() []*BuriedParam { + if x != nil { + return x.Burieds + } + return nil +} + +type Rpc_ModuleBuriedTriggerResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Rpc_ModuleBuriedTriggerResp) Reset() { + *x = Rpc_ModuleBuriedTriggerResp{} + if protoimpl.UnsafeEnabled { + mi := &file_buried_buried_msg_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Rpc_ModuleBuriedTriggerResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Rpc_ModuleBuriedTriggerResp) ProtoMessage() {} + +func (x *Rpc_ModuleBuriedTriggerResp) ProtoReflect() protoreflect.Message { + mi := &file_buried_buried_msg_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Rpc_ModuleBuriedTriggerResp.ProtoReflect.Descriptor instead. +func (*Rpc_ModuleBuriedTriggerResp) Descriptor() ([]byte, []int) { + return file_buried_buried_msg_proto_rawDescGZIP(), []int{1} +} + var File_buried_buried_msg_proto protoreflect.FileDescriptor var file_buried_buried_msg_proto_rawDesc = []byte{ 0x0a, 0x17, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f, - 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x62, 0x75, 0x72, 0x69, 0x65, + 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x44, 0x0a, 0x1a, 0x52, 0x70, 0x63, 0x5f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, + 0x75, 0x72, 0x69, 0x65, 0x64, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, + 0x26, 0x0a, 0x07, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x07, + 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x73, 0x22, 0x1d, 0x0a, 0x1b, 0x52, 0x70, 0x63, 0x5f, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var file_buried_buried_msg_proto_goTypes = []interface{}{} +var ( + file_buried_buried_msg_proto_rawDescOnce sync.Once + file_buried_buried_msg_proto_rawDescData = file_buried_buried_msg_proto_rawDesc +) + +func file_buried_buried_msg_proto_rawDescGZIP() []byte { + file_buried_buried_msg_proto_rawDescOnce.Do(func() { + file_buried_buried_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_buried_buried_msg_proto_rawDescData) + }) + return file_buried_buried_msg_proto_rawDescData +} + +var file_buried_buried_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_buried_buried_msg_proto_goTypes = []interface{}{ + (*Rpc_ModuleBuriedTriggerReq)(nil), // 0: Rpc_ModuleBuriedTriggerReq + (*Rpc_ModuleBuriedTriggerResp)(nil), // 1: Rpc_ModuleBuriedTriggerResp + (*BuriedParam)(nil), // 2: BuriedParam +} var file_buried_buried_msg_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 2, // 0: Rpc_ModuleBuriedTriggerReq.burieds:type_name -> BuriedParam + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_buried_buried_msg_proto_init() } @@ -41,18 +153,46 @@ func file_buried_buried_msg_proto_init() { if File_buried_buried_msg_proto != nil { return } + file_buried_buried_db_proto_init() + if !protoimpl.UnsafeEnabled { + file_buried_buried_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Rpc_ModuleBuriedTriggerReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buried_buried_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Rpc_ModuleBuriedTriggerResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_buried_buried_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 0, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, GoTypes: file_buried_buried_msg_proto_goTypes, DependencyIndexes: file_buried_buried_msg_proto_depIdxs, + MessageInfos: file_buried_buried_msg_proto_msgTypes, }.Build() File_buried_buried_msg_proto = out.File file_buried_buried_msg_proto_rawDesc = nil diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index ff88486e1..186416a30 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -20,9 +20,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// 在pb目录下执行 go generate (先安装工具stringer go install golang.org/x/tools/cmd/stringer) 会生成errorcode_strings.go -// ps: 手动注释或删除重定义方法 errorcode.pb.go或 errorcode_strings中的String()方法 -//go:generate stringer -type ErrorCode -linecomment +// go:generate stringer -type ErrorCode -linecomment type ErrorCode int32 const ( @@ -1071,9 +1069,9 @@ func (x ErrorCode) Enum() *ErrorCode { return p } -// func (x ErrorCode) String() string { -// return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -// } +func (x ErrorCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} func (ErrorCode) Descriptor() protoreflect.EnumDescriptor { return file_errorcode_proto_enumTypes[0].Descriptor() diff --git a/pb/errorcode_string.go b/pb/errorcode_string.go index fcfcb7864..4466ec275 100644 --- a/pb/errorcode_string.go +++ b/pb/errorcode_string.go @@ -677,7 +677,7 @@ var _ErrorCode_map = map[ErrorCode]string{ 4605: _ErrorCode_name[6153:6171], } -func (i ErrorCode) String() string { +func (i ErrorCode) tString() string { if str, ok := _ErrorCode_map[i]; ok { return str } diff --git a/pb/unitls.go b/pb/unitls.go index 32dfcabac..1a5403eae 100644 --- a/pb/unitls.go +++ b/pb/unitls.go @@ -1,5 +1,5 @@ package pb func GetErrorCodeMsg(code ErrorCode) string { - return code.String() + return code.tString() }