diff --git a/modules/horoscope/api_rest.go b/modules/horoscope/api_rest.go index d2ff658ce..160fdaec7 100644 --- a/modules/horoscope/api_rest.go +++ b/modules/horoscope/api_rest.go @@ -46,7 +46,20 @@ func (this *apiComp) Reset(session comm.IUserSession, req *pb.HoroscopeResetReq) if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.HoroscopeResetCost}, true); errdata != nil { return } + res := make([]*cfg.Gameatn, 0) + for _, v := range info.Consume { + res = append(res, &cfg.Gameatn{ + A: v.A, + T: v.T, + N: v.N, + }) + } + if errdata = this.module.DispenseRes(session, res, true); errdata != nil { + return + } + info.Nodes = make(map[int32]int32) + info.Consume = make([]*pb.UserAssets, 0) info.Lastrest = configure.Now().Unix() if err = this.module.modelHoroscope.updateInfo(session, info); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/horoscope/api_upgrade.go b/modules/horoscope/api_upgrade.go index 93f3c3f32..3127dd1db 100644 --- a/modules/horoscope/api_upgrade.go +++ b/modules/horoscope/api_upgrade.go @@ -18,6 +18,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade info *pb.DBHoroscope conf *cfg.GameHoroscopeData front *cfg.GameHoroscopeData + ok bool err error ) if errdata = this.UpgradeCheck(session, req); errdata != nil { @@ -73,6 +74,24 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade if info.Nodes[conf.NodeId] == 1 { //解锁 go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype173, 1)) } + + for _, v := range conf.CostItem { + ok = false + for _, v1 := range info.Consume { + if v.A == v1.A && v.T == v1.T { + v1.N += v.N + ok = true + } + } + if !ok { + info.Consume = append(info.Consume, &pb.UserAssets{ + A: v.A, + T: v.T, + N: v.N, + }) + } + } + if err = this.module.modelHoroscope.updateInfo(session, info); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -81,6 +100,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade } return } + session.SendMsg(string(this.module.GetType()), "upgrade", &pb.HoroscopeUpgradeResp{Nid: conf.NodeId, Lv: conf.Lv + 1}) return } diff --git a/modules/horoscope/modelhoroscope.go b/modules/horoscope/modelhoroscope.go index fc0caab9a..68a8bbdce 100644 --- a/modules/horoscope/modelhoroscope.go +++ b/modules/horoscope/modelhoroscope.go @@ -61,6 +61,7 @@ func (this *modelHoroscope) updateInfo(session comm.IUserSession, info *pb.DBHor ) err = this.Change(info.Uid, map[string]interface{}{ "nodes": info.Nodes, + "consume": info.Consume, "lastrest": info.Lastrest, }) if model, err = this.module.GetDBModelByUid(info.Uid, this.TableName); err != nil { diff --git a/modules/robot/modulerobot_arena.go b/modules/robot/modulerobot_arena.go index 41004c8a2..c67370521 100644 --- a/modules/robot/modulerobot_arena.go +++ b/modules/robot/modulerobot_arena.go @@ -2,6 +2,7 @@ package robot import ( "errors" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -47,11 +48,11 @@ func (this *ModuleRobot_Arena) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("arena", "info", &pb.ArenaInfoReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } if _, errdata = robot.SendMessage("arena", "matche", &pb.ArenaMatcheReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } switch comm.TaskType(condconf.Type) { @@ -75,7 +76,7 @@ func (this *ModuleRobot_Arena) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD Battle: &pb.BattleFormation{ Format: heros, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "arena", "challengeover", &pb.ArenaChallengeRewardReq{ @@ -87,7 +88,7 @@ func (this *ModuleRobot_Arena) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD Info: resp.(*pb.MainlineChallengeResp).Info, WinSide: 1, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } break diff --git a/modules/robot/modulerobot_equipment.go b/modules/robot/modulerobot_equipment.go index bef7d5af3..a6e1f886e 100644 --- a/modules/robot/modulerobot_equipment.go +++ b/modules/robot/modulerobot_equipment.go @@ -47,7 +47,7 @@ func (this *ModuleRobot_Equipment) DoPipeline(robot IRobot) (err error) { errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("equipment", "getlist", &pb.EquipmentGetListReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } return @@ -82,7 +82,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT HeroCardId: hero.Id, EquipmentId: equipments, }); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } else { @@ -111,7 +111,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT HeroCardId: hero.Id, EquipmentId: equipments, }); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } else { @@ -127,7 +127,12 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "equipment", "upgrade", &pb.EquipmentUpgradeReq{ EquipmentId: equipment.Id, }); errdata != nil { - err = errors.New(errdata.Message) + if errdata.Code == pb.ErrorCode_EquipmentLvlimitReached { + err = nil + return + } else { + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) + } return } case comm.Rtype94: //附魔 @@ -161,7 +166,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT Itemid: item.GridId, Index: 0, }); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } @@ -177,7 +182,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT if resp, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "equipment", "wash", &pb.EquipmentWashReq{ Eid: equipment.Id, }); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } pids = make([]int32, 0) @@ -188,7 +193,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT Eid: equipment.Id, Pids: pids, }); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } @@ -234,7 +239,7 @@ func (this *ModuleRobot_Equipment) findcanupgrade() (equipment *pb.DB_Equipment, equipments = append(equipments, v) } sort.Slice(equipments, func(i, j int) bool { - return equipments[i].Lv < equipments[j].Lv + return equipments[i].Lv > equipments[j].Lv }) for _, equipment = range equipments { if conf, err = this.getGameEquipData(equipment.CId); err != nil { diff --git a/modules/robot/modulerobot_hero.go b/modules/robot/modulerobot_hero.go index 06322cd40..364ed2a1b 100644 --- a/modules/robot/modulerobot_hero.go +++ b/modules/robot/modulerobot_hero.go @@ -2,6 +2,7 @@ package robot import ( "errors" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -45,7 +46,7 @@ func (this *ModuleRobot_Hero) DoPipeline(robot IRobot) (err error) { errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("hero", "list", &pb.HeroListReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } return @@ -59,7 +60,7 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa switch comm.TaskType(condconf.Type) { case comm.Rtype14: if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "drawcard", &pb.HeroDrawCardReq{DrawType: 2, DrawCount: 1, Consume: 0}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } diff --git a/modules/robot/modulerobot_item.go b/modules/robot/modulerobot_item.go index b84a38736..63fb85e0b 100644 --- a/modules/robot/modulerobot_item.go +++ b/modules/robot/modulerobot_item.go @@ -2,6 +2,7 @@ package robot import ( "errors" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -44,7 +45,7 @@ func (this *ModuleRobot_Item) DoPipeline(robot IRobot) (err error) { errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("items", "getlist", &pb.ItemsGetlistReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } return @@ -58,7 +59,7 @@ func (this *ModuleRobot_Item) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa switch comm.TaskType(condconf.Type) { case comm.Rtype14: if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "drawcard", &pb.HeroDrawCardReq{DrawType: 2, DrawCount: 1, Consume: 0}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } diff --git a/modules/robot/modulerobot_mainline.go b/modules/robot/modulerobot_mainline.go index 4bcdfc345..3a95368d3 100644 --- a/modules/robot/modulerobot_mainline.go +++ b/modules/robot/modulerobot_mainline.go @@ -61,7 +61,7 @@ func (this *ModuleRobot_MainLine) DoTask(robot IRobot, taskconf *cfg.GameWorldTa errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("mainline", "info", &pb.MainlineInfoReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } switch comm.TaskType(condconf.Type) { @@ -93,20 +93,20 @@ func (this *ModuleRobot_MainLine) DoTask(robot IRobot, taskconf *cfg.GameWorldTa &pb.MainlineChallengeReq{Level: conf.Id, Battle: &pb.BattleFormation{ Format: heros, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "mainline", "challengeover", &pb.MainlineChallengeOverReq{Level: conf.Id, Report: &pb.BattleReport{ Info: resp.(*pb.MainlineChallengeResp).Info, WinSide: 1, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } break case 3, 7: if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "mainline", "levelpass", &pb.MainlineLevelPassReq{Level: conf.Id}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } default: diff --git a/modules/robot/modulerobot_pagoda.go b/modules/robot/modulerobot_pagoda.go index 73e390ac9..711bae217 100644 --- a/modules/robot/modulerobot_pagoda.go +++ b/modules/robot/modulerobot_pagoda.go @@ -52,7 +52,7 @@ func (this *ModuleRobot_Pagoda) DoTask(robot IRobot, taskconf *cfg.GameWorldTask ) // 获取爬塔信息 if _, errdata = robot.SendMessage("pagoda", "getlist", &pb.PagodaGetListReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } switch comm.TaskType(condconf.Type) { @@ -72,7 +72,7 @@ func (this *ModuleRobot_Pagoda) DoTask(robot IRobot, taskconf *cfg.GameWorldTask Battle: &pb.BattleFormation{ Format: heros, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "pagoda", "challengeover", &pb.PagodaChallengeOverReq{ @@ -81,7 +81,7 @@ func (this *ModuleRobot_Pagoda) DoTask(robot IRobot, taskconf *cfg.GameWorldTask Info: resp.(*pb.PagodaChallengeResp).Info, WinSide: 1, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } break diff --git a/modules/robot/modulerobot_practice.go b/modules/robot/modulerobot_practice.go index 6f8af61bd..71d17f634 100644 --- a/modules/robot/modulerobot_practice.go +++ b/modules/robot/modulerobot_practice.go @@ -42,7 +42,7 @@ func (this *ModuleRobot_Practice) DoTask(robot IRobot, taskconf *cfg.GameWorldTa errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("practice", "info", &pb.PracticeInfoReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } switch comm.TaskType(condconf.Type) { @@ -116,7 +116,7 @@ func (this *ModuleRobot_Practice) practice(tid, cid int32, robot IRobot, index i return } if _, errdata = robot.SendTaskMessage(tid, cid, "practice", "practice", &pb.PracticePracticeReq{Index: index, Hero: hero}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } return diff --git a/modules/robot/modulerobot_sys.go b/modules/robot/modulerobot_sys.go index a9524d8ae..c9cb8fdbd 100644 --- a/modules/robot/modulerobot_sys.go +++ b/modules/robot/modulerobot_sys.go @@ -2,6 +2,7 @@ package robot import ( "errors" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -36,7 +37,7 @@ func (this *ModuleRobot_Sys) DoPipeline(robot IRobot) (err error) { errdata *pb.ErrorData ) if _, errdata = robot.SendMessage("sys", "funcgetlist", &pb.SysFuncGetListReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } return @@ -50,7 +51,7 @@ func (this *ModuleRobot_Sys) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDat switch comm.TaskType(condconf.Type) { case comm.Rtype14: if _, errdata = robot.SendMessage("hero", "drawcard", &pb.HeroDrawCardReq{DrawType: 2, DrawCount: 1, Consume: 0}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } @@ -68,7 +69,7 @@ func (this *ModuleRobot_Sys) funcactivate(tid, sid int32, robot IRobot, cid stri } if _, errdata = robot.SendTaskMessage(tid, sid, "sys", "funcactivate", &pb.SysFuncActivateReq{Cid: cid}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } return diff --git a/modules/robot/modulerobot_user.go b/modules/robot/modulerobot_user.go index a84b7ed6b..534d1de15 100644 --- a/modules/robot/modulerobot_user.go +++ b/modules/robot/modulerobot_user.go @@ -2,6 +2,7 @@ package robot import ( "errors" + "fmt" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -43,7 +44,7 @@ func (this *ModuleRobot_User) DoPipeline(robot IRobot) (err error) { Account: robot.Account(), Sid: robot.ServerId(), }); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } //创角 @@ -55,7 +56,7 @@ func (this *ModuleRobot_User) DoPipeline(robot IRobot) (err error) { if errdata.Code == pb.ErrorCode_RoleCreated { //已创角 err = nil } else { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) } return diff --git a/modules/robot/modulerobot_wtask.go b/modules/robot/modulerobot_wtask.go index a0d5539b9..4f0df2ec4 100644 --- a/modules/robot/modulerobot_wtask.go +++ b/modules/robot/modulerobot_wtask.go @@ -2,6 +2,7 @@ package robot import ( "errors" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" @@ -91,7 +92,7 @@ func (this *ModuleRobot_WTask) DoPipeline(robot IRobot) (err error) { ) //获取任务列表 if _, errdata = robot.SendMessage("wtask", "info", &pb.WTaskInfoReq{}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } var ( @@ -108,7 +109,7 @@ locp: } if this.checkaccept(tconf) { //是否需要接收任务 if _, errdata = robot.SendMessage("wtask", "accept", &pb.WTaskAcceptReq{Tid: tconf.Key}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } continue @@ -148,7 +149,7 @@ locp: continue } else { //任务已完成直接完成 if _, errdata = robot.SendMessage("wtask", "finish", &pb.WTaskFinishReq{Tid: tconf.Key}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } } @@ -164,7 +165,7 @@ func (this *ModuleRobot_WTask) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD switch comm.TaskType(condconf.Type) { case comm.Rtype20001: //完成对话 if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "wtask", "completecondi", &pb.WTaskCompleteCondiReq{TaskId: taskconf.Key, CondiId: condconf.Id}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } break @@ -177,14 +178,14 @@ func (this *ModuleRobot_WTask) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) heros = heromodule.getbattlehero() if resp, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "wtask", "battlestart", &pb.WTaskBattleStartReq{BattleConfId: condconf.Filter[0], Battle: &pb.BattleFormation{Format: heros}}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "wtask", "battlefinish", &pb.WTaskBattleFinishReq{BattleConfId: condconf.Filter[0], Report: &pb.BattleReport{ Info: resp.(*pb.WTaskBattleStartResp).Info, WinSide: 1, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } break @@ -197,14 +198,14 @@ func (this *ModuleRobot_WTask) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) heros = heromodule.getbattlehero() if resp, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "wtask", "battlestart", &pb.WTaskBattleStartReq{BattleConfId: condconf.Filter[0], Battle: &pb.BattleFormation{Format: heros}}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "wtask", "battlefinish", &pb.WTaskBattleFinishReq{BattleConfId: condconf.Filter[0], Report: &pb.BattleReport{ Info: resp.(*pb.WTaskBattleStartResp).Info, WinSide: 2, }}); errdata != nil { - err = errors.New(errdata.Message) + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) return } break diff --git a/modules/robot/robot.go b/modules/robot/robot.go index 35e611438..3bc6be58b 100644 --- a/modules/robot/robot.go +++ b/modules/robot/robot.go @@ -168,7 +168,7 @@ func (this *Robot) SendTaskMessage(task, comdi int32, mtype, stype string, msg p messageresp = <-this.await //等待回应 resp = messageresp.resp errdata = messageresp.errdata - log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "Task", Value: fmt.Sprintf("[%d-%d]", task, comdi)}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "resp", Value: errdata == nil}) + log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "Task", Value: fmt.Sprintf("[%d-%d]", task, comdi)}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata == nil}) } return } diff --git a/pb/horoscope_db.pb.go b/pb/horoscope_db.pb.go index 971f435d5..9b04cb555 100644 --- a/pb/horoscope_db.pb.go +++ b/pb/horoscope_db.pb.go @@ -29,7 +29,8 @@ type DBHoroscope struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //uid Nodes map[int32]int32 `protobuf:"bytes,3,rep,name=nodes,proto3" json:"nodes" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //节点信息 key:是节点id value:等级 - Lastrest int64 `protobuf:"varint,4,opt,name=lastrest,proto3" json:"lastrest"` //上次重置时间 + Consume []*UserAssets `protobuf:"bytes,4,rep,name=consume,proto3" json:"consume"` //消耗 用于返还 + Lastrest int64 `protobuf:"varint,5,opt,name=lastrest,proto3" json:"lastrest"` //上次重置时间 } func (x *DBHoroscope) Reset() { @@ -85,6 +86,13 @@ func (x *DBHoroscope) GetNodes() map[int32]int32 { return nil } +func (x *DBHoroscope) GetConsume() []*UserAssets { + if x != nil { + return x.Consume + } + return nil +} + func (x *DBHoroscope) GetLastrest() int64 { if x != nil { return x.Lastrest @@ -96,20 +104,23 @@ var File_horoscope_horoscope_db_proto protoreflect.FileDescriptor var file_horoscope_horoscope_db_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x68, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2f, 0x68, 0x6f, 0x72, 0x6f, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, - 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, - 0x12, 0x2d, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x44, 0x42, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x4e, 0x6f, - 0x64, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, - 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x0a, 0x0a, 0x4e, - 0x6f, 0x64, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, + 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdb, 0x01, 0x0a, 0x0b, 0x44, + 0x42, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x05, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, + 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x73, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x73, 0x74, 0x1a, 0x38, + 0x0a, 0x0a, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -128,14 +139,16 @@ var file_horoscope_horoscope_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2 var file_horoscope_horoscope_db_proto_goTypes = []interface{}{ (*DBHoroscope)(nil), // 0: DBHoroscope nil, // 1: DBHoroscope.NodesEntry + (*UserAssets)(nil), // 2: UserAssets } var file_horoscope_horoscope_db_proto_depIdxs = []int32{ 1, // 0: DBHoroscope.nodes:type_name -> DBHoroscope.NodesEntry - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 2, // 1: DBHoroscope.consume:type_name -> UserAssets + 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 } func init() { file_horoscope_horoscope_db_proto_init() } @@ -143,6 +156,7 @@ func file_horoscope_horoscope_db_proto_init() { if File_horoscope_horoscope_db_proto != nil { return } + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_horoscope_horoscope_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBHoroscope); i {