Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
744c0fa2b5
@ -124,3 +124,11 @@ const (
|
|||||||
MailLineHard string = "mainline_data_hard" // 困难
|
MailLineHard string = "mainline_data_hard" // 困难
|
||||||
MailLinePurgatory string = "mainline_data_purgatory" // 炼狱
|
MailLinePurgatory string = "mainline_data_purgatory" // 炼狱
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
RacePt int32 = 1 // 普通阵营
|
||||||
|
RaceZr int32 = 2 // 灼热
|
||||||
|
RaceYd int32 = 3 // 涌动
|
||||||
|
RaceHx int32 = 4 // 呼啸
|
||||||
|
RaceSy int32 = 5 // 闪耀
|
||||||
|
)
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -20,66 +21,49 @@ func (this *apiComp) DrawCardCheck(session comm.IUserSession, req *pb.HeroDrawCa
|
|||||||
//抽卡
|
//抽卡
|
||||||
func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
szCards []int32 // 最终抽到的卡牌
|
szCards []int32 // 最终抽到的卡牌
|
||||||
totalWeight int64 // 总权重
|
totalWeight int64 // 总权重
|
||||||
curWeigth int64 // 临时随机获得的权重
|
curWeigth int64 // 临时随机获得的权重
|
||||||
drawTimes int32 // 抽卡次数
|
drawTimes int32 // 抽卡次数
|
||||||
hitStar4 int32 // 抽了多少次还没获得4星英雄
|
curStar4Count int32 // 当前4星没抽到的次数
|
||||||
hitStar5 int32 // 抽了多少次还没获得5星英雄
|
curStar5Count int32 // 当前5星没抽到的次数
|
||||||
//hitStar int32 // 抽中几星
|
config4Count int32 // 配置表中4星保底次数
|
||||||
curStar4Count int32 // 当前4星没抽到的次数
|
config5Count int32 // 配置表中5星保底次数
|
||||||
curStar5Count int32 // 当前5星没抽到的次数
|
race int32
|
||||||
floor4Count int32 // 4星保底次数
|
|
||||||
floor5Count int32 // 5星保底次数
|
|
||||||
|
|
||||||
)
|
)
|
||||||
szCards = make([]int32, 0)
|
szCards = make([]int32, 0)
|
||||||
rsp := &pb.HeroDrawCardResp{}
|
rsp := &pb.HeroDrawCardResp{}
|
||||||
//curStar4Count = this.GetFloorStarData(req.DrawType, session.GetUserId(), 4)
|
|
||||||
//curStar5Count = this.GetFloorStarData(req.DrawType, session.GetUserId(), 5)
|
|
||||||
this.module.Debugf("当前4星抽卡没中次数:%d, 当前5星抽卡没中次数:%d", curStar4Count, curStar5Count)
|
this.module.Debugf("当前4星抽卡没中次数:%d, 当前5星抽卡没中次数:%d", curStar4Count, curStar5Count)
|
||||||
|
|
||||||
rst, err := this.module.modelHero.GetUserRecord(session.GetUserId())
|
rst, err := this.module.modelHero.GetUserRecord(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
}
|
}
|
||||||
for k, v := range rst.Floors {
|
if req.DrawType%2 == 0 { // 转成对应阵营信息
|
||||||
if req.DrawType == 1 || req.DrawType == 2 {
|
race = int32((int(req.DrawType)) / 2)
|
||||||
if k == "p4" {
|
} else {
|
||||||
curStar4Count = v
|
race = int32(int(req.DrawType+1) / 2)
|
||||||
} else if k == "p5" {
|
|
||||||
curStar5Count = v
|
|
||||||
}
|
|
||||||
} else if req.DrawType == 3 || req.DrawType == 4 {
|
|
||||||
if k == "o4" {
|
|
||||||
curStar4Count = v
|
|
||||||
} else if k == "o5" {
|
|
||||||
curStar5Count = v
|
|
||||||
}
|
|
||||||
} else if req.DrawType == 5 || req.DrawType == 6 {
|
|
||||||
if k == "t4" {
|
|
||||||
curStar4Count = v
|
|
||||||
} else if k == "t5" {
|
|
||||||
curStar5Count = v
|
|
||||||
}
|
|
||||||
} else if req.DrawType == 7 || req.DrawType == 8 {
|
|
||||||
if k == "th4" {
|
|
||||||
curStar4Count = v
|
|
||||||
} else if k == "th5" {
|
|
||||||
curStar5Count = v
|
|
||||||
}
|
|
||||||
} else if req.DrawType == 9 || req.DrawType == 10 {
|
|
||||||
if k == "f4" {
|
|
||||||
curStar4Count = v
|
|
||||||
} else if k == "f5" {
|
|
||||||
curStar5Count = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if race == comm.RacePt { // 普通卡池
|
||||||
|
curStar4Count = rst.Race0.H4
|
||||||
|
curStar5Count = rst.Race0.H5
|
||||||
|
} else if race == comm.RaceZr { // 灼热
|
||||||
|
curStar4Count = rst.Race1.H4
|
||||||
|
curStar5Count = rst.Race1.H5
|
||||||
|
} else if race == comm.RaceYd { // 涌动
|
||||||
|
curStar4Count = rst.Race2.H4
|
||||||
|
curStar5Count = rst.Race2.H5
|
||||||
|
} else if race == comm.RaceHx { // 呼啸
|
||||||
|
curStar4Count = rst.Race3.H4
|
||||||
|
curStar5Count = rst.Race3.H5
|
||||||
|
} else if race == comm.RaceSy { // 闪耀
|
||||||
|
curStar4Count = rst.Race4.H4
|
||||||
|
curStar5Count = rst.Race4.H5
|
||||||
|
}
|
||||||
|
|
||||||
// 抽卡相关
|
// 抽卡相关
|
||||||
// 获取配置文件的权重信息
|
// 获取配置文件的权重信息
|
||||||
_conf, err := this.module.configure.GetHeroDrawConfig()
|
_conf, err := this.module.configure.GetHeroDrawConfig(race)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
@ -90,11 +74,11 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
floor4Count = _costConf.Floor4 // 4星保底次数
|
config4Count = _costConf.Floor4 // 4星保底次数
|
||||||
floor5Count = _costConf.Floor5 // 五星保底次数
|
config5Count = _costConf.Floor5 // 五星保底次数
|
||||||
if floor4Count == 0 || floor5Count == 0 {
|
if config4Count == 0 || config5Count == 0 { // 数量为0 设置最大
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
config5Count = math.MaxInt32
|
||||||
return
|
config4Count = math.MaxInt32
|
||||||
}
|
}
|
||||||
sz := make([]*cfg.Game_atn, 0)
|
sz := make([]*cfg.Game_atn, 0)
|
||||||
sz = append(sz, _costConf.Cost)
|
sz = append(sz, _costConf.Cost)
|
||||||
@ -104,64 +88,100 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawTimes = _costConf.Count // 抽卡次数
|
drawTimes = _costConf.Count // 抽卡次数
|
||||||
for _, v := range _conf.GetDataList() {
|
for _, v := range _conf {
|
||||||
totalWeight += int64(v.Weight) // 统计所有权重
|
totalWeight += int64(v.Weight) // 统计所有权重
|
||||||
}
|
}
|
||||||
this.module.configure.GetDrawUpDrawConfig()
|
//this.module.configure.GetDrawUpDrawConfig()
|
||||||
drawTimes = 1
|
drawTimes = 1
|
||||||
for i := 0; i < int(drawTimes); i++ {
|
for i := 0; i < int(drawTimes); i++ {
|
||||||
n, _ := rand.Int(rand.Reader, big.NewInt(totalWeight)) // [0,totalWeight)
|
n, _ := rand.Int(rand.Reader, big.NewInt(totalWeight)) // [0,totalWeight)
|
||||||
for _, v := range _conf.GetDataList() {
|
for _, v := range _conf {
|
||||||
curWeigth += int64(v.Weight)
|
curWeigth += int64(v.Weight)
|
||||||
if curWeigth < n.Int64() { // 命中
|
if curWeigth < n.Int64() { // 命中
|
||||||
szCards = append(szCards, v.Id)
|
|
||||||
// 获取当前星级
|
// 获取当前星级
|
||||||
_getCardCfg := this.module.configure.GetHero(v.Id) //获取的英雄信息
|
_getCardCfg := this.module.configure.GetHero(v.Id) //获取的英雄信息
|
||||||
if _getCardCfg != nil {
|
if _getCardCfg != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
|
||||||
//SetFloorStarData(req.DrawType, session.GetUserId(), 4)
|
|
||||||
hitStar4 = 0
|
|
||||||
//hitStar = 4
|
|
||||||
break
|
|
||||||
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
|
||||||
//SetFloorStarData(req.DrawType, session.GetUserId(), 5)
|
|
||||||
hitStar5 = 0 // 清0
|
|
||||||
//hitStar = 5
|
|
||||||
break
|
|
||||||
}
|
|
||||||
hitStar4++
|
|
||||||
hitStar5++
|
|
||||||
|
|
||||||
if hitStar4 >= floor4Count { // 达到保底次数了 修改当前卡牌星级
|
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
||||||
break
|
curStar4Count = 0
|
||||||
|
continue
|
||||||
|
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
||||||
|
curStar5Count = 0 // 清0
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if hitStar5 >= floor5Count { // 触发5星保底
|
curStar4Count++
|
||||||
// 5星卡池找
|
curStar5Count++
|
||||||
break
|
bGet := false
|
||||||
|
// 达标保底次数
|
||||||
|
if curStar4Count >= config4Count {
|
||||||
|
//_costConf.Floor4cards
|
||||||
|
_bd, err := this.module.configure.GetHeroDrawConfig(_costConf.Floor4cards)
|
||||||
|
if err != nil && len(_bd) != 0 {
|
||||||
|
var _totalW int64 // 总权重
|
||||||
|
var _tmpW int64 // 临时权重
|
||||||
|
for _, v := range _bd {
|
||||||
|
_totalW += int64(v.Weight)
|
||||||
|
}
|
||||||
|
// 随机权重
|
||||||
|
n, _ := rand.Int(rand.Reader, big.NewInt(_totalW))
|
||||||
|
for _, v := range _bd {
|
||||||
|
_tmpW += int64(v.Weight)
|
||||||
|
if n.Int64() > _tmpW { // 种族保底卡池命中
|
||||||
|
szCards = append(szCards, v.Id)
|
||||||
|
bGet = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if curStar5Count >= config5Count {
|
||||||
|
_bd, err := this.module.configure.GetHeroDrawConfig(_costConf.Floor5cards)
|
||||||
|
if err != nil && len(_bd) != 0 {
|
||||||
|
var _totalW int64 // 总权重
|
||||||
|
var _tmpW int64 // 临时权重
|
||||||
|
for _, v := range _bd {
|
||||||
|
_totalW += int64(v.Weight)
|
||||||
|
}
|
||||||
|
// 随机权重
|
||||||
|
n, _ := rand.Int(rand.Reader, big.NewInt(_totalW))
|
||||||
|
for _, v := range _bd {
|
||||||
|
_tmpW += int64(v.Weight)
|
||||||
|
if n.Int64() > _tmpW { // 种族保底卡池命中
|
||||||
|
szCards = append(szCards, v.Id)
|
||||||
|
bGet = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !bGet {
|
||||||
|
szCards = append(szCards, v.Id)
|
||||||
}
|
}
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if hitStar != 0 {
|
}
|
||||||
// hitStar = 0
|
raceData := &pb.Floor{
|
||||||
// //ModifyFloorStarData(req.DrawType, session.GetUserId(), hitStar) // 重置该星级保底
|
H4: curStar4Count,
|
||||||
// }
|
H5: curStar5Count,
|
||||||
}
|
}
|
||||||
// 更新record 配置信息
|
// 更新record 配置信息
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"floors": nil,
|
"race0": raceData,
|
||||||
}
|
|
||||||
this.module.modelHero.ChangeUserRecord(session.GetUserId(), update)
|
|
||||||
if hitStar4 != 0 {
|
|
||||||
//AddFloorStarData(req.DrawType, session.GetUserId(), 4, hitStar4) // 增加4星保底次数
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if hitStar5 != 0 {
|
if race == 0 { // 获取4,5星抽取次数
|
||||||
//AddFloorStarData(req.DrawType, session.GetUserId(), 5, hitStar5) // 增加5星保底次数
|
update["race0"] = raceData
|
||||||
|
} else if race == 1 {
|
||||||
|
update["race1"] = raceData
|
||||||
|
} else if race == 2 {
|
||||||
|
update["race2"] = raceData
|
||||||
|
} else if race == 3 {
|
||||||
|
update["race3"] = raceData
|
||||||
|
} else if race == 4 {
|
||||||
|
update["race4"] = raceData
|
||||||
}
|
}
|
||||||
//计算保底
|
this.module.modelHero.ChangeUserRecord(session.GetUserId(), update)
|
||||||
|
|
||||||
if err := this.module.modelHero.createMultiHero(session.GetUserId(), szCards...); err != nil {
|
if err := this.module.modelHero.createMultiHero(session.GetUserId(), szCards...); err != nil {
|
||||||
code = pb.ErrorCode_HeroCreate
|
code = pb.ErrorCode_HeroCreate
|
||||||
|
@ -353,15 +353,20 @@ func (this *configureComp) GetHeroAwakenConfig() (configure *cfg.Game_heroAwaken
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 抽卡配置表
|
// 抽卡配置表
|
||||||
func (this *configureComp) GetHeroDrawConfig() (configure *cfg.Game_drawCard, err error) {
|
func (this *configureComp) GetHeroDrawConfig(typeid int32) (card []*cfg.Game_drawCardData, err error) {
|
||||||
var (
|
var (
|
||||||
v interface{}
|
v interface{}
|
||||||
ok bool
|
|
||||||
)
|
)
|
||||||
if v, err = this.GetConfigure(hero_drawcard); err == nil {
|
if v, err = this.GetConfigure(hero_drawcard); err == nil {
|
||||||
if configure, ok = v.(*cfg.Game_drawCard); !ok {
|
if _configure, ok := v.(*cfg.Game_drawCard); !ok {
|
||||||
err = fmt.Errorf("%T no is *cfg.Game_drawCard", v)
|
err = fmt.Errorf("%T no is *cfg.Game_drawCard", v)
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
for _, v := range _configure.GetDataList() {
|
||||||
|
if v.TypeId == typeid {
|
||||||
|
card = append(card, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("%T no is *cfg.Game_drawCard", v)
|
err = fmt.Errorf("%T no is *cfg.Game_drawCard", v)
|
||||||
|
@ -94,6 +94,10 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
|
|||||||
_, err := this.DB.InsertMany(core.SqlTable(_key), _obj)
|
_, err := this.DB.InsertMany(core.SqlTable(_key), _obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("insert %s db err:%v", (core.SqlTable(_key)), err)
|
log.Errorf("insert %s db err:%v", (core.SqlTable(_key)), err)
|
||||||
|
for k, v := range _obj {
|
||||||
|
log.Errorf("条件 %s db err:%v", k, v)
|
||||||
|
}
|
||||||
|
|
||||||
ErrorLogCount[data.ID]++
|
ErrorLogCount[data.ID]++
|
||||||
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧
|
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧
|
||||||
log.Errorf("insert db err max num %s db err:%v", data.ID, err)
|
log.Errorf("insert db err max num %s db err:%v", data.ID, err)
|
||||||
@ -122,6 +126,10 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
|
|||||||
_, err = this.DB.DeleteMany(core.SqlTable(_key), _obj, options.Delete())
|
_, err = this.DB.DeleteMany(core.SqlTable(_key), _obj, options.Delete())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("delete %s db err:%v", core.SqlTable(_key), err)
|
log.Errorf("delete %s db err:%v", core.SqlTable(_key), err)
|
||||||
|
for k, v := range _obj {
|
||||||
|
log.Errorf("条件 %s db err:%v", k, v)
|
||||||
|
}
|
||||||
|
|
||||||
ErrorLogCount[data.ID]++
|
ErrorLogCount[data.ID]++
|
||||||
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧
|
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧
|
||||||
log.Errorf("del db err max num %s db err:%v", data.ID, err)
|
log.Errorf("del db err max num %s db err:%v", data.ID, err)
|
||||||
@ -151,9 +159,17 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
|
|||||||
_, err = this.DB.UpdateMany(core.SqlTable(_tableName), Where, bson.M{"$set": Query}, options.MergeUpdateOptions().SetUpsert(true)) //, new(options.UpdateOptions).SetUpsert(true)
|
_, err = this.DB.UpdateMany(core.SqlTable(_tableName), Where, bson.M{"$set": Query}, options.MergeUpdateOptions().SetUpsert(true)) //, new(options.UpdateOptions).SetUpsert(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Update %s db err:%v", core.SqlTable(_tableName), err)
|
log.Errorf("Update %s db err:%v", core.SqlTable(_tableName), err)
|
||||||
|
for k, v := range Where {
|
||||||
|
log.Errorf("条件 %s db err:%v", k, v)
|
||||||
|
}
|
||||||
|
for k, v := range Query {
|
||||||
|
log.Errorf("执行 %s db err:%v", k, v)
|
||||||
|
}
|
||||||
ErrorLogCount[data.ID]++
|
ErrorLogCount[data.ID]++
|
||||||
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 超过一定次数写失败了那就删除吧
|
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 超过一定次数写失败了那就删除吧
|
||||||
log.Errorf("update db err max num %s db err:%v", data.ID, err)
|
log.Errorf("update db err max num %s db err:%v", data.ID, err)
|
||||||
|
// 打印更新信息
|
||||||
|
|
||||||
_, err = this.DB.DeleteOne(core.SqlTable(this.TableName), bson.M{"_id": data.ID})
|
_, err = this.DB.DeleteOne(core.SqlTable(this.TableName), bson.M{"_id": data.ID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("insert %s db err:%+v", data.ID, err)
|
log.Errorf("insert %s db err:%+v", data.ID, err)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package mgolog
|
package mgolog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
"go_dreamfactory/lego/core/cbase"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
@ -14,11 +17,12 @@ func NewModule() core.IModule {
|
|||||||
type MgoLog struct {
|
type MgoLog struct {
|
||||||
cbase.ModuleBase
|
cbase.ModuleBase
|
||||||
db_comp *DB_Comp
|
db_comp *DB_Comp
|
||||||
|
service base.IRPCXService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MgoLog) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *MgoLog) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,3 +34,18 @@ func (this *MgoLog) OnInstallComp() {
|
|||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.db_comp = this.RegisterComp(new(DB_Comp)).(*DB_Comp)
|
this.db_comp = this.RegisterComp(new(DB_Comp)).(*DB_Comp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MgoLog) Start() (err error) {
|
||||||
|
err = this.ModuleBase.Start()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = this.service.RegisterFunctionName(string(comm.Rpc_GatewayNoticeUserClose), this.NoticeUserClose) //注册用户离线通知
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 离线通知
|
||||||
|
func (this *MgoLog) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error {
|
||||||
|
this.db_comp.PushUserTask(args.UserId)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
option go_package = ".;pb";
|
option go_package = ".;pb";
|
||||||
|
|
||||||
|
message Floor{ // 记录阵型保底数据
|
||||||
|
int32 h4 = 1; // 4星次数
|
||||||
|
int32 h5 = 2; // 5星次数
|
||||||
|
}
|
||||||
|
|
||||||
//用户扩展数据
|
//用户扩展数据
|
||||||
message DBUserRecord {
|
message DBUserRecord {
|
||||||
string id = 1; //@go_tags(`bson:"_id"`) ID 主键id
|
string id = 1; //@go_tags(`bson:"_id"`) ID 主键id
|
||||||
string uid = 2; //@go_tags(`bson:"uid"`) 用户ID
|
string uid = 2; //@go_tags(`bson:"uid"`) 用户ID
|
||||||
map<string,int32> floors = 3; // 保底信息
|
Floor race0 = 3; // 普通卡池
|
||||||
int32 triggernum = 4; // 活动数据 存放没有触发次数
|
Floor race1 = 4; // 阵型1卡池
|
||||||
int32 activityid = 5; // 活动id
|
Floor race2 = 5; // 阵型2卡池
|
||||||
int64 mtime = 6; // 修改时间
|
Floor race3 = 6; // 阵型3卡池
|
||||||
|
Floor race4 = 7; // 阵型4卡池
|
||||||
|
int32 triggernum = 8; // 活动数据 存放没有触发次数
|
||||||
|
int32 activityid = 9; // 活动id
|
||||||
|
int64 mtime = 10; // 修改时间
|
||||||
}
|
}
|
@ -20,24 +20,83 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Floor struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
H4 int32 `protobuf:"varint,1,opt,name=h4,proto3" json:"h4"` // 4星次数
|
||||||
|
H5 int32 `protobuf:"varint,2,opt,name=h5,proto3" json:"h5"` // 5星次数
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Floor) Reset() {
|
||||||
|
*x = Floor{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_userrecord_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Floor) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Floor) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Floor) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_userrecord_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Floor.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Floor) Descriptor() ([]byte, []int) {
|
||||||
|
return file_userrecord_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Floor) GetH4() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.H4
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Floor) GetH5() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.H5
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
//用户扩展数据
|
//用户扩展数据
|
||||||
type DBUserRecord struct {
|
type DBUserRecord struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id
|
||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||||
Floors map[string]int32 `protobuf:"bytes,3,rep,name=floors,proto3" json:"floors" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 保底信息
|
Race0 *Floor `protobuf:"bytes,3,opt,name=race0,proto3" json:"race0"` // 普通卡池
|
||||||
Triggernum int32 `protobuf:"varint,4,opt,name=triggernum,proto3" json:"triggernum"` // 活动数据 存放没有触发次数
|
Race1 *Floor `protobuf:"bytes,4,opt,name=race1,proto3" json:"race1"` // 阵型1卡池
|
||||||
Activityid int32 `protobuf:"varint,5,opt,name=activityid,proto3" json:"activityid"` // 活动id
|
Race2 *Floor `protobuf:"bytes,5,opt,name=race2,proto3" json:"race2"` // 阵型2卡池
|
||||||
Mtime int64 `protobuf:"varint,6,opt,name=mtime,proto3" json:"mtime"` // 修改时间
|
Race3 *Floor `protobuf:"bytes,6,opt,name=race3,proto3" json:"race3"` // 阵型3卡池
|
||||||
|
Race4 *Floor `protobuf:"bytes,7,opt,name=race4,proto3" json:"race4"` // 阵型4卡池
|
||||||
|
Triggernum int32 `protobuf:"varint,8,opt,name=triggernum,proto3" json:"triggernum"` // 活动数据 存放没有触发次数
|
||||||
|
Activityid int32 `protobuf:"varint,9,opt,name=activityid,proto3" json:"activityid"` // 活动id
|
||||||
|
Mtime int64 `protobuf:"varint,10,opt,name=mtime,proto3" json:"mtime"` // 修改时间
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUserRecord) Reset() {
|
func (x *DBUserRecord) Reset() {
|
||||||
*x = DBUserRecord{}
|
*x = DBUserRecord{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_userrecord_proto_msgTypes[0]
|
mi := &file_userrecord_proto_msgTypes[1]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -50,7 +109,7 @@ func (x *DBUserRecord) String() string {
|
|||||||
func (*DBUserRecord) ProtoMessage() {}
|
func (*DBUserRecord) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *DBUserRecord) ProtoReflect() protoreflect.Message {
|
func (x *DBUserRecord) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_userrecord_proto_msgTypes[0]
|
mi := &file_userrecord_proto_msgTypes[1]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -63,7 +122,7 @@ func (x *DBUserRecord) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use DBUserRecord.ProtoReflect.Descriptor instead.
|
// Deprecated: Use DBUserRecord.ProtoReflect.Descriptor instead.
|
||||||
func (*DBUserRecord) Descriptor() ([]byte, []int) {
|
func (*DBUserRecord) Descriptor() ([]byte, []int) {
|
||||||
return file_userrecord_proto_rawDescGZIP(), []int{0}
|
return file_userrecord_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUserRecord) GetId() string {
|
func (x *DBUserRecord) GetId() string {
|
||||||
@ -80,9 +139,37 @@ func (x *DBUserRecord) GetUid() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUserRecord) GetFloors() map[string]int32 {
|
func (x *DBUserRecord) GetRace0() *Floor {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Floors
|
return x.Race0
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBUserRecord) GetRace1() *Floor {
|
||||||
|
if x != nil {
|
||||||
|
return x.Race1
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBUserRecord) GetRace2() *Floor {
|
||||||
|
if x != nil {
|
||||||
|
return x.Race2
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBUserRecord) GetRace3() *Floor {
|
||||||
|
if x != nil {
|
||||||
|
return x.Race3
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBUserRecord) GetRace4() *Floor {
|
||||||
|
if x != nil {
|
||||||
|
return x.Race4
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -112,23 +199,28 @@ var File_userrecord_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_userrecord_proto_rawDesc = []byte{
|
var file_userrecord_proto_rawDesc = []byte{
|
||||||
0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f,
|
0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
0x74, 0x6f, 0x22, 0xf4, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63,
|
0x74, 0x6f, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x68,
|
||||||
0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x34, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, 0x34, 0x12, 0x0e, 0x0a, 0x02, 0x68,
|
||||||
0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x35, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x68, 0x35, 0x22, 0x9c, 0x02, 0x0a, 0x0c,
|
||||||
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x73, 0x18,
|
0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02,
|
||||||
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03,
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x2e, 0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c,
|
||||||
0x52, 0x06, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x72, 0x69, 0x67,
|
0x0a, 0x05, 0x72, 0x61, 0x63, 0x65, 0x30, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e,
|
||||||
0x67, 0x65, 0x72, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x72,
|
0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x52, 0x05, 0x72, 0x61, 0x63, 0x65, 0x30, 0x12, 0x1c, 0x0a, 0x05,
|
||||||
0x69, 0x67, 0x67, 0x65, 0x72, 0x6e, 0x75, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69,
|
0x72, 0x61, 0x63, 0x65, 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x46, 0x6c,
|
||||||
0x76, 0x69, 0x74, 0x79, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x63,
|
0x6f, 0x6f, 0x72, 0x52, 0x05, 0x72, 0x61, 0x63, 0x65, 0x31, 0x12, 0x1c, 0x0a, 0x05, 0x72, 0x61,
|
||||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d,
|
0x63, 0x65, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x46, 0x6c, 0x6f, 0x6f,
|
||||||
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x39,
|
0x72, 0x52, 0x05, 0x72, 0x61, 0x63, 0x65, 0x32, 0x12, 0x1c, 0x0a, 0x05, 0x72, 0x61, 0x63, 0x65,
|
||||||
0x0a, 0x0b, 0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
0x33, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x52,
|
||||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
0x05, 0x72, 0x61, 0x63, 0x65, 0x33, 0x12, 0x1c, 0x0a, 0x05, 0x72, 0x61, 0x63, 0x65, 0x34, 0x18,
|
||||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x46, 0x6c, 0x6f, 0x6f, 0x72, 0x52, 0x05, 0x72,
|
||||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
0x61, 0x63, 0x65, 0x34, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x6e,
|
||||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65,
|
||||||
|
0x72, 0x6e, 0x75, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79,
|
||||||
|
0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69,
|
||||||
|
0x74, 0x79, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
||||||
|
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -145,16 +237,20 @@ func file_userrecord_proto_rawDescGZIP() []byte {
|
|||||||
|
|
||||||
var file_userrecord_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
var file_userrecord_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var file_userrecord_proto_goTypes = []interface{}{
|
var file_userrecord_proto_goTypes = []interface{}{
|
||||||
(*DBUserRecord)(nil), // 0: DBUserRecord
|
(*Floor)(nil), // 0: Floor
|
||||||
nil, // 1: DBUserRecord.FloorsEntry
|
(*DBUserRecord)(nil), // 1: DBUserRecord
|
||||||
}
|
}
|
||||||
var file_userrecord_proto_depIdxs = []int32{
|
var file_userrecord_proto_depIdxs = []int32{
|
||||||
1, // 0: DBUserRecord.floors:type_name -> DBUserRecord.FloorsEntry
|
0, // 0: DBUserRecord.race0:type_name -> Floor
|
||||||
1, // [1:1] is the sub-list for method output_type
|
0, // 1: DBUserRecord.race1:type_name -> Floor
|
||||||
1, // [1:1] is the sub-list for method input_type
|
0, // 2: DBUserRecord.race2:type_name -> Floor
|
||||||
1, // [1:1] is the sub-list for extension type_name
|
0, // 3: DBUserRecord.race3:type_name -> Floor
|
||||||
1, // [1:1] is the sub-list for extension extendee
|
0, // 4: DBUserRecord.race4:type_name -> Floor
|
||||||
0, // [0:1] is the sub-list for field type_name
|
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_userrecord_proto_init() }
|
func init() { file_userrecord_proto_init() }
|
||||||
@ -164,6 +260,18 @@ func file_userrecord_proto_init() {
|
|||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_userrecord_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_userrecord_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Floor); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_userrecord_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*DBUserRecord); i {
|
switch v := v.(*DBUserRecord); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
|
Loading…
Reference in New Issue
Block a user