diff --git a/bin/json/game_trendchose.json b/bin/json/game_trendchose.json new file mode 100644 index 000000000..b55a9fd0a --- /dev/null +++ b/bin/json/game_trendchose.json @@ -0,0 +1,147 @@ +[ + { + "key": 1, + "lv": 1, + "taskstarID": 20010, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-商人" + ], + "chosetxt": { + "key": "chosetxt_01", + "text": "考试选项1" + }, + "chosetype": 1, + "chosenum": 1001, + "get": [], + "lose": [], + "jump": 0 + }, + { + "key": 2, + "lv": 1, + "taskstarID": 20020, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-公告" + ], + "chosetxt": { + "key": "chosetxt_02", + "text": "考试选项2" + }, + "chosetype": 1, + "chosenum": 1002, + "get": [], + "lose": [], + "jump": 0 + }, + { + "key": 3, + "lv": 1, + "taskstarID": 20030, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-邮件" + ], + "chosetxt": { + "key": "chosetxt_03", + "text": "考试选项3" + }, + "chosetype": 1, + "chosenum": 1003, + "get": [], + "lose": [], + "jump": 0 + }, + { + "key": 4, + "lv": 1, + "taskstarID": 20040, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-维京远征" + ], + "chosetxt": { + "key": "chosetxt_04", + "text": "考试选项4" + }, + "chosetype": 1, + "chosenum": 1004, + "get": [], + "lose": [], + "jump": 0 + }, + { + "key": 5, + "lv": 1, + "taskstarID": 20050, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-捕羊大赛" + ], + "chosetxt": { + "key": "chosetxt_05", + "text": "考试选项5" + }, + "chosetype": 1, + "chosenum": 1005, + "get": [], + "lose": [], + "jump": 0 + }, + { + "key": 6, + "lv": 1, + "taskstarID": 20060, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-狩猎" + ], + "chosetxt": { + "key": "chosetxt_06", + "text": "考试选项6" + }, + "chosetype": 1, + "chosenum": 1006, + "get": [], + "lose": [], + "jump": 0 + }, + { + "key": 7, + "lv": 1, + "taskstarID": 20070, + "taskendID": 20090, + "npc": [ + "GameMain", + "功能入口-烹饪" + ], + "chosetxt": { + "key": "chosetxt_07", + "text": "我想花点钱" + }, + "chosetype": 2, + "chosenum": 0, + "get": [ + { + "a": "attr", + "t": "gold", + "n": 5000 + } + ], + "lose": [ + { + "a": "item", + "t": "14020003", + "n": 1 + } + ], + "jump": 0 + } +] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index 77edced3a..b830a04ce 100644 --- a/comm/const.go +++ b/comm/const.go @@ -293,7 +293,8 @@ const ( ///工会战 TableUniongve = "uniongve" - + ///工会轮盘 + TableUnionroulette = "unionroulette" //全局表 TableGlobal = "global" ) diff --git a/comm/imodule.go b/comm/imodule.go index 524b55bba..60e500f0d 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -149,6 +149,8 @@ type ( GetUser(uid string) *pb.DBUser //获取用户回话 GetUserSession(uid string) *pb.CacheUser + //批量查询用户会话数据 + GetUserSessions(uids []string) []*pb.CacheUser //查询用户属性值 例如 金币 经验 QueryAttributeValue(uid string, attr string) (value int64) //添加/减少属性值 第四个参数控制是否推送给前端 diff --git a/modules/comp_model.go b/modules/comp_model.go index bfeae2ded..f3d0e54e8 100644 --- a/modules/comp_model.go +++ b/modules/comp_model.go @@ -25,7 +25,7 @@ type MCompModel struct { DBModel *db.DBModel } -//组件初始化接口 +// 组件初始化接口 func (this *MCompModel) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.ModuleCompBase.Init(service, module, comp, options) var conn *db.DBConn @@ -63,107 +63,112 @@ func (this *MCompModel) UpdateModelLogs(table string, uID string, where bson.M, return this.DBModel.UpdateModelLogs(table, uID, where, target) } -//创建分布式锁 +// 创建分布式锁 func (this *MCompModel) NewRedisMutex(key string, outtime int) (result *redis.RedisMutex, err error) { return this.DBModel.NewRedisMutex(key, outtime) } -//添加新的数据 +// 添加新的数据 func (this *MCompModel) Add(uid string, data interface{}, opt ...db.DBOption) (err error) { return this.DBModel.Add(uid, data) } -//添加新的数据 +// 添加新的数据 func (this *MCompModel) Adds(datas map[string]interface{}, opt ...db.DBOption) (err error) { return this.DBModel.Adds(datas) } -//添加新的数据到列表 +// 添加新的数据到列表 func (this *MCompModel) AddList(uid string, id string, data interface{}, opt ...db.DBOption) (err error) { return this.DBModel.AddList(uid, id, data, opt...) } -//添加新的多个数据到列表 data map[string]type +// 添加新的多个数据到列表 data map[string]type func (this *MCompModel) AddLists(uid string, data interface{}, opt ...db.DBOption) (err error) { return this.DBModel.AddLists(uid, data, opt...) } -//添加新的多个数据到队列中 data map[string]type +// 添加新的多个数据到队列中 data map[string]type func (this *MCompModel) AddQueues(key string, uplimit int64, data interface{}) (outkey []string, err error) { return this.DBModel.AddQueues(key, uplimit, data) } -//修改数据多个字段 uid 作为主键 +// 修改数据多个字段 uid 作为主键 func (this *MCompModel) Change(uid string, data map[string]interface{}, opt ...db.DBOption) (err error) { return this.DBModel.Change(uid, data, opt...) } -//修改数据多个字段 uid 作为主键 +// 修改数据多个字段 uid 作为主键 func (this *MCompModel) ChangeList(uid string, _id string, data map[string]interface{}, opt ...db.DBOption) (err error) { return this.DBModel.ChangeList(uid, _id, data, opt...) } -//修改列表中多个数据 datas key是 _id value是 这个数据对象 +// 修改列表中多个数据 datas key是 _id value是 这个数据对象 func (this *MCompModel) ChangeLists(uid string, datas map[string]interface{}, opt ...db.DBOption) (err error) { return this.DBModel.ChangeLists(uid, datas, opt...) } -//读取全部数据 +// 读取全部数据 func (this *MCompModel) Get(id string, data interface{}, opt ...db.DBOption) (err error) { return this.DBModel.Get(id, data, opt...) } -//读取多个数据对象 +// 读取多个数据对象 func (this *MCompModel) Gets(ids []string, data interface{}, opt ...db.DBOption) (onfound []string, err error) { return this.DBModel.Gets(ids, data, opt...) } -//获取列表数据 注意 data 必须是 切片的指针 *[]type +// 获取列表数据 注意 data 必须是 切片的指针 *[]type func (this *MCompModel) GetList(uid string, data interface{}) (err error) { return this.DBModel.GetList(uid, data) } -//查询队列信息 +// 查询队列信息 func (this *MCompModel) GetQueues(key string, count int, data interface{}) (err error) { return this.DBModel.GetQueues(key, count, data) } -//读取单个数据中 多个字段数据 +// 读取单个数据中 多个字段数据 func (this *MCompModel) GetFields(uid string, data interface{}, fields ...string) (err error) { return this.DBModel.GetFields(uid, data, fields...) } -//读取List列表中单个数据中 多个字段数据 +// 读取List列表中单个数据中 多个字段数据 func (this *MCompModel) GetListFields(uid string, id string, data interface{}, fields ...string) (err error) { return this.DBModel.GetListFields(uid, id, data, fields...) } -//读取列表数据中单个数据 +// 读取列表数据中单个数据 func (this *MCompModel) GetListObj(uid string, id string, data interface{}) (err error) { return this.DBModel.GetListObj(uid, id, data) } -//批量读取列表中多个数据 +// 批量读取列表中多个数据 func (this *MCompModel) GetListObjs(uid string, ids []string, data interface{}) (err error) { return this.DBModel.GetListObjs(uid, ids, data) } -//删除目标数据 +// 批量读取列表中多个数据 只在redis中寻找 +func (this *MCompModel) GetRedisListObjs(uid string, ids []string, data interface{}) (foundids []string, err error) { + return this.DBModel.GetRedisListObjs(uid, ids, data) +} + +// 删除目标数据 func (this *MCompModel) Del(id string, opt ...db.DBOption) (err error) { return this.DBModel.Del(id, opt...) } -//删除用户数据 +// 删除用户数据 func (this *MCompModel) DelByUId(uid string, opt ...db.DBOption) (err error) { return this.DBModel.DelByUId(uid, opt...) } -//删除多条数据 +// 删除多条数据 func (this *MCompModel) DelListlds(uid string, ids []string, opt ...db.DBOption) (err error) { return this.DBModel.DelListlds(uid, ids, opt...) } -//批量删除数据 +// 批量删除数据 func (this *MCompModel) BatchDelLists(uid string) (err error) { return this.DBModel.BatchDelLists(uid) } diff --git a/modules/modulebase.go b/modules/modulebase.go index 7d1b67f5a..e8831ca7b 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -193,21 +193,13 @@ func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Messag // 向多个用户发送消息 func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Message, uids ...string) (err error) { var ( - users map[string]*pb.CacheUser = make(map[string]*pb.CacheUser) + users []*pb.CacheUser gateways map[string]map[string][]string = make(map[string]map[string][]string) cluster map[string][]string = make(map[string][]string) gateway []string ok bool ) - for _, v := range uids { - if user := this.ModuleUser.GetUserSession(v); user != nil { - if user == nil { - err = fmt.Errorf("user:%v on found", v) - continue - } - users[v] = user - } - } + users = this.ModuleUser.GetUserSessions(uids) for _, v := range users { if cluster, ok = gateways[v.ServiceTag]; !ok { cluster = make(map[string][]string) diff --git a/modules/pay/modelActivity.go b/modules/pay/modelActivity.go index ec4e7d313..70153f630 100644 --- a/modules/pay/modelActivity.go +++ b/modules/pay/modelActivity.go @@ -7,6 +7,7 @@ import ( "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/modules" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "sync" @@ -113,11 +114,11 @@ func (this *modelActivityComp) deliverybyid(session comm.IUserSession, id int32) info.Activitys[conf.Type] = item } - if _, ok = item.Items[conf.Id]; ok { + if _, ok = item.Items[conf.Id]; !ok { item.Items[conf.Id] = &pb.PayActivityGiftbagItem{ - Id: conf.Id, + Id: conf.Id, + Lastrefresh: configure.Now().Unix(), } - return } item.Items[conf.Id].Buyunm++ item.Items[conf.Id].Totalbuynum++ @@ -177,11 +178,11 @@ func (this *modelActivityComp) delivery(session comm.IUserSession, pid string) ( info.Activitys[conf.Type] = item } - if _, ok = item.Items[conf.Id]; ok { + if _, ok = item.Items[conf.Id]; !ok { item.Items[conf.Id] = &pb.PayActivityGiftbagItem{ - Id: conf.Id, + Id: conf.Id, + Lastrefresh: configure.Now().Unix(), } - return } item.Items[conf.Id].Buyunm++ item.Items[conf.Id].Totalbuynum++ diff --git a/modules/uniongve/api_challengefinish.go b/modules/uniongve/api_challengefinish.go index 49594ad66..bcd6e8225 100644 --- a/modules/uniongve/api_challengefinish.go +++ b/modules/uniongve/api_challengefinish.go @@ -82,6 +82,7 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.Uniongve } } v.Record = append(v.Record) + go this.module.modelUniongve.booshpchangepush(req.Unionid, info) if v.Hp < 0 { v.Hp = 0 go this.module.modelUniongve.booskill(req.Unionid, req.Boosid, info) diff --git a/modules/uniongve/api_roulette.go b/modules/uniongve/api_roulette.go index 772ada7ff..55d70f422 100644 --- a/modules/uniongve/api_roulette.go +++ b/modules/uniongve/api_roulette.go @@ -26,6 +26,11 @@ func (this *apiComp) Roulette(session comm.IUserSession, req *pb.UniongveRoulett return } + need := this.module.ModuleTools.GetGlobalConf().GuildbossRoulette + + if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{need}, true); err != nil { + return + } if confs, err = this.module.configure.getguildbossroulette(); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, @@ -52,6 +57,10 @@ func (this *apiComp) Roulette(session comm.IUserSession, req *pb.UniongveRoulett return } - session.SendMsg(string(this.module.GetType()), "roulette", &pb.UniongveRouletteResp{}) + if confs[index].Push == 1 { //推送通知 + go this.module.modelUnionroulette.roulettechangePush(session.GetUserId(), req.Unionid, award) + } + + session.SendMsg(string(this.module.GetType()), "roulette", &pb.UniongveRouletteResp{Cid: confs[index].Id, Award: award}) return } diff --git a/modules/uniongve/api_setfire.go b/modules/uniongve/api_setfire.go index b3429cdcd..315edef04 100644 --- a/modules/uniongve/api_setfire.go +++ b/modules/uniongve/api_setfire.go @@ -2,6 +2,7 @@ package uniongve import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" ) @@ -15,11 +16,40 @@ func (this *apiComp) SetFireCheck(session comm.IUserSession, req *pb.UniongveSet func (this *apiComp) SetFire(session comm.IUserSession, req *pb.UniongveSetFireReq) (errdata *pb.ErrorData) { var ( info *pb.DBUnionGve + err error ) if errdata = this.SetFireCheck(session, req); errdata != nil { return } - this.module.modelUniongve.getUnionGve(req.Unionid) + + lock, _ := this.module.modelUniongve.userlock(req.Unionid) + err = lock.Lock() + if err != nil { + this.module.Error("公会战分布式锁 err!", log.Field{Key: "Unionid", Value: req.Unionid}, log.Field{Key: "err", Value: err.Error()}) + return + } + defer lock.Unlock() + + if info, err = this.module.modelUniongve.getUnionGve(req.Unionid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + info.Notice = req.Notice + info.Fire = req.Boosid + + if err = this.module.modelUniongve.updateUnionGve(info); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + go this.module.modelUniongve.infochangepush(req.Unionid, info) session.SendMsg(string(this.module.GetType()), "info", &pb.UniongveInfoResp{Info: info}) return } diff --git a/modules/uniongve/comp_configure.go b/modules/uniongve/comp_configure.go index 1b1d129c1..3aca237f2 100644 --- a/modules/uniongve/comp_configure.go +++ b/modules/uniongve/comp_configure.go @@ -97,6 +97,33 @@ func (this *MCompConfigure) getguildbossByid(id int32) (results *cfg.GameGuildBo return } +// 获取所有难度一的boos +func (this *MCompConfigure) getguildbossByNext(id int32, lv int32) (results *cfg.GameGuildBossData, err error) { + var ( + v interface{} + conf *cfg.GameGuildBossData + ok bool + ) + + if v, err = this.GetConfigure(game_guildboss); err != nil { + return + } else { + if conf, ok = v.(*cfg.GameGuildBoss).GetDataMap()[id]; !ok { + err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_guildboss, id) + this.module.Errorf("err:%v", err) + return + } + + for _, results = range v.(*cfg.GameGuildBoss).GetDataList() { + if conf.Group == results.Group && results.BossLv == lv { + return + } + } + err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_guildboss, fmt.Sprintf("id:%d lv:%d", id, lv)) + } + return +} + // 获取伤害对应的评分组 func (this *MCompConfigure) getguildbossscore(group int32, harm int32) (results *cfg.GameGuildBossScoreData, err error) { var ( diff --git a/modules/uniongve/modelUnionRoulette.go b/modules/uniongve/modelUnionRoulette.go new file mode 100644 index 000000000..c75103749 --- /dev/null +++ b/modules/uniongve/modelUnionRoulette.go @@ -0,0 +1,102 @@ +package uniongve + +import ( + "fmt" + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/lego/sys/mgo" + "go_dreamfactory/lego/sys/redis" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + "sync" +) + +type ModelUnionroulette struct { + modules.MCompModel + module *UnionGve + conflock sync.RWMutex + bossconf *pb.DBUnionGveBossConf +} + +func (this *ModelUnionroulette) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompModel.Init(service, module, comp, options) + this.TableName = comm.TableUnionroulette + this.module = module.(*UnionGve) + return +} + +func (this *ModelUnionroulette) Start() (err error) { + err = this.MCompModel.Start() + return +} + +// 获取用户全部的埋点数据 +func (this *ModelUnionroulette) getUnionRoulette(unionid string) (results *pb.DBUnionRouletteRecord, err error) { + results = &pb.DBUnionRouletteRecord{} + if err = this.Get(unionid, results); err != nil && err != mgo.MongodbNil { + this.module.Errorln(err) + return + } + if err == mgo.MongodbNil { + results = &pb.DBUnionRouletteRecord{ + Unionid: unionid, + Roulette: make([]*pb.DBGveRouletteRecord, 0), + } + err = this.Add(unionid, results) + } + return +} + +func (this *ModelUnionroulette) updateUnionRoulette(data *pb.DBUnionRouletteRecord) (err error) { + if err = this.Change(data.Unionid, map[string]interface{}{ + "roulette": data.Roulette, + }); err != nil { + this.module.Error("更新用户任务数据 错误!", log.Field{Key: "err", Value: err.Error()}) + return + } + return +} + +// 分布式锁 +func (this *ModelUnionroulette) userlock(id string) (result *redis.RedisMutex, err error) { + return this.DBModel.Redis.NewRedisMutex(fmt.Sprintf("unionroulette:%s", id)) +} + +// boos 信息变化推送 +func (this *ModelUnionroulette) roulettechangePush(unionid string, uid string, award []*pb.UserAssets) { + var ( + info *pb.DBUnionRouletteRecord + members []*pb.SociatyMemberInfo + users []string = make([]string, 0) + err error + ) + members = this.module.sociaty.MembersBySociatyId(unionid) + if members == nil || len(members) == 0 { + this.module.Error("MembersBySociatyId is nil !") + return + } + for _, v := range members { + users = append(users, v.Uid) + } + + lock, _ := this.module.modelUniongve.userlock(unionid) + err = lock.Lock() + if err != nil { + this.module.Error("公会战分布式锁 err!", log.Field{Key: "Unionid", Value: unionid}, log.Field{Key: "err", Value: err.Error()}) + return + } + defer lock.Unlock() + if info, err = this.getUnionRoulette(unionid); err != nil { + this.module.Errorln(err) + return + } + info.Roulette = append(info.Roulette, &pb.DBGveRouletteRecord{ + Uid: uid, + Award: award, + }) + + this.module.SendMsgToUsers(string(this.module.GetType()), "roulettechange", &pb.UniongveRouletteChangePush{ + Record: info, + }) +} diff --git a/modules/uniongve/modelUniongve.go b/modules/uniongve/modelUniongve.go index e21776dd1..3aa9a29e0 100644 --- a/modules/uniongve/modelUniongve.go +++ b/modules/uniongve/modelUniongve.go @@ -160,25 +160,47 @@ func (this *ModelUniongve) userlock(id string) (result *redis.RedisMutex, err er return this.DBModel.Redis.NewRedisMutex(fmt.Sprintf("uniongve:%s", id)) } -// 击杀boos -func (this *ModelUniongve) booskill(unionid string, boosid int32, info *pb.DBUnionGve) { +// boos 血量变化推送 +func (this *ModelUniongve) booshpchangepush(unionid string, info *pb.DBUnionGve) { var ( - // conf *cfg.GameGuildBossData members []*pb.SociatyMemberInfo - offlist []string = make([]string, 0) - onine []string = make([]string, 0) - // err error + users []string = make([]string, 0) ) - // if conf, err = this.module.configure.getguildbossByid(boosid); err != nil { - // this.module.Errorln(err) - // return - // } members = this.module.sociaty.MembersBySociatyId(unionid) if members == nil || len(members) == 0 { this.module.Error("MembersBySociatyId is nil !") return } for _, v := range members { + users = append(users, v.Uid) + + } + this.module.SendMsgToUsers(string(this.module.GetType()), "booschange", &pb.UniongveBoosChangePush{ + Info: info, + }) +} + +// 击杀boos +func (this *ModelUniongve) booskill(unionid string, boosid int32, info *pb.DBUnionGve) { + var ( + conf *cfg.GameGuildBossData + members []*pb.SociatyMemberInfo + users []string = make([]string, 0) + offlist []string = make([]string, 0) + onine []string = make([]string, 0) + err error + ) + if conf, err = this.module.configure.getguildbossByid(boosid); err != nil { + this.module.Errorln(err) + return + } + members = this.module.sociaty.MembersBySociatyId(unionid) + if members == nil || len(members) == 0 { + this.module.Error("MembersBySociatyId is nil !") + return + } + for _, v := range members { + users = append(users, v.Uid) if v.OfflineTime != 0 { offlist = append(offlist, v.Uid) } else { @@ -186,10 +208,59 @@ func (this *ModelUniongve) booskill(unionid string, boosid int32, info *pb.DBUni } } + this.module.mail.SendMailToUsers(offlist, "Guild_Boss", conf.KillReward, nil) + this.module.mail.SendMailToUsers(onine, "Guild_Boss", conf.KillReward, nil) + for _, v := range info.Boos { if v.Hp > 0 { return } } + lock, _ := this.module.modelUniongve.userlock(unionid) + err = lock.Lock() + if err != nil { + this.module.Error("公会战分布式锁 err!", log.Field{Key: "Unionid", Value: unionid}, log.Field{Key: "err", Value: err.Error()}) + return + } + defer lock.Unlock() + + info.Currstage++ + + for _, v := range info.Boos { + if conf, err = this.module.configure.getguildbossByNext(v.Boosid, info.Currstage); err != nil { + this.module.Errorln(err) + return + } + v.Boosid = conf.BossId + v.Hp = v.Hp + v.Record = make([]*pb.DBGveRecord, 0) + } + if err = this.updateUnionGve(info); err != nil { + this.module.Errorln(err) + return + } + this.module.SendMsgToUsers(string(this.module.GetType()), "stagechange", &pb.UniongveStageChangePush{ + Info: info, + }) +} + +// boos 信息变化推送 +func (this *ModelUniongve) infochangepush(unionid string, info *pb.DBUnionGve) { + var ( + members []*pb.SociatyMemberInfo + users []string = make([]string, 0) + ) + members = this.module.sociaty.MembersBySociatyId(unionid) + if members == nil || len(members) == 0 { + this.module.Error("MembersBySociatyId is nil !") + return + } + for _, v := range members { + users = append(users, v.Uid) + + } + this.module.SendMsgToUsers(string(this.module.GetType()), "infochange", &pb.UniongveInfoChangePush{ + Info: info, + }) } diff --git a/modules/uniongve/module.go b/modules/uniongve/module.go index 4393ceed3..b89e6caf4 100644 --- a/modules/uniongve/module.go +++ b/modules/uniongve/module.go @@ -13,13 +13,14 @@ func NewModule() core.IModule { type UnionGve struct { modules.ModuleBase - service core.IService - sociaty comm.ISociaty - mail comm.Imail - battle comm.IBattle - api *apiComp - modelUniongve *ModelUniongve - configure *MCompConfigure + service core.IService + sociaty comm.ISociaty + mail comm.Imail + battle comm.IBattle + api *apiComp + modelUniongve *ModelUniongve + modelUnionroulette *ModelUnionroulette + configure *MCompConfigure } // 模块名 @@ -57,4 +58,5 @@ func (this *UnionGve) OnInstallComp() { this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure) this.modelUniongve = this.RegisterComp(new(ModelUniongve)).(*ModelUniongve) + this.modelUnionroulette = this.RegisterComp(new(ModelUnionroulette)).(*ModelUnionroulette) } diff --git a/modules/user/model_session.go b/modules/user/model_session.go index 8a83231f7..26a895462 100644 --- a/modules/user/model_session.go +++ b/modules/user/model_session.go @@ -43,6 +43,18 @@ func (this *ModelSession) getUserSession(uid string) (user *pb.CacheUser) { return user } +// 获取用户 +func (this *ModelSession) getUserSessions(uids []string) (users []*pb.CacheUser) { + users = make([]*pb.CacheUser, 0) + if _, err := this.GetRedisListObjs(comm.RDS_EMPTY, uids, &users); err != nil { + if err != mongo.ErrNoDocuments { + this.module.Errorln(err) + } + return + } + return +} + // 设置用户session func (this *ModelSession) addUserSession(uid string, session comm.IUserSession) (err error) { // if err = this.AddList(comm.RDS_EMPTY, uid, map[string]interface{}{ diff --git a/modules/user/module.go b/modules/user/module.go index 3839880dc..171f4baae 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -148,6 +148,11 @@ func (this *User) GetUserSession(uid string) *pb.CacheUser { return this.modelSession.getUserSession(uid) } +// 获取用户会话 +func (this *User) GetUserSessions(uids []string) []*pb.CacheUser { + return this.modelSession.getUserSessions(uids) +} + func (this *User) ResetSession() { us, err := this.UserOnlineList() if err != nil { diff --git a/modules/warorder/api_receive.go b/modules/warorder/api_receive.go index 00a47b098..a537ef175 100644 --- a/modules/warorder/api_receive.go +++ b/modules/warorder/api_receive.go @@ -86,6 +86,16 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.WarorderReceiveR if errdata = this.module.DispenseRes(session, awards, true); errdata != nil { return } + + if err = this.module.modelWarorder.updateUserWarorders(session.GetUserId(), warorders); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: fmt.Sprintf("Activity:%d no open", req.Rtype), + } + return + } + session.SendMsg(string(this.module.GetType()), "receive", &pb.WarorderReceiveResp{Rtype: req.Rtype, Info: info, Award: ads}) return } diff --git a/pb/uniongve_db.pb.go b/pb/uniongve_db.pb.go index 67581adcf..c9ba046d0 100644 --- a/pb/uniongve_db.pb.go +++ b/pb/uniongve_db.pb.go @@ -172,6 +172,62 @@ func (x *DBUnionGve) GetBoos() []*DBUnionGveBoss { return nil } +//工会轮盘记录 +type DBUnionRouletteRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Unionid string `protobuf:"bytes,1,opt,name=unionid,proto3" json:"unionid"` //工会id + Roulette []*DBGveRouletteRecord `protobuf:"bytes,7,rep,name=roulette,proto3" json:"roulette"` //轮盘记录 +} + +func (x *DBUnionRouletteRecord) Reset() { + *x = DBUnionRouletteRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_uniongve_uniongve_db_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBUnionRouletteRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBUnionRouletteRecord) ProtoMessage() {} + +func (x *DBUnionRouletteRecord) ProtoReflect() protoreflect.Message { + mi := &file_uniongve_uniongve_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 DBUnionRouletteRecord.ProtoReflect.Descriptor instead. +func (*DBUnionRouletteRecord) Descriptor() ([]byte, []int) { + return file_uniongve_uniongve_db_proto_rawDescGZIP(), []int{2} +} + +func (x *DBUnionRouletteRecord) GetUnionid() string { + if x != nil { + return x.Unionid + } + return "" +} + +func (x *DBUnionRouletteRecord) GetRoulette() []*DBGveRouletteRecord { + if x != nil { + return x.Roulette + } + return nil +} + //工会boos type DBUnionGveBoss struct { state protoimpl.MessageState @@ -186,7 +242,7 @@ type DBUnionGveBoss struct { func (x *DBUnionGveBoss) Reset() { *x = DBUnionGveBoss{} if protoimpl.UnsafeEnabled { - mi := &file_uniongve_uniongve_db_proto_msgTypes[2] + mi := &file_uniongve_uniongve_db_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -199,7 +255,7 @@ func (x *DBUnionGveBoss) String() string { func (*DBUnionGveBoss) ProtoMessage() {} func (x *DBUnionGveBoss) ProtoReflect() protoreflect.Message { - mi := &file_uniongve_uniongve_db_proto_msgTypes[2] + mi := &file_uniongve_uniongve_db_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -212,7 +268,7 @@ func (x *DBUnionGveBoss) ProtoReflect() protoreflect.Message { // Deprecated: Use DBUnionGveBoss.ProtoReflect.Descriptor instead. func (*DBUnionGveBoss) Descriptor() ([]byte, []int) { - return file_uniongve_uniongve_db_proto_rawDescGZIP(), []int{2} + return file_uniongve_uniongve_db_proto_rawDescGZIP(), []int{3} } func (x *DBUnionGveBoss) GetBoosid() int32 { @@ -249,7 +305,7 @@ type DBGveRecord struct { func (x *DBGveRecord) Reset() { *x = DBGveRecord{} if protoimpl.UnsafeEnabled { - mi := &file_uniongve_uniongve_db_proto_msgTypes[3] + mi := &file_uniongve_uniongve_db_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +318,7 @@ func (x *DBGveRecord) String() string { func (*DBGveRecord) ProtoMessage() {} func (x *DBGveRecord) ProtoReflect() protoreflect.Message { - mi := &file_uniongve_uniongve_db_proto_msgTypes[3] + mi := &file_uniongve_uniongve_db_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +331,7 @@ func (x *DBGveRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use DBGveRecord.ProtoReflect.Descriptor instead. func (*DBGveRecord) Descriptor() ([]byte, []int) { - return file_uniongve_uniongve_db_proto_rawDescGZIP(), []int{3} + return file_uniongve_uniongve_db_proto_rawDescGZIP(), []int{4} } func (x *DBGveRecord) GetUid() string { @@ -292,38 +348,105 @@ func (x *DBGveRecord) GetFormation() []string { return nil } +type DBGveRouletteRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` + Award []*UserAssets `protobuf:"bytes,2,rep,name=award,proto3" json:"award"` //奖励 +} + +func (x *DBGveRouletteRecord) Reset() { + *x = DBGveRouletteRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_uniongve_uniongve_db_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBGveRouletteRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBGveRouletteRecord) ProtoMessage() {} + +func (x *DBGveRouletteRecord) ProtoReflect() protoreflect.Message { + mi := &file_uniongve_uniongve_db_proto_msgTypes[5] + 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 DBGveRouletteRecord.ProtoReflect.Descriptor instead. +func (*DBGveRouletteRecord) Descriptor() ([]byte, []int) { + return file_uniongve_uniongve_db_proto_rawDescGZIP(), []int{5} +} + +func (x *DBGveRouletteRecord) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBGveRouletteRecord) GetAward() []*UserAssets { + if x != nil { + return x.Award + } + return nil +} + var File_uniongve_uniongve_db_proto protoreflect.FileDescriptor var file_uniongve_uniongve_db_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x2f, 0x75, 0x6e, 0x69, 0x6f, 0x6e, - 0x67, 0x76, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a, 0x12, - 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x42, 0x6f, 0x73, 0x73, 0x43, 0x6f, - 0x6e, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, - 0x6f, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0xab, - 0x01, 0x0a, 0x0a, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x63, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x66, 0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x66, - 0x69, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x75, 0x72, 0x72, 0x73, 0x74, 0x61, 0x67, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x75, 0x72, 0x72, 0x73, 0x74, 0x61, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, - 0x76, 0x65, 0x42, 0x6f, 0x73, 0x73, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0x5e, 0x0a, 0x0e, - 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x42, 0x6f, 0x73, 0x73, 0x12, 0x16, - 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x02, 0x68, 0x70, 0x12, 0x24, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x47, 0x76, 0x65, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x3d, 0x0a, 0x0b, - 0x44, 0x42, 0x47, 0x76, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, - 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x76, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a, 0x12, 0x44, 0x42, 0x55, 0x6e, + 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x42, 0x6f, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0a, 0x44, + 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, + 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, + 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, + 0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x66, 0x69, 0x72, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x63, 0x75, 0x72, 0x72, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x09, 0x63, 0x75, 0x72, 0x72, 0x73, 0x74, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x74, + 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x42, 0x6f, + 0x73, 0x73, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0x63, 0x0a, 0x15, 0x44, 0x42, 0x55, 0x6e, + 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x08, 0x72, + 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x44, 0x42, 0x47, 0x76, 0x65, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x22, 0x5e, 0x0a, + 0x0e, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x42, 0x6f, 0x73, 0x73, 0x12, + 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, 0x70, 0x12, 0x24, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x47, 0x76, 0x65, 0x52, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x3d, 0x0a, + 0x0b, 0x44, 0x42, 0x47, 0x76, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4a, 0x0a, 0x13, + 0x44, 0x42, 0x47, 0x76, 0x65, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, + 0x73, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -338,21 +461,26 @@ func file_uniongve_uniongve_db_proto_rawDescGZIP() []byte { return file_uniongve_uniongve_db_proto_rawDescData } -var file_uniongve_uniongve_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_uniongve_uniongve_db_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_uniongve_uniongve_db_proto_goTypes = []interface{}{ - (*DBUnionGveBossConf)(nil), // 0: DBUnionGveBossConf - (*DBUnionGve)(nil), // 1: DBUnionGve - (*DBUnionGveBoss)(nil), // 2: DBUnionGveBoss - (*DBGveRecord)(nil), // 3: DBGveRecord + (*DBUnionGveBossConf)(nil), // 0: DBUnionGveBossConf + (*DBUnionGve)(nil), // 1: DBUnionGve + (*DBUnionRouletteRecord)(nil), // 2: DBUnionRouletteRecord + (*DBUnionGveBoss)(nil), // 3: DBUnionGveBoss + (*DBGveRecord)(nil), // 4: DBGveRecord + (*DBGveRouletteRecord)(nil), // 5: DBGveRouletteRecord + (*UserAssets)(nil), // 6: UserAssets } var file_uniongve_uniongve_db_proto_depIdxs = []int32{ - 2, // 0: DBUnionGve.boos:type_name -> DBUnionGveBoss - 3, // 1: DBUnionGveBoss.record:type_name -> DBGveRecord - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 3, // 0: DBUnionGve.boos:type_name -> DBUnionGveBoss + 5, // 1: DBUnionRouletteRecord.roulette:type_name -> DBGveRouletteRecord + 4, // 2: DBUnionGveBoss.record:type_name -> DBGveRecord + 6, // 3: DBGveRouletteRecord.award:type_name -> UserAssets + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_uniongve_uniongve_db_proto_init() } @@ -360,6 +488,7 @@ func file_uniongve_uniongve_db_proto_init() { if File_uniongve_uniongve_db_proto != nil { return } + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_uniongve_uniongve_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBUnionGveBossConf); i { @@ -386,7 +515,7 @@ func file_uniongve_uniongve_db_proto_init() { } } file_uniongve_uniongve_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DBUnionGveBoss); i { + switch v := v.(*DBUnionRouletteRecord); i { case 0: return &v.state case 1: @@ -398,6 +527,18 @@ func file_uniongve_uniongve_db_proto_init() { } } file_uniongve_uniongve_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBUnionGveBoss); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_uniongve_uniongve_db_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBGveRecord); i { case 0: return &v.state @@ -409,6 +550,18 @@ func file_uniongve_uniongve_db_proto_init() { return nil } } + file_uniongve_uniongve_db_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBGveRouletteRecord); 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{ @@ -416,7 +569,7 @@ func file_uniongve_uniongve_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_uniongve_uniongve_db_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/uniongve_msg.pb.go b/pb/uniongve_msg.pb.go index 1dc3d0f8b..2b725d5ae 100644 --- a/pb/uniongve_msg.pb.go +++ b/pb/uniongve_msg.pb.go @@ -383,6 +383,8 @@ type UniongveRouletteReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Unionid string `protobuf:"bytes,1,opt,name=unionid,proto3" json:"unionid"` } func (x *UniongveRouletteReq) Reset() { @@ -417,12 +419,20 @@ func (*UniongveRouletteReq) Descriptor() ([]byte, []int) { return file_uniongve_uniongve_msg_proto_rawDescGZIP(), []int{7} } +func (x *UniongveRouletteReq) GetUnionid() string { + if x != nil { + return x.Unionid + } + return "" +} + //工会轮盘 type UniongveRouletteResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + Cid int32 `protobuf:"varint,1,opt,name=cid,proto3" json:"cid"` Award []*UserAssets `protobuf:"bytes,2,rep,name=award,proto3" json:"award"` //奖励 } @@ -458,6 +468,13 @@ func (*UniongveRouletteResp) Descriptor() ([]byte, []int) { return file_uniongve_uniongve_msg_proto_rawDescGZIP(), []int{8} } +func (x *UniongveRouletteResp) GetCid() int32 { + if x != nil { + return x.Cid + } + return 0 +} + func (x *UniongveRouletteResp) GetAward() []*UserAssets { if x != nil { return x.Award @@ -878,6 +895,8 @@ type UniongveRouletteChangePush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Record *DBUnionRouletteRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` } func (x *UniongveRouletteChangePush) Reset() { @@ -912,6 +931,13 @@ func (*UniongveRouletteChangePush) Descriptor() ([]byte, []int) { return file_uniongve_uniongve_msg_proto_rawDescGZIP(), []int{16} } +func (x *UniongveRouletteChangePush) GetRecord() *DBUnionRouletteRecord { + if x != nil { + return x.Record + } + return nil +} + var File_uniongve_uniongve_msg_proto protoreflect.FileDescriptor var file_uniongve_uniongve_msg_proto_rawDesc = []byte{ @@ -946,56 +972,62 @@ var file_uniongve_uniongve_msg_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x52, 0x04, - 0x6c, 0x69, 0x73, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, - 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, 0x71, 0x22, 0x39, 0x0a, 0x14, 0x55, - 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, - 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x72, 0x0a, 0x14, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, - 0x76, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, - 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, - 0x12, 0x28, 0x0a, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x22, 0x6a, 0x0a, 0x15, 0x55, 0x6e, - 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, - 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x75, 0x0a, 0x1a, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, - 0x76, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, - 0x68, 0x52, 0x65, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x90, 0x01, - 0x0a, 0x1b, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, - 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, - 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, - 0x21, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, + 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, + 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x75, + 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, + 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x22, 0x4b, 0x0a, 0x14, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, + 0x65, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, + 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, + 0x21, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x61, 0x77, 0x61, - 0x72, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, - 0x22, 0x39, 0x0a, 0x16, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, - 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x55, 0x6e, 0x69, - 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x3a, 0x0a, 0x17, 0x55, - 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x53, 0x74, 0x61, 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, + 0x72, 0x64, 0x22, 0x72, 0x0a, 0x14, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43, 0x68, + 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, + 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, + 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x06, + 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x42, + 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, + 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x22, 0x6a, 0x0a, 0x15, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, + 0x76, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, + 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, + 0x64, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, + 0x66, 0x6f, 0x22, 0x75, 0x0a, 0x1a, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43, 0x68, + 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x70, + 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, + 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, + 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x90, 0x01, 0x0a, 0x1b, 0x55, 0x6e, + 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, + 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, + 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, + 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x61, + 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x09, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x22, 0x39, 0x0a, 0x16, + 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, - 0x65, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x39, 0x0a, 0x16, 0x55, 0x6e, 0x69, 0x6f, 0x6e, - 0x67, 0x76, 0x65, 0x42, 0x6f, 0x6f, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, - 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0b, 0x2e, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x52, 0x04, 0x69, 0x6e, - 0x66, 0x6f, 0x22, 0x1c, 0x0a, 0x1a, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x52, 0x6f, - 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x3a, 0x0a, 0x17, 0x55, 0x6e, 0x69, 0x6f, 0x6e, + 0x67, 0x76, 0x65, 0x53, 0x74, 0x61, 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, + 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x52, 0x04, 0x69, + 0x6e, 0x66, 0x6f, 0x22, 0x39, 0x0a, 0x16, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x42, + 0x6f, 0x6f, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, + 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, + 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x47, 0x76, 0x65, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x4c, + 0x0a, 0x1a, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, + 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x2e, 0x0a, 0x06, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x44, + 0x42, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x75, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1034,6 +1066,7 @@ var file_uniongve_uniongve_msg_proto_goTypes = []interface{}{ (*BattleFormation)(nil), // 19: BattleFormation (*BattleInfo)(nil), // 20: BattleInfo (*BattleReport)(nil), // 21: BattleReport + (*DBUnionRouletteRecord)(nil), // 22: DBUnionRouletteRecord } var file_uniongve_uniongve_msg_proto_depIdxs = []int32{ 17, // 0: UniongveInfoResp.info:type_name -> DBUnionGve @@ -1046,11 +1079,12 @@ var file_uniongve_uniongve_msg_proto_depIdxs = []int32{ 17, // 7: UniongveInfoChangePush.info:type_name -> DBUnionGve 17, // 8: UniongveStageChangePush.info:type_name -> DBUnionGve 17, // 9: UniongveBoosChangePush.info:type_name -> DBUnionGve - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 22, // 10: UniongveRouletteChangePush.record:type_name -> DBUnionRouletteRecord + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_uniongve_uniongve_msg_proto_init() } diff --git a/sys/configure/structs/Game.TrendChose.go b/sys/configure/structs/Game.TrendChose.go new file mode 100644 index 000000000..70ceed4d7 --- /dev/null +++ b/sys/configure/structs/Game.TrendChose.go @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +type GameTrendChose struct { + _dataMap map[int32]*GameTrendChoseData + _dataList []*GameTrendChoseData +} + +func NewGameTrendChose(_buf []map[string]interface{}) (*GameTrendChose, error) { + _dataList := make([]*GameTrendChoseData, 0, len(_buf)) + dataMap := make(map[int32]*GameTrendChoseData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameTrendChoseData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Key] = _v + } + } + return &GameTrendChose{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameTrendChose) GetDataMap() map[int32]*GameTrendChoseData { + return table._dataMap +} + +func (table *GameTrendChose) GetDataList() []*GameTrendChoseData { + return table._dataList +} + +func (table *GameTrendChose) Get(key int32) *GameTrendChoseData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.TrendChoseData.go b/sys/configure/structs/Game.TrendChoseData.go new file mode 100644 index 000000000..83936cc05 --- /dev/null +++ b/sys/configure/structs/Game.TrendChoseData.go @@ -0,0 +1,94 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +import "errors" + +type GameTrendChoseData struct { + Key int32 + Lv int32 + TaskstarID int32 + TaskendID int32 + Npc []string + Chosetxt string + Chosetype int32 + Chosenum int32 + Get []*Gameatn + Lose []*Gameatn + Jump int32 +} + +const TypeId_GameTrendChoseData = -2145177947 + +func (*GameTrendChoseData) GetTypeId() int32 { + return -2145177947 +} + +func (_v *GameTrendChoseData)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskstarID"].(float64); !_ok_ { err = errors.New("taskstarID error"); return }; _v.TaskstarID = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskendID"].(float64); !_ok_ { err = errors.New("taskendID error"); return }; _v.TaskendID = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["npc"].([]interface{}); !_ok_ { err = errors.New("npc error"); return } + + _v.Npc = make([]string, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ string + { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } + _v.Npc = append(_v.Npc, _list_v_) + } + } + + {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["chosetxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Chosetxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Chosetxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chosetype"].(float64); !_ok_ { err = errors.New("chosetype error"); return }; _v.Chosetype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chosenum"].(float64); !_ok_ { err = errors.New("chosenum error"); return }; _v.Chosenum = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["get"].([]interface{}); !_ok_ { err = errors.New("get error"); return } + + _v.Get = make([]*Gameatn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gameatn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } + _v.Get = append(_v.Get, _list_v_) + } + } + + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["lose"].([]interface{}); !_ok_ { err = errors.New("lose error"); return } + + _v.Lose = make([]*Gameatn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gameatn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } + _v.Lose = append(_v.Lose, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["jump"].(float64); !_ok_ { err = errors.New("jump error"); return }; _v.Jump = int32(_tempNum_) } + return +} + +func DeserializeGameTrendChoseData(_buf map[string]interface{}) (*GameTrendChoseData, error) { + v := &GameTrendChoseData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go index d316ffa9c..efb67a3a0 100644 --- a/sys/configure/structs/Tables.go +++ b/sys/configure/structs/Tables.go @@ -199,6 +199,7 @@ type Tables struct { GuildBossRoulette *GameGuildBossRoulette GuildBossRank *GameGuildBossRank GuildBossScore *GameGuildBossScore + TrendChose *GameTrendChose } func NewTables(loader JsonLoader) (*Tables, error) { @@ -1334,5 +1335,11 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.GuildBossScore, err = NewGameGuildBossScore(buf) ; err != nil { return nil, err } + if buf, err = loader("game_trendchose") ; err != nil { + return nil, err + } + if tables.TrendChose, err = NewGameTrendChose(buf) ; err != nil { + return nil, err + } return tables, nil } diff --git a/sys/db/dbmodel.go b/sys/db/dbmodel.go index 62ba11183..df2a04b6a 100644 --- a/sys/db/dbmodel.go +++ b/sys/db/dbmodel.go @@ -48,7 +48,7 @@ func NewDBModel(tableName string, expired time.Duration, conn *DBConn) *DBModel } } -//DB模型 +// DB模型 type DBModel struct { TableName string Expired time.Duration //过期时间 @@ -147,13 +147,13 @@ func (this *DBModel) UpdateModelLogs(table string, uID string, where bson.M, tar return err } -///创建锁对象 +// /创建锁对象 func (this *DBModel) NewRedisMutex(key string, outtime int) (result *lgredis.RedisMutex, err error) { result, err = this.Redis.NewRedisMutex(key, lgredis.SetExpiry(outtime)) return } -//添加新的数据 +// 添加新的数据 func (this *DBModel) Add(uid string, data interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel Add", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data}) if err = this.Redis.HMSet(this.ukey(uid), data); err != nil { @@ -170,7 +170,7 @@ func (this *DBModel) Add(uid string, data interface{}, opt ...DBOption) (err err return } -//添加新的数据 +// 添加新的数据 func (this *DBModel) Adds(data map[string]interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel Add", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data}) pipe := this.Redis.RedisPipe(context.TODO()) @@ -192,7 +192,7 @@ func (this *DBModel) Adds(data map[string]interface{}, opt ...DBOption) (err err return } -//添加新的数据到列表 +// 添加新的数据到列表 func (this *DBModel) AddList(uid string, id string, data interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel AddList", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "_id", Value: id}, log.Field{Key: "data", Value: data}) key := this.ukeylist(uid, id) @@ -213,7 +213,7 @@ func (this *DBModel) AddList(uid string, id string, data interface{}, opt ...DBO return } -//添加新的多个数据到列表 data map[string]type +// 添加新的多个数据到列表 data map[string]type func (this *DBModel) AddLists(uid string, data interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel AddLists", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data}) vof := reflect.ValueOf(data) @@ -256,7 +256,7 @@ func (this *DBModel) AddLists(uid string, data interface{}, opt ...DBOption) (er return } -//添加队列 +// 添加队列 func (this *DBModel) AddQueues(key string, uplimit int64, data interface{}) (outkey []string, err error) { //defer log.Debug("DBModel AddQueues", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "key", Value: key}, log.Field{Key: "data", Value: data}) vof := reflect.ValueOf(data) @@ -296,7 +296,7 @@ func (this *DBModel) AddQueues(key string, uplimit int64, data interface{}) (out return } -//修改数据多个字段 uid 作为主键 +// 修改数据多个字段 uid 作为主键 func (this *DBModel) Change(uid string, data map[string]interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel Change", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data}) if err = this.Redis.HMSet(this.ukey(uid), data); err != nil { @@ -313,7 +313,7 @@ func (this *DBModel) Change(uid string, data map[string]interface{}, opt ...DBOp return nil } -//修改列表中一个数据 +// 修改列表中一个数据 func (this *DBModel) ChangeList(uid string, _id string, data map[string]interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel ChangeList", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "_id", Value: _id}, log.Field{Key: "data", Value: data}) if err = this.Redis.HMSet(this.ukeylist(uid, _id), data); err != nil { @@ -336,7 +336,7 @@ func (this *DBModel) ChangeList(uid string, _id string, data map[string]interfac return nil } -//修改列表中多个数据 datas key是 _id value是 这个数据对象 +// 修改列表中多个数据 datas key是 _id value是 这个数据对象 func (this *DBModel) ChangeLists(uid string, datas map[string]interface{}, opt ...DBOption) (err error) { pipe := this.Redis.RedisPipe(context.TODO()) for k, v := range datas { @@ -366,7 +366,7 @@ func (this *DBModel) ChangeLists(uid string, datas map[string]interface{}, opt . return nil } -//读取全部数据 +// 读取全部数据 func (this *DBModel) Get(uid string, data interface{}, opt ...DBOption) (err error) { //defer log.Debug("DBModel Get", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data}) if err = this.Redis.HGetAll(this.ukey(uid), data); err != nil && err != lgredis.RedisNil { @@ -386,7 +386,7 @@ func (this *DBModel) Get(uid string, data interface{}, opt ...DBOption) (err err return } -//读取多个数据对象 +// 读取多个数据对象 func (this *DBModel) Gets(ids []string, data interface{}, opt ...DBOption) (onfound []string, err error) { //defer log.Debug("DBModel GetListObjs", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "ids", Value: ids}, log.Field{Key: "data", Value: data}) defer func() { //程序异常 收集异常信息传递给前端显示 @@ -515,7 +515,7 @@ func (this *DBModel) Gets(ids []string, data interface{}, opt ...DBOption) (onfo return } -//获取列表数据 注意 data 必须是 切片的指针 *[]type +// 获取列表数据 注意 data 必须是 切片的指针 *[]type func (this *DBModel) GetList(uid string, data interface{}) (err error) { //defer log.Debug("DBModel GetList", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data}) defer func() { //程序异常 收集异常信息传递给前端显示 @@ -643,7 +643,7 @@ func (this *DBModel) GetList(uid string, data interface{}) (err error) { return err } -//获取队列数据 +// 获取队列数据 func (this *DBModel) GetQueues(key string, count int, data interface{}) (err error) { //defer log.Debug("DBModel GetQueues", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "key", Value: key}, log.Field{Key: "data", Value: data}) var ( @@ -714,7 +714,7 @@ func (this *DBModel) GetQueues(key string, count int, data interface{}) (err err return } -//读取单个数据中 多个字段数据 +// 读取单个数据中 多个字段数据 func (this *DBModel) GetFields(uid string, data interface{}, fields ...string) (err error) { //defer log.Debug("DBModel GetFields", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "data", Value: data}) if err = this.Redis.HMGet(this.ukey(uid), data, fields...); err != nil && err != lgredis.RedisNil { @@ -734,7 +734,7 @@ func (this *DBModel) GetFields(uid string, data interface{}, fields ...string) ( return } -//读取List列表中单个数据中 多个字段数据 +// 读取List列表中单个数据中 多个字段数据 func (this *DBModel) GetListFields(uid string, id string, data interface{}, fields ...string) (err error) { //defer log.Debug("DBModel GetListFields", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "id", Value: id}, log.Field{Key: "data", Value: data}) var ( @@ -768,7 +768,7 @@ func (this *DBModel) GetListFields(uid string, id string, data interface{}, fiel return } -//读取列表数据中单个数据 +// 读取列表数据中单个数据 func (this *DBModel) GetListObj(uid string, id string, data interface{}) (err error) { //defer log.Debug("DBModel GetListObj", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "id", Value: id}, log.Field{Key: "data", Value: data}) var ( @@ -802,7 +802,7 @@ func (this *DBModel) GetListObj(uid string, id string, data interface{}) (err er return } -//读取列表数据中多条数据 +// 读取列表数据中多条数据 func (this *DBModel) GetListObjs(uid string, ids []string, data interface{}) (err error) { //defer log.Debug("DBModel GetListObjs", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "ids", Value: ids}, log.Field{Key: "data", Value: data}) defer func() { //程序异常 收集异常信息传递给前端显示 @@ -935,7 +935,86 @@ func (this *DBModel) GetListObjs(uid string, ids []string, data interface{}) (er return } -//删除目标数据 +// 读取列表数据中多条数据 +func (this *DBModel) GetRedisListObjs(uid string, ids []string, data interface{}) (onfound []string, err error) { + //defer log.Debug("DBModel GetListObjs", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "ids", Value: ids}, log.Field{Key: "data", Value: data}) + defer func() { //程序异常 收集异常信息传递给前端显示 + if r := recover(); r != nil { + buf := make([]byte, 4096) + l := runtime.Stack(buf, false) + err = fmt.Errorf("%v: %s", r, buf[:l]) + log.Errorf("[DB GetListObjs] TableName:%s uid:%s", this.TableName, uid) + } + }() + var ( + dtype reflect2.Type + dkind reflect.Kind + sType reflect2.Type + sliceType *reflect2.UnsafeSliceType + sliceelemType reflect2.Type + decoder codecore.IDecoderMapJson + dptr unsafe.Pointer + elemPtr unsafe.Pointer + n int + ok bool + tempdata map[string]string + pipe *pipe.RedisPipe = this.Redis.RedisPipe(context.TODO()) + result []*redis.StringStringMapCmd = make([]*redis.StringStringMapCmd, len(ids)) + ) + onfound = make([]string, 0, len(ids)) + dptr = reflect2.PtrOf(data) + dtype = reflect2.TypeOf(data) + dkind = dtype.Kind() + if dkind != reflect.Ptr { + err = fmt.Errorf("MCompModel: GetList(non-pointer %T)", data) + return + } + sType = dtype.(*reflect2.UnsafePtrType).Elem() + if sType.Kind() != reflect.Slice { + err = fmt.Errorf("MCompModel: GetList(data no slice %T)", data) + return + } + sliceType = sType.(*reflect2.UnsafeSliceType) + sliceelemType = sliceType.Elem() + if sliceelemType.Kind() != reflect.Ptr { + err = fmt.Errorf("MCompModel: GetList(sliceelemType non-pointer %T)", data) + return + } + if decoder, ok = codec.DecoderOf(sliceelemType, defconf).(codecore.IDecoderMapJson); !ok { + err = fmt.Errorf("MCompModel: GetList(data not support MarshalMapJson %T)", data) + return + } + sliceelemType = sliceelemType.(*reflect2.UnsafePtrType).Elem() + for i, v := range ids { + result[i] = pipe.HGetAllToMapString(this.ukeylist(uid, v)) + } + if _, err = pipe.Exec(); err == nil { + for i, v := range result { + if tempdata, err = v.Result(); err == nil { + sliceType.UnsafeGrow(dptr, n+1) + elemPtr = sliceType.UnsafeGetIndex(dptr, n) + if *((*unsafe.Pointer)(elemPtr)) == nil { + newPtr := sliceelemType.UnsafeNew() + if err = decoder.DecodeForMapJson(newPtr, json.GetReader([]byte{}), tempdata); err != nil { + log.Errorf("err:%v", err) + return + } + *((*unsafe.Pointer)(elemPtr)) = newPtr + } else { + decoder.DecodeForMapJson(*((*unsafe.Pointer)(elemPtr)), json.GetReader([]byte{}), tempdata) + } + n++ + } else { + onfound = append(onfound, ids[i]) + } + } + } else { + onfound = ids + } + return +} + +// 删除目标数据 func (this *DBModel) Del(id string, opt ...DBOption) (err error) { //defer log.Debug("DBModel Del", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}) err = this.Redis.Delete(this.ukey(id)) @@ -949,7 +1028,7 @@ func (this *DBModel) Del(id string, opt ...DBOption) (err error) { return nil } -//删除用户数据 +// 删除用户数据 func (this *DBModel) DelByUId(uid string, opt ...DBOption) (err error) { //defer log.Debug("DBModel Del", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}) err = this.Redis.Delete(this.ukey(uid)) @@ -963,7 +1042,7 @@ func (this *DBModel) DelByUId(uid string, opt ...DBOption) (err error) { return nil } -//删除多条数据 +// 删除多条数据 func (this *DBModel) DelListlds(uid string, ids []string, opt ...DBOption) (err error) { //defer log.Debug("DBModel DelListlds", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "ids", Value: ids}) listkey := this.ukey(uid) @@ -982,7 +1061,7 @@ func (this *DBModel) DelListlds(uid string, ids []string, opt ...DBOption) (err return } -//批量删除数据 +// 批量删除数据 func (this *DBModel) BatchDelLists(uid string) (err error) { //defer log.Debug("DBModel BatchDelLists", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}) var keys map[string]string