From a1b86a0579bcc92fa171538400967538df471863 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 1 Sep 2022 09:52:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B0=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 4 +- go.mod | 8 +- go.sum | 6 + modules/rtask/api_choose.go | 3 +- modules/rtask/api_dotask.go | 7 +- modules/rtask/condiFindHandle.go | 35 +++++ modules/rtask/config.go | 4 +- modules/rtask/help.go | 94 +++++++++++++ modules/rtask/model_rtask.go | 172 ++++++----------------- modules/rtask/module.go | 226 +++++++++++++++++++++++++------ modules/rtask/updateHandle.go | 101 ++++++++++++++ modules/rtask/verifyHandle.go | 31 +++++ modules/rtask/verify_test.go | 63 +++++++++ pb/rtask_db.pb.go | 125 +++++++++++++---- 14 files changed, 667 insertions(+), 212 deletions(-) create mode 100644 modules/rtask/condiFindHandle.go create mode 100644 modules/rtask/help.go create mode 100644 modules/rtask/updateHandle.go create mode 100644 modules/rtask/verifyHandle.go create mode 100644 modules/rtask/verify_test.go diff --git a/comm/const.go b/comm/const.go index f19b98b65..12fdf6062 100644 --- a/comm/const.go +++ b/comm/const.go @@ -218,8 +218,8 @@ const ( Rtype9 TaskType = 9 //连续登陆xx天 Rtype10 TaskType = 10 //拥有xx个好友 Rtype11 TaskType = 11 //赠送X次友情点 - Rtask12 TaskType = 12 //使用好友助战英雄xx次 - Rtask13 TaskType = 13 //更换X次助战英雄 + Rtype12 TaskType = 12 //使用好友助战英雄xx次 + Rtype13 TaskType = 13 //更换X次助战英雄 Rtype14 TaskType = 14 //累计xx次普通招募 Rtype15 TaskType = 15 //累计xx次阵营招募 Rtype16 TaskType = 16 //招募获得xx品质英雄xx个 diff --git a/go.mod b/go.mod index db653abbe..5bc76ba9b 100644 --- a/go.mod +++ b/go.mod @@ -41,11 +41,16 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -require github.com/kr/fs v0.1.0 // indirect +require ( + github.com/jtolds/gls v4.20.0+incompatible // indirect + github.com/kr/fs v0.1.0 // indirect + github.com/smartystreets/assertions v1.2.0 // indirect +) require ( fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 // indirect github.com/PuerkitoBio/goquery v1.8.0 // indirect + github.com/agiledragon/gomonkey/v2 v2.8.0 github.com/akutz/memconn v0.1.0 // indirect github.com/andybalholm/cascadia v1.3.1 // indirect github.com/apache/thrift v0.16.0 // indirect @@ -136,6 +141,7 @@ require ( github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414 // indirect github.com/shirou/gopsutil/v3 v3.22.2 // indirect github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6 // indirect + github.com/smartystreets/goconvey v1.7.2 github.com/soheilhy/cmux v0.1.5 // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect diff --git a/go.sum b/go.sum index 9ce673e34..ecfead2f7 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,8 @@ github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00 github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y= github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U= github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI= +github.com/agiledragon/gomonkey/v2 v2.8.0 h1:u2K2nNGyk0ippzklz1CWalllEB9ptD+DtSXeCX5O000= +github.com/agiledragon/gomonkey/v2 v2.8.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/akutz/memconn v0.1.0 h1:NawI0TORU4hcOMsMr11g7vwlCdkYeLKXBcxWu2W/P8A= github.com/akutz/memconn v0.1.0/go.mod h1:Jo8rI7m0NieZyLI5e2CDlRdRqRRB4S7Xp77ukDjH+Fw= @@ -678,9 +680,13 @@ github.com/smallnest/rpcx v1.7.4 h1:u6ADk/Ep8BqtAoJZO7LbniWsP+nqeAtcbaPm2D4eOXg= github.com/smallnest/rpcx v1.7.4/go.mod h1:TSciUoPlm8MYxnC7ErCz5ZymOFxOTbhN9cRgEI6Degs= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= +github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= +github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= diff --git a/modules/rtask/api_choose.go b/modules/rtask/api_choose.go index 2a8dd4a4f..33807d0fc 100644 --- a/modules/rtask/api_choose.go +++ b/modules/rtask/api_choose.go @@ -47,7 +47,8 @@ func (this *apiComp) Choose(session comm.IUserSession, req *pb.RtaskChooseReq) ( } // 校验限定条件 - if ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), chooseCnf.PreTid); !ok { + if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), chooseCnf.PreTid); !ok { + this.moduleRtask.Error(err.Error()) code = pb.ErrorCode_RtaskCondiNoReach return } diff --git a/modules/rtask/api_dotask.go b/modules/rtask/api_dotask.go index 34cbdfa5e..c5450d9a7 100644 --- a/modules/rtask/api_dotask.go +++ b/modules/rtask/api_dotask.go @@ -36,6 +36,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.RtaskApplyReq) (co var ( frtaskArr *pb.FrtaskIds ok bool + err error ) if frtaskArr, ok = rtask.FrtaskIds[conf.Group]; !ok { @@ -50,7 +51,8 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.RtaskApplyReq) (co if req.RtaskSubId == 0 { //校验前置任务和限定条件 - if code, ok = this.moduleRtask.modelRtask.checkHandle(session.GetUserId(), frtaskArr.RtaskIds, conf); !ok { + if err, ok = this.moduleRtask.modelRtask.checkHandle(session.GetUserId(), frtaskArr.RtaskIds, conf); !ok { + this.moduleRtask.Error(err.Error()) code = pb.ErrorCode_RtaskCondiNoReach return } @@ -78,7 +80,8 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.RtaskApplyReq) (co code = this.moduleRtask.DispenseRes(session, sideConf.Reward, true) } else { // 校验完成条件 - if ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), sideConf.EndTid); !ok { + if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), sideConf.EndTid); !ok { + this.moduleRtask.Error(err.Error()) code = pb.ErrorCode_RtaskCondiNoReach return } diff --git a/modules/rtask/condiFindHandle.go b/modules/rtask/condiFindHandle.go new file mode 100644 index 000000000..f475eff16 --- /dev/null +++ b/modules/rtask/condiFindHandle.go @@ -0,0 +1,35 @@ +// 匹配类型和参数,返回任务条件ID +package rtask + +import cfg "go_dreamfactory/sys/configure/structs" + +// 与每个参数比较 +func (this *ModelRtask) equalParams(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32) { + if len(vals) != 1 { + return + } + + var ( + err error + paramLen int + ) + if paramLen, err = verifyParam(cfg, vals...); err != nil { + return + } + + if paramLen == 1 { + if vals[0] == cfg.Data1 { + condiId = cfg.Id + } + } else if paramLen == 2 { + if vals[0] == cfg.Data1 && vals[1] == cfg.Data2 { + condiId = cfg.Id + } + } else if paramLen == 3 { + if vals[0] == cfg.Data1 && vals[1] == cfg.Data2 && vals[2] == cfg.Data3 { + condiId = cfg.Id + } + } + + return +} diff --git a/modules/rtask/config.go b/modules/rtask/config.go index 3fce06e8e..d49f25278 100644 --- a/modules/rtask/config.go +++ b/modules/rtask/config.go @@ -45,7 +45,7 @@ func (this *configureComp) getRtaskCfg() (data *cfg.GameRdtask, err error) { return } -func (this *configureComp) getRtaskTypeCfg() (data *cfg.GameRdtaskCondi, err error) { +func (this *configureComp) getRtaskCondiCfg() (data *cfg.GameRdtaskCondi, err error) { var ( v interface{} ok bool @@ -120,7 +120,7 @@ func (this *configureComp) getRtaskSidById(id int32) *cfg.GameRdtaskSideData { // 查询任务类型 func (this *configureComp) getRtaskTypeById(typeId int32) (data *cfg.GameRdtaskCondiData, err error) { - cfg, err := this.getRtaskTypeCfg() + cfg, err := this.getRtaskCondiCfg() if err != nil { return } diff --git a/modules/rtask/help.go b/modules/rtask/help.go new file mode 100644 index 000000000..1873ebb9e --- /dev/null +++ b/modules/rtask/help.go @@ -0,0 +1,94 @@ +package rtask + +import ( + "fmt" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + + "github.com/pkg/errors" +) + +func verifyParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) { + // if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 { + // if len(vals) != 3 { + // err = errors.New(fmt.Sprintf("参数个数不一致,期望3实际是%v", len(vals))) + // return + // } else { + // n = len(vals) + // } + // } + + if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 { + if len(vals) != 3 { + err = errors.New(fmt.Sprintf("参数个数不一致,期望3实际是%v", len(vals))) + return + } else { + n = len(vals) + } + } + + if cfg.Data1 != 0 && cfg.Data2 != 0 { + if len(vals) != 2 { + err = errors.New(fmt.Sprintf("参数个数不一致,期望2实际是%v", len(vals))) + return + } else { + n = len(vals) + } + } + + if cfg.Data1 != 0 { + if len(vals) != 1 { + err = errors.New(fmt.Sprintf("参数个数不一致,期望1实际是%v", len(vals))) + return + } else { + n = len(vals) + } + } + + return +} + +func toMap(vals ...int32) map[int32]int32 { + d := make(map[int32]int32, len(vals)) + for i, v := range vals { + d[int32(i)] = v + } + return d +} + +func toArr(m map[int32]int32) (params []int32) { + for _, v := range m { + params = append(params, v) + } + return +} + +func isEqual(len int, data *pb.RtaskData, cfg *cfg.GameRdtaskCondiData, vals ...int32) map[int32]int32 { + if data == nil || len == 0 { + return nil + } + res := make(map[int32]int32) + + if len == 1 { + if data.Data[0] != cfg.Data1 { + res[0] = vals[0] + } + } + + if len == 2 { + if data.Data[0] != cfg.Data1 || data.Data[1] != cfg.Data2 { + res[0] = vals[0] + res[1] = vals[1] + } + } + + if len == 3 { + if data.Data[0] != cfg.Data1 || data.Data[1] != cfg.Data2 || data.Data[2] != cfg.Data3 { + res[0] = vals[0] + res[1] = vals[1] + res[2] = vals[2] + } + } + + return res +} diff --git a/modules/rtask/model_rtask.go b/modules/rtask/model_rtask.go index 271c84166..b9e5c647a 100644 --- a/modules/rtask/model_rtask.go +++ b/modules/rtask/model_rtask.go @@ -3,14 +3,13 @@ package rtask import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/redis" "go_dreamfactory/modules" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/utils" - "github.com/spf13/cast" + "github.com/pkg/errors" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" ) @@ -46,18 +45,18 @@ func (this *ModelRtask) GetRtask(uid string) *pb.DBRtask { } // 做任务之前的校验 -func (this *ModelRtask) checkHandle(uid string, frtaskIds []int32, conf *cfg.GameRdtaskData) (code pb.ErrorCode, ok bool) { +func (this *ModelRtask) checkHandle(uid string, frtaskIds []int32, conf *cfg.GameRdtaskData) (err error, ok bool) { //判断前置任务状态 if conf.PreTid != 0 { - if _, ok := utils.Findx(frtaskIds, conf.PreTid); !ok { - code = pb.ErrorCode_RtaskPreNoFinish - return code, false + if _, ok = utils.Findx(frtaskIds, conf.PreTid); !ok { + err = errors.New("前置任务未完成") + return } } //验证限定条件 for _, v := range conf.Condition { - if ok = this.checkCondi(uid, v); !ok { + if err, ok = this.checkCondi(uid, v); !ok { return } } @@ -66,147 +65,52 @@ func (this *ModelRtask) checkHandle(uid string, frtaskIds []int32, conf *cfg.Gam } // 确定选项前的校验 -func (this *ModelRtask) checkCondi(uid string, condiId int32) (ok bool) { +func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok bool) { if condiId == 0 { - return true + return nil, true } //验证限定条件 - if condi, ok := this.moduleRtask.rtaskHandleMap[condiId]; ok { - if ok = condi.fn(uid, condi.cfg); !ok { - log.Debugf("uid: %v do rtask %v condition not reach", uid, condiId) - return false + var condi *rtaskCondi + if condi, ok = this.moduleRtask.handleMap[condiId]; ok { + if err, ok = condi.verify(uid, condi.cfg); !ok { + err = errors.WithMessagef(err, "uid: %v do rtask %v condition not reach", uid, condiId) + return } - return true + return } - return false + return } // 任务记录 -func (this *ModelRtask) record(uid string,rtypeId int32, val... int32) { - -} - -// 英雄指定 -func (this *ModelRtask) HeroTarget(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { - heroModule, err := this.service.GetModule(comm.ModuleHero) - if err != nil { - return false - } - h := heroModule.(comm.IHero) - for _, v := range h.GetHeroList(uid) { - if cast.ToString(cfg.Data1) == v.HeroID { - return true - } - } - return false -} - -// 指定英雄的等级 -func (this *ModelRtask) HeroLvTarget(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { - heroModule, err := this.service.GetModule(comm.ModuleHero) - if err != nil { - return false - } - h := heroModule.(comm.IHero) - var hero *pb.DBHero - for _, v := range h.GetHeroList(uid) { - // 查找指定英雄 - if cast.ToString(cfg.Data1) == v.HeroID { - hero = v - break - } - } - if hero != nil { - return cast.ToString(cfg.Data1) == hero.HeroID && cfg.Data1 == hero.Lv - } - - return false -} - -// 指定英雄的指定装备的数量 -func (this *ModelRtask) EquipNum(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { - heroModule, err := this.service.GetModule(comm.ModuleHero) - if err != nil { - return false - } - h := heroModule.(comm.IHero) - var hero *pb.DBHero - for _, v := range h.GetHeroList(uid) { - if cast.ToString(cfg.Data1) == v.HeroID { - hero = v - break - } - } - - var count int32 - if hero != nil { - // 验证装备 - _, ok := utils.Findx(hero.EquipID, cast.ToString(cfg.Data2)) - // 验证数量 - for _, v := range hero.EquipID { - if v != "0" { - count++ +func (this *ModelRtask) findAndUpdate(uid string, rtypeId comm.TaskType, vals ...int32) (err error) { + var ( + condiId int32 + condi *rtaskCondi + ) + // 遍历当前已注册的任务条件 + for _, v := range this.moduleRtask.handleMap { + // 找到任务类型 + if int32(rtypeId) == v.cfg.Type { + if condiId = v.find(v.cfg, vals...); condiId == 0 { + continue } } - return cast.ToString(cfg.Data1) == hero.HeroID && - ok && cfg.Data3 == count } - return false + // update + if condiId != 0 { + err = condi.update(uid, condi.cfg, vals...) + } + + return } -// 剧情ID -func (this *ModelRtask) PoltId(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { - mlModule, err := this.service.GetModule(comm.ModuleMainline) +// 获取玩家待校验数据 +func (this *ModelRtask) GetVerifyData(uid string, condiId int32) (*pb.RtaskData, error) { + record := &pb.DBRtaskRecord{} + err := this.Get(uid, record) if err != nil { - return false + return nil, errors.Wrapf(err, "record Get err: %v condiId[%v]", uid, condiId) } - - ml := mlModule.(comm.IMainline) - jqId := ml.GetUsermainLineData(uid) - return cfg.Data1 == jqId -} - -// 每日任务 -func (this *ModelRtask) TaskDay(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { - taskModule, err := this.service.GetModule(comm.ModuleTask) - if err != nil { - return false - } - - itask := taskModule.(comm.ITask) - var task *pb.DBTask - if task = itask.GetTaskById(uid, cfg.Data1); task == nil { - return false - } else { - //任务完成 - if task.Status == 1 { - return true - } - } - - return false -} - -// 指定英雄的星级 -func (this *ModelRtask) HeroStarTarget(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { - heroModule, err := this.service.GetModule(comm.ModuleHero) - if err != nil { - return false - } - h := heroModule.(comm.IHero) - - var hero *pb.DBHero - for _, v := range h.GetHeroList(uid) { - if cast.ToString(cfg.Data1) == v.HeroID { - hero = v - break - } - } - - if hero != nil { - return cast.ToString(cfg.Data1) == hero.HeroID && cfg.Data2 == hero.Star - } - - return false + return record.Vals[condiId], nil } diff --git a/modules/rtask/module.go b/modules/rtask/module.go index 80b5f84b9..a477c6108 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -10,20 +10,17 @@ import ( cfg "go_dreamfactory/sys/configure/structs" ) -// 随机任务 -// type rtask struct { -// rtaskId int32 -// handlers []*rtaskCondi -// } - // 限定条件 type rtaskCondi struct { - cfg *cfg.GameRdtaskCondiData - fn rtaskHandle + cfg *cfg.GameRdtaskCondiData + verify verifyHandle //校验任务条件 + find condiFindHandle //检索任务条件 + update updateDataHandle //更新任务数据 } -// 设定返回值 -type rtaskHandle func(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) +type verifyHandle func(uid string, cfg *cfg.GameRdtaskCondiData) (error, bool) +type condiFindHandle func(cfg *cfg.GameRdtaskCondiData, vals ...int32) int32 +type updateDataHandle func(uid string, cfg *cfg.GameRdtaskCondiData, vals ...int32) error type ModuleRtask struct { modules.ModuleBase @@ -31,12 +28,12 @@ type ModuleRtask struct { api *apiComp configure *configureComp - rtaskHandleMap map[int32]*rtaskCondi // 任务处理器 + handleMap map[int32]*rtaskCondi //任务校验处理器 } func NewModule() core.IModule { return &ModuleRtask{ - rtaskHandleMap: make(map[int32]*rtaskCondi), + handleMap: make(map[int32]*rtaskCondi), } } @@ -46,7 +43,7 @@ func (this *ModuleRtask) GetType() core.M_Modules { func (this *ModuleRtask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) - this.initRtaskHandle() + this.initRtaskVerifyHandle() return } @@ -57,14 +54,15 @@ func (this *ModuleRtask) OnInstallComp() { this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } -func (this *ModuleRtask) register(condiId int32, rtask *rtaskCondi) { - if _, ok := this.rtaskHandleMap[condiId]; !ok { - this.rtaskHandleMap[condiId] = rtask +func (this *ModuleRtask) registerVerifyHandle(condiId int32, condi *rtaskCondi) { + if _, ok := this.handleMap[condiId]; !ok { + this.handleMap[condiId] = condi } } -func (this *ModuleRtask) initRtaskHandle() { - conf, err := this.configure.getRtaskTypeCfg() +// 条件校验初始 +func (this *ModuleRtask) initRtaskVerifyHandle() { + conf, err := this.configure.getRtaskCondiCfg() if err != nil { return } @@ -74,37 +72,179 @@ func (this *ModuleRtask) initRtaskHandle() { if typeCfg != nil { switch comm.TaskType(typeCfg.Type) { case comm.Rtype1: - this.register(v.Id, &rtaskCondi{ - cfg: typeCfg, - fn: this.modelRtask.HeroTarget, + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + verify: this.modelRtask.verify, + find: this.modelRtask.equalParams, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype2: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + verify: this.modelRtask.verify, + find: this.modelRtask.equalParams, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype3: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + verify: this.modelRtask.verify, + find: this.modelRtask.equalParams, + update: this.modelRtask.overrideUpdate, }) case comm.Rtype4: - this.register(v.Id, &rtaskCondi{ - cfg: typeCfg, - fn: this.modelRtask.HeroLvTarget, + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + verify: this.modelRtask.verify, + find: this.modelRtask.equalParams, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype5: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + verify: this.modelRtask.verify, + find: this.modelRtask.equalParams, + update: this.modelRtask.overrideUpdate, }) case comm.Rtype6: - this.register(v.Id, &rtaskCondi{ - cfg: typeCfg, - fn: this.modelRtask.HeroStarTarget, + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, }) - - case comm.Rtype5: - this.register(v.Id, &rtaskCondi{ - cfg: typeCfg, - fn: this.modelRtask.EquipNum, + case comm.Rtype7: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, }) - - case comm.Rtype2: - this.register(v.Id, &rtaskCondi{ - cfg: typeCfg, - fn: this.modelRtask.PoltId, + case comm.Rtype8: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.addUpdate, }) - - case comm.Rtype3: - this.register(v.Id, &rtaskCondi{ - cfg: typeCfg, - fn: this.modelRtask.TaskDay, + case comm.Rtype9: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype10: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype11: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype12: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype13: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype14: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype15: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype16: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype17: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype18: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype19: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype20: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype21: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype22: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype23: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype24: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, + }) + case comm.Rtype25: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtask.equalParams, + verify: this.modelRtask.verify, + update: this.modelRtask.overrideUpdate, }) default: log.Warnf("%v rtask type not configure", typeCfg.Type) @@ -114,6 +254,6 @@ func (this *ModuleRtask) initRtaskHandle() { } } -func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) { +func SendToRtask(session comm.IUserSession, rtaskType int32, params ...int32) (code pb.ErrorCode) { return } diff --git a/modules/rtask/updateHandle.go b/modules/rtask/updateHandle.go new file mode 100644 index 000000000..2fe1f5ea7 --- /dev/null +++ b/modules/rtask/updateHandle.go @@ -0,0 +1,101 @@ +// package 更新任务触发后的数据更新 +package rtask + +import ( + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + + "github.com/pkg/errors" +) + +// 覆盖更新 +func (this *ModelRtask) overrideUpdate(uid string, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) { + var paramLen int + if paramLen, err = verifyParam(cfg, vals...); err != nil { + return err + } + + record := &pb.DBRtaskRecord{} + err = this.Get(uid, record) + if err != nil { + return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id) + } + + if record.Vals == nil { + data := &pb.RtaskData{ + Data: toMap(vals...), + } + record.Vals = map[int32]*pb.RtaskData{ + cfg.Id: data, + } + if err := this.Add(uid, record); err != nil { + return errors.Wrapf(err, "添加玩家任务记录 err: %v rtype[%v]", uid, cfg.Id) + } + } else { + if v, ok := record.Vals[cfg.Id]; ok { + m := isEqual(paramLen, v, cfg, vals...) + if len(m) > 0 { + update := map[string]interface{}{ + "vals": m, + } + err = this.Change(uid, update) + } + + } + } + + return +} + +// 累计更新 - 招募等 +func (this *ModelRtask) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) { + var paramLen int + if paramLen, err = verifyParam(cfg, vals...); err != nil { + return err + } + + record := &pb.DBRtaskRecord{} + err = this.Get(uid, record) + if err != nil { + return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id) + } + + if record.Vals == nil { + data := &pb.RtaskData{ + Data: toMap(vals...), + } + + record.Vals = map[int32]*pb.RtaskData{ + cfg.Id: data, + } + if err := this.Add(uid, record); err != nil { + return errors.Wrapf(err, "添加玩家任务记录 err: %v rtype[%v]", uid, cfg.Id) + } + } else { + data := make(map[int32]int32) + //查找任务数据 + if v, ok := record.Vals[cfg.Id]; ok { + if paramLen == 1 { + data[0] += v.Data[0] + } else if paramLen == 2 { + //第一个参数为累加,后续参数为判断条件 + if data[1] == cfg.Data2 { + data[1] += v.Data[1] + } + } else if paramLen == 3 { + if data[1] == cfg.Data2 && data[2] == cfg.Data3 { + data[2] += v.Data[2] + } + } + if len(data) > 0 { + update := map[string]interface{}{ + "vals": data, + } + err = this.Change(uid, update) + } + + } + + } + return +} diff --git a/modules/rtask/verifyHandle.go b/modules/rtask/verifyHandle.go new file mode 100644 index 000000000..0d16c8193 --- /dev/null +++ b/modules/rtask/verifyHandle.go @@ -0,0 +1,31 @@ +// 校验任务条件 +package rtask + +import ( + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + + "github.com/pkg/errors" +) + +func (this *ModelRtask) verify(uid string, cfg *cfg.GameRdtaskCondiData) (err error, ok bool) { + var rd *pb.RtaskData + if rd, err = this.GetVerifyData(uid, cfg.Id); rd != nil { + if len(rd.Data) == 0 { + err = errors.WithMessagef(err, "玩家参数数据缺失 %v", rd.Data) + return + } + var paramLen int + if paramLen, err = verifyParam(cfg, toArr(rd.Data)...); err == nil { + switch paramLen { + case 1: + return nil, rd.Data[0] == cfg.Data1 + case 2: + return nil, rd.Data[0] == cfg.Data1 && rd.Data[1] == cfg.Data2 + case 3: + return nil, rd.Data[0] == cfg.Data1 && rd.Data[1] == cfg.Data2 && rd.Data[2] == cfg.Data3 + } + } + } + return +} diff --git a/modules/rtask/verify_test.go b/modules/rtask/verify_test.go new file mode 100644 index 000000000..1d4090155 --- /dev/null +++ b/modules/rtask/verify_test.go @@ -0,0 +1,63 @@ +package rtask + +import ( + "fmt" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + "reflect" + "testing" + + "github.com/agiledragon/gomonkey/v2" + . "github.com/smartystreets/goconvey/convey" +) + +var vals []int32 //通过接口传入的参数组 +var conf *cfg.GameRdtaskCondiData + +func TestVerify(t *testing.T) { + Convey("校验处理器测试", t, func() { + + Convey("校验接口参数组", func() { + patches := gomonkey.ApplyGlobalVar(&conf, &cfg.GameRdtaskCondiData{ + Id: 101, + Type: 1, + Data1: 25001, + }) + defer patches.Reset() + + patches2 := gomonkey.ApplyGlobalVar(&vals, []int32{25002}) + defer patches2.Reset() + + n, err := verifyParam(conf, vals...) + fmt.Println(n, err) + }) + + }) +} + +func TestVerify2(t *testing.T) { + Convey("校验处理测试", t, func() { + Convey("rtype1", func() { + var r *ModelRtask + // 修改 + patches := gomonkey.ApplyMethod(reflect.TypeOf(r), "GetVerifyData", func(_ *ModelRtask, uid string, condiId int32) (*pb.RtaskData, error) { + return &pb.RtaskData{ + Data: map[int32]int32{0: 25001}, + }, nil + }) + defer patches.Reset() + + // + rtask := &ModelRtask{} + conf := &cfg.GameRdtaskCondiData{ + Id: 101, + Type: 1, + Data1: 25001, + } + err, ok := rtask.verify("11", conf) + So(err, ShouldEqual, nil) + So(ok, ShouldEqual, true) + }) + }) + +} diff --git a/pb/rtask_db.pb.go b/pb/rtask_db.pb.go index c0352fec8..1572179bc 100644 --- a/pb/rtask_db.pb.go +++ b/pb/rtask_db.pb.go @@ -147,23 +147,70 @@ func (x *DBRtask) GetIsReward() bool { return false } +type RtaskData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data map[int32]int32 `protobuf:"bytes,1,rep,name=data,proto3" json:"data" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"data"` // 当前任务值 +} + +func (x *RtaskData) Reset() { + *x = RtaskData{} + if protoimpl.UnsafeEnabled { + mi := &file_rtask_rtask_db_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RtaskData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RtaskData) ProtoMessage() {} + +func (x *RtaskData) ProtoReflect() protoreflect.Message { + mi := &file_rtask_rtask_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 RtaskData.ProtoReflect.Descriptor instead. +func (*RtaskData) Descriptor() ([]byte, []int) { + return file_rtask_rtask_db_proto_rawDescGZIP(), []int{2} +} + +func (x *RtaskData) GetData() map[int32]int32 { + if x != nil { + return x.Data + } + return nil +} + // 玩家任务记录 type DBRtaskRecord struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - RType int32 `protobuf:"varint,3,opt,name=rType,proto3" json:"rType" bson:"rType"` //任务类型 - Vals map[int32]int32 `protobuf:"bytes,4,rep,name=vals,proto3" json:"vals" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"vals"` //任务记录值 - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp"` //@go_tasg(`bson:"timestamp"`) 时间戳 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + RType int32 `protobuf:"varint,3,opt,name=rType,proto3" json:"rType" bson:"rType"` //任务类型 + Vals map[int32]*RtaskData `protobuf:"bytes,4,rep,name=vals,proto3" json:"vals" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"vals"` //任务记录值 + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp"` //@go_tasg(`bson:"timestamp"`) 时间戳 } func (x *DBRtaskRecord) Reset() { *x = DBRtaskRecord{} if protoimpl.UnsafeEnabled { - mi := &file_rtask_rtask_db_proto_msgTypes[2] + mi := &file_rtask_rtask_db_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -176,7 +223,7 @@ func (x *DBRtaskRecord) String() string { func (*DBRtaskRecord) ProtoMessage() {} func (x *DBRtaskRecord) ProtoReflect() protoreflect.Message { - mi := &file_rtask_rtask_db_proto_msgTypes[2] + mi := &file_rtask_rtask_db_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -189,7 +236,7 @@ func (x *DBRtaskRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use DBRtaskRecord.ProtoReflect.Descriptor instead. func (*DBRtaskRecord) Descriptor() ([]byte, []int) { - return file_rtask_rtask_db_proto_rawDescGZIP(), []int{2} + return file_rtask_rtask_db_proto_rawDescGZIP(), []int{3} } func (x *DBRtaskRecord) GetId() string { @@ -213,7 +260,7 @@ func (x *DBRtaskRecord) GetRType() int32 { return 0 } -func (x *DBRtaskRecord) GetVals() map[int32]int32 { +func (x *DBRtaskRecord) GetVals() map[int32]*RtaskData { if x != nil { return x.Vals } @@ -248,7 +295,14 @@ var file_rtask_rtask_db_proto_rawDesc = []byte{ 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, - 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xcc, 0x01, 0x0a, + 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x6e, 0x0a, 0x09, + 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, + 0x61, 0x74, 0x61, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x1a, 0x37, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd8, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, @@ -258,11 +312,12 @@ var file_rtask_rtask_db_proto_rawDesc = []byte{ 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x1a, 0x37, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x6d, 0x70, 0x1a, 0x43, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0a, 0x2e, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -277,23 +332,27 @@ func file_rtask_rtask_db_proto_rawDescGZIP() []byte { return file_rtask_rtask_db_proto_rawDescData } -var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_rtask_rtask_db_proto_goTypes = []interface{}{ (*FrtaskIds)(nil), // 0: frtaskIds (*DBRtask)(nil), // 1: DBRtask - (*DBRtaskRecord)(nil), // 2: DBRtaskRecord - nil, // 3: DBRtask.FrtaskIdsEntry - nil, // 4: DBRtaskRecord.ValsEntry + (*RtaskData)(nil), // 2: rtaskData + (*DBRtaskRecord)(nil), // 3: DBRtaskRecord + nil, // 4: DBRtask.FrtaskIdsEntry + nil, // 5: rtaskData.DataEntry + nil, // 6: DBRtaskRecord.ValsEntry } var file_rtask_rtask_db_proto_depIdxs = []int32{ - 3, // 0: DBRtask.frtaskIds:type_name -> DBRtask.FrtaskIdsEntry - 4, // 1: DBRtaskRecord.vals:type_name -> DBRtaskRecord.ValsEntry - 0, // 2: DBRtask.FrtaskIdsEntry.value:type_name -> frtaskIds - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 4, // 0: DBRtask.frtaskIds:type_name -> DBRtask.FrtaskIdsEntry + 5, // 1: rtaskData.data:type_name -> rtaskData.DataEntry + 6, // 2: DBRtaskRecord.vals:type_name -> DBRtaskRecord.ValsEntry + 0, // 3: DBRtask.FrtaskIdsEntry.value:type_name -> frtaskIds + 2, // 4: DBRtaskRecord.ValsEntry.value:type_name -> rtaskData + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_rtask_rtask_db_proto_init() } @@ -327,6 +386,18 @@ func file_rtask_rtask_db_proto_init() { } } file_rtask_rtask_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RtaskData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rtask_rtask_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBRtaskRecord); i { case 0: return &v.state @@ -345,7 +416,7 @@ func file_rtask_rtask_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rtask_rtask_db_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 7, NumExtensions: 0, NumServices: 0, },