This commit is contained in:
meixiongfeng 2022-06-28 19:15:28 +08:00
commit 8e5c18f2a7
58 changed files with 1149 additions and 1143 deletions

View File

@ -8,73 +8,73 @@ import (
var ( var (
//friend //friend
friend_builders = []*builder{ friendBuilders = []*builder{
{ {
//list //list
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_List, subType: friend.FriendSubTypeList,
req: &pb.Friend_List_Req{}, req: &pb.FriendListReq{},
rsp: &pb.Friend_List_Rsp{}, rsp: &pb.FriendListRsp{},
enabled: true, enabled: true,
}, { }, {
//blacklist //blacklist
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_Blacklist, subType: friend.FriendSubTypeBlacklist,
req: &pb.Friend_BlackList_Req{}, req: &pb.FriendBlackListReq{},
rsp: &pb.Friend_BlackList_Rsp{}, rsp: &pb.FriendBlackListRsp{},
}, { }, {
//search //search
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_Search, subType: friend.FriendSubTypeSearch,
req: &pb.Friend_Search_Req{ req: &pb.FriendSearchReq{
NickName: "", //设置测试参数 NickName: "", //设置测试参数
}, },
rsp: &pb.Friend_Search_Rsp{}, rsp: &pb.FriendSearchRsp{},
}, { }, {
//apply //apply
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_Apply, subType: friend.FriendSubTypeApply,
req: &pb.Friend_Apply_Req{}, req: &pb.FriendApplyReq{},
rsp: &pb.Friend_Apply_Rsp{}, rsp: &pb.FriendApplyRsp{},
enabled: true, enabled: true,
}, { }, {
//applylist //applylist
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_ApplyList, subType: friend.FriendSubTypeApplyList,
req: &pb.Friend_ApplyList_Req{}, req: &pb.FriendApplyListReq{},
rsp: &pb.Friend_ApplyList_Rsp{}, rsp: &pb.FriendApplyListRsp{},
}, { }, {
//agree //agree
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_Agree, subType: friend.FriendSubTypeAgree,
req: &pb.Friend_Agree_Req{}, req: &pb.FriendAgreeReq{},
rsp: &pb.Friend_Agree_Rsp{}, rsp: &pb.FriendAgreeRsp{},
}, { }, {
//refuse //refuse
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_Refuse, subType: friend.FriendSubTypeRefuse,
req: &pb.Friend_Agree_Req{}, req: &pb.FriendAgreeReq{},
rsp: &pb.Friend_Agree_Rsp{}, rsp: &pb.FriendAgreeRsp{},
}, { }, {
//addblack //addblack
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_AddBlack, subType: friend.FriendSubTypeAddBlack,
req: &pb.Friend_BlackAdd_Req{ req: &pb.FriendBlackAddReq{
FriendId: "", FriendId: "",
}, },
rsp: &pb.Friend_BlackAdd_Rsp{}, rsp: &pb.FriendBlackAddRsp{},
}, { }, {
//delblack //delblack
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.Friend_SubType_DelBlack, subType: friend.FriendSubTypeDelBlack,
req: &pb.Friend_DelBlack_Req{}, req: &pb.FriendDelBlackReq{},
rsp: &pb.Friend_DelBlack_Rsp{}, rsp: &pb.FriendDelBlackRsp{},
}, },
} }
) )
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunFriend() { func (r *Robot) RunFriend() {
r.addBuilders(friend_builders) r.addBuilders(friendBuilders)
r.handleReq() r.handleReq()
} }

View File

@ -8,19 +8,23 @@ import (
var ( var (
//hero //hero
hero_builders = []*builder{ heroBuilders = []*builder{
{ {
mainType: string(comm.SM_HeroModule), mainType: string(comm.ModuleHero),
subType: hero.Hero_SubType_List, subType: hero.HeroSubTypeList,
req: &pb.Hero_List_Req{}, req: &pb.HeroListReq{},
rsp: &pb.Hero_List_Rsp{}, rsp: &pb.HeroListRsp{},
enabled: true, enabled: true,
}, {
mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeList,
req: &pb.HeroInfoReq{},
}, },
} }
) )
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunHero() { func (r *Robot) RunHero() {
r.addBuilders(hero_builders) r.addBuilders(heroBuilders)
r.handleReq() r.handleReq()
} }

View File

@ -37,7 +37,7 @@ func (r *Robot) AccountLogin() {
log.Printf("区服:[%d] 账号:[%s] login...", r.opts.ServerId, r.opts.Account) log.Printf("区服:[%d] 账号:[%s] login...", r.opts.ServerId, r.opts.Account)
builders := []*builder{ builders := []*builder{
{ {
mainType: string(comm.SM_UserModule), mainType: string(comm.ModuleUser),
subType: user.UserSubTypeLogin, subType: user.UserSubTypeLogin,
req: &pb.UserLoginReq{ req: &pb.UserLoginReq{
Account: r.opts.Account, Account: r.opts.Account,

View File

@ -8,8 +8,8 @@ import (
var notify_builders = []*builder{ var notify_builders = []*builder{
{ {
//create //create
mainType: comm.MainType_Notify, mainType: comm.MainTypeNotify,
subType: comm.SubType_ErrorNotify, subType: comm.SubTypeErrorNotify,
rsp: &pb.ErrorNotify{}, rsp: &pb.ErrorNotify{},
enabled: true, enabled: true,
}, },

View File

@ -9,7 +9,7 @@ import (
var pack_builders = []*builder{ var pack_builders = []*builder{
{ {
//create //create
mainType: string(comm.SM_PackModule), mainType: string(comm.ModulePack),
subType: "queryuserpackreq", subType: "queryuserpackreq",
// req: &pb.Pack_Getlist_Req{IType: 1}, // req: &pb.Pack_Getlist_Req{IType: 1},
rsp: &pb.UserCreateRsp{}, rsp: &pb.UserCreateRsp{},

View File

@ -103,7 +103,6 @@ func (r *Robot) handleReq() {
//执行响应 //执行响应
func (r *Robot) handleRsp(msg *pb.UserMessage) { func (r *Robot) handleRsp(msg *pb.UserMessage) {
for i, b := range r.builders { for i, b := range r.builders {
if b.enabled && (msg.MainType == b.mainType && if b.enabled && (msg.MainType == b.mainType &&
msg.SubType == b.subType) { msg.SubType == b.subType) {

View File

@ -10,13 +10,13 @@ import (
var user_builders = []*builder{ var user_builders = []*builder{
{ {
//create //create
mainType: string(comm.SM_UserModule), mainType: string(comm.ModuleUser),
subType: user.UserSubTypeCreate, subType: user.UserSubTypeCreate,
req: &pb.UserCreateReq{ //设置请求参数 req: &pb.UserCreateReq{ //设置请求参数
NickName: "乐谷6281", NickName: "乐谷6281",
}, },
rsp: &pb.UserCreateRsp{}, rsp: &pb.UserCreateRsp{},
enabled: true, // enabled: true,
}, },
} }

View File

@ -22,23 +22,23 @@ const (
//ERR //ERR
const ( const (
MainType_Notify = "notify" //通知 MainTypeNotify = "notify" //通知
SubType_ErrorNotify = "errornotify" //错误通知 SubTypeErrorNotify = "errornotify" //错误通知
) )
//模块名定义处 //模块名定义处
const ( const (
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块 ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块
SM_WebModule core.M_Modules = "web" //web模块 ModuleWeb core.M_Modules = "web" //web模块
SM_UserModule core.M_Modules = "user" //用户模块 ModuleUser core.M_Modules = "user" //用户模块
SM_PackModule core.M_Modules = "pack" //背包模块 ModulePack core.M_Modules = "pack" //背包模块
SM_MailModule core.M_Modules = "mail" //邮件模块 ModuleMail core.M_Modules = "mail" //邮件模块
SM_FriendModule core.M_Modules = "friend" //好友模块 ModuleFriend core.M_Modules = "friend" //好友模块
SM_LogModelModule core.M_Modules = "model" //日志模块 ModuleLogModel core.M_Modules = "model" //日志模块
SM_EquipmentModule core.M_Modules = "equipment" //装备模块 ModuleEquipment core.M_Modules = "equipment" //装备模块
SM_HeroModule core.M_Modules = "hero" //英雄模块 ModuleHero core.M_Modules = "hero" //英雄模块
SM_ForumModule core.M_Modules = "forum" //论坛模块 ModuleForum core.M_Modules = "forum" //论坛模块
SM_ItemsModule core.M_Modules = "item" ModuleItems core.M_Modules = "item"
) )
//RPC服务接口定义处 //RPC服务接口定义处
@ -55,13 +55,13 @@ const ( //Rpc
//事件类型定义处 //事件类型定义处
const ( const (
Event_UserLogin core.Event_Key = "Event_UserLogin" //登录事件 EventUserLogin core.Event_Key = "Event_UserLogin" //登录事件
Event_CreateUser core.Event_Key = "Event_CreateUser" //创建角色事件 EventCreateUser core.Event_Key = "Event_CreateUser" //创建角色事件
Event_UserOffline core.Event_Key = "Event_UserOffline" //用户离线事件 EventUserOffline core.Event_Key = "Event_UserOffline" //用户离线事件
) )
const ( const (
DBService_Status string = "DBService_status" DBServiceStatus string = "DBService_status"
) )
const ( const (

View File

@ -42,11 +42,11 @@ type (
// 获取英雄 // 获取英雄
// heroId 英雄ID // heroId 英雄ID
GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
// 佩戴装备 // 佩戴装备
UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
//获取玩家英雄列表 //获取玩家英雄列表
GetHeroList(uid string) []*pb.DB_HeroData GetHeroList(uid string) []*pb.DBHero
} }
//玩家 //玩家

View File

@ -66,24 +66,28 @@ func (this *UserSession) IsLogin() bool {
///wokerId 用户绑定worker服务id ///wokerId 用户绑定worker服务id
func (this *UserSession) Bind(uid string, wokerId string) (err error) { func (this *UserSession) Bind(uid string, wokerId string) (err error) {
reply := &pb.RPCMessageReply{} reply := &pb.RPCMessageReply{}
if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentBind), &pb.AgentBuildReq{ if err = this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentBind), &pb.AgentBuildReq{
UserSessionId: this.SessionId, UserSessionId: this.SessionId,
UserId: uid, UserId: uid,
WorkerId: wokerId, WorkerId: wokerId,
}, reply); err != nil { }, reply); err != nil {
log.Errorf("Bind UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err) log.Errorf("Bind UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err)
return
} }
this.UserId = uid
return return
} }
//解绑uid 注销和切换账号是处理 //解绑uid 注销和切换账号是处理
func (this *UserSession) UnBind() (err error) { func (this *UserSession) UnBind() (err error) {
reply := &pb.RPCMessageReply{} reply := &pb.RPCMessageReply{}
if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentUnBind), &pb.AgentUnBuildReq{ if err = this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentUnBind), &pb.AgentUnBuildReq{
UserSessionId: this.SessionId, UserSessionId: this.SessionId,
}, reply); err != nil { }, reply); err != nil {
log.Errorf("UnBuild UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err) log.Errorf("UnBuild UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err)
return
} }
this.UserId = ""
return return
} }

View File

@ -30,7 +30,7 @@ func (this *DB_Comp) Start() (err error) {
err = this.MCompModel.Start() err = this.MCompModel.Start()
model_count := this.Model_TotalCount() model_count := this.Model_TotalCount()
if model_count > 0 { //1000 if model_count > 0 { //1000
this.Redis.Set(comm.DBService_Status, true, -1) this.Redis.Set(comm.DBServiceStatus, true, -1)
this.isInit = false this.isInit = false
} else { } else {
this.isInit = true this.isInit = true
@ -48,7 +48,7 @@ func (this *DB_Comp) run() {
this.Model_UpdateDBByLog("") this.Model_UpdateDBByLog("")
} }
if !this.isInit && this.Model_TotalCount() <= 0 { if !this.isInit && this.Model_TotalCount() <= 0 {
this.Redis.Delete(comm.DBService_Status) this.Redis.Delete(comm.DBServiceStatus)
} }
} }
} }

View File

@ -23,7 +23,7 @@ func (this *DBService) Init(service core.IService, module core.IModule, options
} }
func (this *DBService) GetType() core.M_Modules { func (this *DBService) GetType() core.M_Modules {
return comm.SM_LogModelModule return comm.ModuleLogModel
} }
func (this *DBService) OnInstallComp() { func (this *DBService) OnInstallComp() {

View File

@ -14,7 +14,7 @@ func (this *apiComp) EquipCheck(session comm.IUserSession, req *pb.Equipment_Equ
errorCode pb.ErrorCode errorCode pb.ErrorCode
confs []*cfg.Game_equipData confs []*cfg.Game_equipData
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DBHero
) )
confs = make([]*cfg.Game_equipData, len(req.EquipmentId)) confs = make([]*cfg.Game_equipData, len(req.EquipmentId))
equipments = make([]*pb.DB_Equipment, len(req.EquipmentId)) equipments = make([]*pb.DB_Equipment, len(req.EquipmentId))
@ -53,13 +53,13 @@ func (this *apiComp) Equip(session comm.IUserSession, agrs map[string]interface{
equipment *pb.DB_Equipment equipment *pb.DB_Equipment
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
updatequipment []*pb.DB_Equipment updatequipment []*pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DBHero
) )
confs = agrs["conf"].([]*cfg.Game_equipData) confs = agrs["conf"].([]*cfg.Game_equipData)
equipments = agrs["equipment"].([]*pb.DB_Equipment) equipments = agrs["equipment"].([]*pb.DB_Equipment)
updatequipment = make([]*pb.DB_Equipment, 0) updatequipment = make([]*pb.DB_Equipment, 0)
hero = agrs["hero"].(*pb.DB_HeroData) hero = agrs["hero"].(*pb.DBHero)
for i, v := range hero.EquipID { for i, v := range hero.EquipID {
if v != "" { if v != "" {

View File

@ -55,7 +55,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
conf *cfg.Game_equipData conf *cfg.Game_equipData
intensify *cfg.Game_equipIntensifyData intensify *cfg.Game_equipIntensifyData
equipment *pb.DB_Equipment equipment *pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DBHero
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
issucc bool issucc bool
) )

View File

@ -31,7 +31,7 @@ type Equipment struct {
//模块名 //模块名
func (this *Equipment) GetType() core.M_Modules { func (this *Equipment) GetType() core.M_Modules {
return comm.SM_EquipmentModule return comm.ModuleEquipment
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件
@ -45,7 +45,7 @@ func (this *Equipment) Init(service core.IService, module core.IModule, options
func (this *Equipment) Start() (err error) { func (this *Equipment) Start() (err error) {
err = this.ModuleBase.Start() err = this.ModuleBase.Start()
var module interface{} var module interface{}
if module, err = this.service.GetModule(comm.SM_HeroModule); err != nil { if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
log.Errorf("Equipment Start err:%v", err) log.Errorf("Equipment Start err:%v", err)
return return
} }

View File

@ -25,7 +25,7 @@ type Forum struct {
//模块名 //模块名
func (this *Forum) GetType() core.M_Modules { func (this *Forum) GetType() core.M_Modules {
return comm.SM_EquipmentModule return comm.ModuleEquipment
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -6,15 +6,15 @@ import (
) )
const ( const (
Friend_SubType_List = "list" FriendSubTypeList = "list"
Friend_SubType_Apply = "apply" FriendSubTypeApply = "apply"
Friend_SubType_ApplyList = "applylist" FriendSubTypeApplyList = "applylist"
Friend_SubType_AddBlack = "addblack" FriendSubTypeAddBlack = "addblack"
Friend_SubType_DelBlack = "delblack" FriendSubTypeDelBlack = "delblack"
Friend_SubType_Blacklist = "blacklist" FriendSubTypeBlacklist = "blacklist"
Friend_SubType_Agree = "agree" FriendSubTypeAgree = "agree"
Friend_SubType_Refuse = "refuse" FriendSubTypeRefuse = "refuse"
Friend_SubType_Search = "search" FriendSubTypeSearch = "search"
) )
type apiComp struct { type apiComp struct {

View File

@ -6,14 +6,14 @@ import (
"go_dreamfactory/utils" "go_dreamfactory/utils"
) )
func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.Friend_BlackAdd_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendBlackAddReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
var ( var (
err error err error
blackNumMax = 50 //TODO 从配置中读取 blackNumMax = 50 //TODO 从配置中读取
) )
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
target := &pb.DB_FriendData{UId: req.FriendId} target := &pb.DBFriend{UId: req.FriendId}
err = this.module.modelFriend.Get(session.GetUserId(), self) err = this.module.modelFriend.Get(session.GetUserId(), self)
if self == nil || err != nil { if self == nil || err != nil {
@ -58,22 +58,22 @@ func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.Friend_Bla
} }
//加入黑名单 //加入黑名单
func (this *apiComp) Addblack(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_BlackAdd_Req) (code pb.ErrorCode) { func (this *apiComp) Addblack(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendBlackAddReq) (code pb.ErrorCode) {
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_BlackAdd_Rsp rsp *pb.FriendBlackAddRsp
) )
defer func() { defer func() {
rsp = &pb.Friend_BlackAdd_Rsp{ rsp = &pb.FriendBlackAddRsp{
FriendId: req.FriendId, FriendId: req.FriendId,
UserId: session.GetUserId(), UserId: session.GetUserId(),
} }
session.SendMsg(string(this.module.GetType()), Friend_SubType_AddBlack, rsp) session.SendMsg(string(this.module.GetType()), FriendSubTypeAddBlack, rsp)
}() }()
if v, ok := chk["self"]; ok { if v, ok := chk["self"]; ok {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
//将目标加入黑名单 //将目标加入黑名单
self.BlackIds = append(self.BlackIds, req.FriendId) self.BlackIds = append(self.BlackIds, req.FriendId)

View File

@ -6,10 +6,10 @@ import (
"go_dreamfactory/utils" "go_dreamfactory/utils"
) )
func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.Friend_Agree_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
var err error var err error
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
//获取玩家自己好友数据 //获取玩家自己好友数据
err = this.module.modelFriend.Get(session.GetUserId(), self) err = this.module.modelFriend.Get(session.GetUserId(), self)
@ -34,18 +34,18 @@ func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.Friend_Agree_
} }
//单个/批量同意 //单个/批量同意
func (this *apiComp) Agree(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_Agree_Req) (code pb.ErrorCode) { func (this *apiComp) Agree(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendAgreeReq) (code pb.ErrorCode) {
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_Agree_Rsp rsp *pb.FriendAgreeRsp
optNum int32 optNum int32
) )
defer func() { defer func() {
rsp = &pb.Friend_Agree_Rsp{ rsp = &pb.FriendAgreeRsp{
Num: optNum, Num: optNum,
} }
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_Agree, rsp) err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAgree, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -56,7 +56,7 @@ func (this *apiComp) Agree(session comm.IUserSession, chk map[string]interface{}
code = pb.ErrorCode_FriendTargetNoData code = pb.ErrorCode_FriendTargetNoData
return return
} else { } else {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
} }
if agreeIds, ok := chk["agreeIds"]; ok { if agreeIds, ok := chk["agreeIds"]; ok {
@ -70,7 +70,7 @@ func (this *apiComp) Agree(session comm.IUserSession, chk map[string]interface{}
} }
//双向添加:将自己加入到申请人的好友列表中 //双向添加:将自己加入到申请人的好友列表中
target := &pb.DB_FriendData{} target := &pb.DBFriend{}
err := this.module.modelFriend.Get(userId, target) err := this.module.modelFriend.Get(userId, target)
if target == nil || err != nil { if target == nil || err != nil {
code = pb.ErrorCode_FriendTargetNoData code = pb.ErrorCode_FriendTargetNoData

View File

@ -7,11 +7,11 @@ import (
"go_dreamfactory/utils" "go_dreamfactory/utils"
) )
func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.Friend_Apply_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
var err error var err error
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
target := &pb.DB_FriendData{UId: req.FriendId} target := &pb.DBFriend{UId: req.FriendId}
//获取玩家自己好友数据 //获取玩家自己好友数据
err = this.module.modelFriend.Get(session.GetUserId(), self) err = this.module.modelFriend.Get(session.GetUserId(), self)
@ -79,24 +79,24 @@ func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.Friend_Apply_
} }
//好友申请 //好友申请
func (this *apiComp) Apply(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_Apply_Req) (code pb.ErrorCode) { func (this *apiComp) Apply(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendApplyReq) (code pb.ErrorCode) {
var ( var (
target *pb.DB_FriendData target *pb.DBFriend
rsp *pb.Friend_Apply_Rsp rsp *pb.FriendApplyRsp
) )
defer func() { defer func() {
utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), Friend_SubType_Apply, req, rsp) utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), FriendSubTypeApply, req, rsp)
}() }()
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
rsp = &pb.Friend_Apply_Rsp{ rsp = &pb.FriendApplyRsp{
UserId: session.GetUserId(), UserId: session.GetUserId(),
FriendId: req.FriendId, FriendId: req.FriendId,
} }
} }
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_Apply, rsp) err := session.SendMsg(string(this.module.GetType()), FriendSubTypeApply, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -107,7 +107,7 @@ func (this *apiComp) Apply(session comm.IUserSession, chk map[string]interface{}
code = pb.ErrorCode_FriendTargetNoData code = pb.ErrorCode_FriendTargetNoData
return return
} else { } else {
target = v.(*pb.DB_FriendData) target = v.(*pb.DBFriend)
} }
//将自己加入到目标用户的申请列表中 //将自己加入到目标用户的申请列表中

View File

@ -5,9 +5,9 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.Friend_ApplyList_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.FriendApplyListReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
err := this.module.modelFriend.Get(session.GetUserId(), self) err := this.module.modelFriend.Get(session.GetUserId(), self)
if self == nil || err != nil { if self == nil || err != nil {
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData} code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData}
@ -18,24 +18,24 @@ func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.Friend_Ap
} }
//申请列表 //申请列表
func (this *apiComp) ApplyList(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_ApplyList_Req) (code pb.ErrorCode) { func (this *apiComp) ApplyList(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendApplyListReq) (code pb.ErrorCode) {
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_ApplyList_Rsp rsp *pb.FriendApplyListRsp
list []*pb.FriendBase list []*pb.FriendBase
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
rsp = &pb.Friend_ApplyList_Rsp{ rsp = &pb.FriendApplyListRsp{
List: list, List: list,
} }
} }
session.SendMsg(string(this.module.GetType()), Friend_SubType_ApplyList, rsp) session.SendMsg(string(this.module.GetType()), FriendSubTypeApplyList, rsp)
}() }()
if v, ok := chk["self"]; ok { if v, ok := chk["self"]; ok {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
for _, userId := range self.ApplyIds { for _, userId := range self.ApplyIds {
//TODO 组装FriendBase明细数据 //TODO 组装FriendBase明细数据
list = append(list, &pb.FriendBase{ list = append(list, &pb.FriendBase{

View File

@ -5,9 +5,9 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.Friend_BlackList_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBlackListReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
err := this.module.modelFriend.Get(session.GetUserId(), self) err := this.module.modelFriend.Get(session.GetUserId(), self)
if self == nil || err != nil { if self == nil || err != nil {
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData} code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData}
@ -18,19 +18,19 @@ func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.Friend_Bl
} }
//黑名单 //黑名单
func (this *apiComp) Blacklist(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_BlackList_Req) (code pb.ErrorCode) { func (this *apiComp) Blacklist(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendBlackListReq) (code pb.ErrorCode) {
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_BlackList_Rsp rsp *pb.FriendBlackListRsp
list []*pb.FriendBase list []*pb.FriendBase
) )
defer func() { defer func() {
rsp = &pb.Friend_BlackList_Rsp{ rsp = &pb.FriendBlackListRsp{
Friends: list, Friends: list,
} }
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_Blacklist, rsp) err := session.SendMsg(string(this.module.GetType()), FriendSubTypeBlacklist, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -38,7 +38,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, chk map[string]interfa
}() }()
if v, ok := chk["self"]; ok { if v, ok := chk["self"]; ok {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
for _, userId := range self.BlackIds { for _, userId := range self.BlackIds {
//TODO 完善FriendBase信息 //TODO 完善FriendBase信息
list = append(list, &pb.FriendBase{ list = append(list, &pb.FriendBase{

View File

@ -5,11 +5,11 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.Friend_Del_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (chk map[string]interface{}, code comm.ErrorCode) {
return return
} }
//删除好友 //删除好友
func (this *apiComp) Del(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_Del_Req) error { func (this *apiComp) Del(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendDelReq) error {
return nil return nil
} }

View File

@ -6,9 +6,9 @@ import (
"go_dreamfactory/utils" "go_dreamfactory/utils"
) )
func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.Friend_DelBlack_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelBlackReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
err := this.module.modelFriend.Get(session.GetUserId(), self) err := this.module.modelFriend.Get(session.GetUserId(), self)
if self == nil || err != nil { if self == nil || err != nil {
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData} code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData}
@ -19,19 +19,19 @@ func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.Friend_Del
} }
//删除黑名单 //删除黑名单
func (this *apiComp) Delblack(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_DelBlack_Req) (code pb.ErrorCode) { func (this *apiComp) Delblack(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendDelBlackReq) (code pb.ErrorCode) {
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_DelBlack_Rsp rsp *pb.FriendDelBlackRsp
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
rsp = &pb.Friend_DelBlack_Rsp{ rsp = &pb.FriendDelBlackRsp{
FriendId: req.FriendId, FriendId: req.FriendId,
UserId: session.GetUserId(), UserId: session.GetUserId(),
} }
} }
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_DelBlack, rsp) err := session.SendMsg(string(this.module.GetType()), FriendSubTypeDelBlack, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -39,7 +39,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, chk map[string]interfac
}() }()
if v, ok := chk["self"]; ok { if v, ok := chk["self"]; ok {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
//从黑名单列表中删除目标 //从黑名单列表中删除目标
self.BlackIds = utils.DeleteString(self.BlackIds, req.FriendId) self.BlackIds = utils.DeleteString(self.BlackIds, req.FriendId)
//更新黑名单 //更新黑名单

View File

@ -5,9 +5,9 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.Friend_List_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.FriendListReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
err := this.module.modelFriend.Get(session.GetUserId(), self) err := this.module.modelFriend.Get(session.GetUserId(), self)
if self == nil || err != nil { if self == nil || err != nil {
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData} code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData}
@ -18,18 +18,18 @@ func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.Friend_List_Re
} }
//好友列表 //好友列表
func (this *apiComp) List(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_List_Req) (code pb.ErrorCode) { func (this *apiComp) List(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendListReq) (code pb.ErrorCode) {
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_List_Rsp rsp *pb.FriendListRsp
list []*pb.FriendBase list []*pb.FriendBase
) )
defer func() { defer func() {
rsp = &pb.Friend_List_Rsp{ rsp = &pb.FriendListRsp{
List: list, List: list,
} }
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_List, rsp) err := session.SendMsg(string(this.module.GetType()), FriendSubTypeList, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -37,7 +37,7 @@ func (this *apiComp) List(session comm.IUserSession, chk map[string]interface{},
}() }()
if v, ok := chk["self"]; ok { if v, ok := chk["self"]; ok {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
for _, userId := range self.FriendIds { for _, userId := range self.FriendIds {
list = append(list, &pb.FriendBase{ list = append(list, &pb.FriendBase{
UserId: userId, UserId: userId,

View File

@ -6,10 +6,10 @@ import (
"go_dreamfactory/utils" "go_dreamfactory/utils"
) )
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.Friend_Refuse_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuseReq) (chk map[string]interface{}, code comm.ErrorCode) {
chk = make(map[string]interface{}) chk = make(map[string]interface{})
var err error var err error
self := &pb.DB_FriendData{UId: session.GetUserId()} self := &pb.DBFriend{UId: session.GetUserId()}
//获取玩家自己好友数据 //获取玩家自己好友数据
err = this.module.modelFriend.Get(session.GetUserId(), self) err = this.module.modelFriend.Get(session.GetUserId(), self)
@ -33,19 +33,19 @@ func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.Friend_Refus
} }
//单个/批量拒绝 //单个/批量拒绝
func (this *apiComp) Refuse(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_Refuse_Req) (code pb.ErrorCode) { func (this *apiComp) Refuse(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendRefuseReq) (code pb.ErrorCode) {
//将申请人从申请列表中删除 //将申请人从申请列表中删除
var ( var (
self *pb.DB_FriendData self *pb.DBFriend
rsp *pb.Friend_Refuse_Rsp rsp *pb.FriendRefuseRsp
optNum int32 optNum int32
) )
defer func() { defer func() {
rsp = &pb.Friend_Refuse_Rsp{ rsp = &pb.FriendRefuseRsp{
Num: optNum, Num: optNum,
} }
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_Refuse, rsp) err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRefuse, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -56,7 +56,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, chk map[string]interface{
code = pb.ErrorCode_FriendTargetNoData code = pb.ErrorCode_FriendTargetNoData
return return
} else { } else {
self = v.(*pb.DB_FriendData) self = v.(*pb.DBFriend)
if v, ok := chk["refuseIds"]; ok { if v, ok := chk["refuseIds"]; ok {
//将申请人从申请列表中删除 //将申请人从申请列表中删除

View File

@ -5,7 +5,7 @@ import (
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.Friend_Search_Req) (chk map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (chk map[string]interface{}, code comm.ErrorCode) {
if req.NickName == "" { if req.NickName == "" {
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSearchNameEmpty} code = comm.ErrorCode{Code: pb.ErrorCode_FriendSearchNameEmpty}
return return
@ -14,18 +14,18 @@ func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.Friend_Searc
} }
//搜索 //搜索
func (this *apiComp) Search(session comm.IUserSession, chk map[string]interface{}, req *pb.Friend_Search_Req) (code pb.ErrorCode) { func (this *apiComp) Search(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendSearchReq) (code pb.ErrorCode) {
var ( var (
rsp *pb.Friend_Search_Rsp rsp *pb.FriendSearchRsp
friend *pb.FriendBase friend *pb.FriendBase
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
rsp = &pb.Friend_Search_Rsp{ rsp = &pb.FriendSearchRsp{
Friend: friend, Friend: friend,
} }
} }
session.SendMsg(string(this.module.GetType()), Friend_SubType_Search, rsp) session.SendMsg(string(this.module.GetType()), FriendSubTypeSearch, rsp)
}() }()
user := this.module.modelFriend.Frined_FindCond(req.NickName) user := this.module.modelFriend.Frined_FindCond(req.NickName)

View File

@ -19,7 +19,7 @@ type Friend struct {
} }
func (this *Friend) GetType() core.M_Modules { func (this *Friend) GetType() core.M_Modules {
return comm.SM_FriendModule return comm.ModuleFriend
} }
func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {

View File

@ -24,7 +24,7 @@ type Game struct {
//模块名 //模块名
func (this *Game) GetType() core.M_Modules { func (this *Game) GetType() core.M_Modules {
return comm.SM_EquipmentModule return comm.ModuleEquipment
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -83,8 +83,8 @@ locp:
} else { } else {
data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode_SecKeyInvalid}) data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode_SecKeyInvalid})
if err = this.WriteMsg(&pb.UserMessage{ if err = this.WriteMsg(&pb.UserMessage{
MainType: comm.MainType_Notify, MainType: comm.MainTypeNotify,
SubType: comm.SubType_ErrorNotify, SubType: comm.SubTypeErrorNotify,
Data: data, Data: data,
}); err != nil { }); err != nil {
go this.Close() go this.Close()
@ -234,8 +234,8 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
if reply.Code != pb.ErrorCode_Success { if reply.Code != pb.ErrorCode_Success {
data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode(reply.Code.Number())}) data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode(reply.Code.Number())})
err = this.WriteMsg(&pb.UserMessage{ err = this.WriteMsg(&pb.UserMessage{
MainType: comm.MainType_Notify, MainType: comm.MainTypeNotify,
SubType: comm.SubType_ErrorNotify, SubType: comm.SubTypeErrorNotify,
Data: data, Data: data,
}) })
return return

View File

@ -40,6 +40,7 @@ func (this *AgentMgrComp) DisConnect(a IAgent) {
if a.UserId() != "" { //登录用户 通知业务服务处理玩家离线相关 if a.UserId() != "" { //登录用户 通知业务服务处理玩家离线相关
reply := &pb.RPCMessageReply{} reply := &pb.RPCMessageReply{}
if _, err := this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Worker, a.WorkerId()), string(comm.Rpc_NoticeUserClose), &pb.NoticeUserCloseReq{ if _, err := this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Worker, a.WorkerId()), string(comm.Rpc_NoticeUserClose), &pb.NoticeUserCloseReq{
UserSessionId: a.SessionId(),
UserId: a.UserId(), UserId: a.UserId(),
}, reply); err != nil { }, reply); err != nil {
log.Errorf(" uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err) log.Errorf(" uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err)

View File

@ -29,7 +29,7 @@ type Gateway struct {
//模块名 //模块名
func (this *Gateway) GetType() core.M_Modules { func (this *Gateway) GetType() core.M_Modules {
return comm.SM_GateModule return comm.ModuleGate
} }
//模块自定义参数 //模块自定义参数

View File

@ -15,13 +15,13 @@ type apiComp struct {
const ( //消息回复的头名称 const ( //消息回复的头名称
StrengthenUplv = "strengthenherolv" StrengthenUplv = "strengthenherolv"
Hero_SubType_Info = "info" //英雄卡片信息 HeroSubTypeInfo = "info" //英雄卡片信息
Hero_SubType_List = "list" //英雄列表 HeroSubTypeList = "list" //英雄列表
) )
//组件初始化接口 //组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options) err = this.MCompGate.Init(service, module, comp, options)
this.moduleHero = module.(*Hero) this.moduleHero = module.(*Hero)
this.service = service this.service = service
return return
@ -32,7 +32,7 @@ func (this *apiComp) Start() (err error) {
var module core.IModule var module core.IModule
if module, err = this.service.GetModule(comm.SM_UserModule); err != nil { if module, err = this.service.GetModule(comm.ModuleUser); err != nil {
return return
} }
this.user = module.(comm.IUser) this.user = module.(comm.IUser)

View File

@ -8,7 +8,7 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.Hero_StrengthenUpStar_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.HeroStrengthenUpStarReq) (result map[string]interface{}, code comm.ErrorCode) {
if req.HeroObjID == "" { if req.HeroObjID == "" {
code.Code = pb.ErrorCode_ReqParameterError code.Code = pb.ErrorCode_ReqParameterError
return return
@ -16,7 +16,7 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He
var ( var (
curLv int32 curLv int32
target *cfg.Game_heroStarupData // 配置表目标升星英雄信息 target *cfg.Game_heroStarupData // 配置表目标升星英雄信息
raceHero *pb.DB_HeroData // 消耗的阵容英雄 raceHero *pb.DBHeroData // 消耗的阵容英雄
costRaceCount int32 costRaceCount int32
curGold int32 curGold int32
) )
@ -101,13 +101,13 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He
} }
/// 英雄升星 /// 英雄升星
func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUpStar_Req) (code pb.ErrorCode) { func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string]interface{}, req *pb.HeroStrengthenUpStarReq) (code pb.ErrorCode) {
var ( var (
costGold int32 // 当前需要消耗金币的数量 costGold int32 // 当前需要消耗金币的数量
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.Hero_StrengthenUpStar_Resp{}) session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUpStarResp{})
} }
}() }()
costGold = agrs["costGold"].(int32) costGold = agrs["costGold"].(int32)

View File

@ -7,7 +7,7 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero_StrengthenUplv_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.HeroStrengthenUplvReq) (result map[string]interface{}, code comm.ErrorCode) {
if req.HeroObjID == "" { if req.HeroObjID == "" {
code.Code = pb.ErrorCode_ReqParameterError code.Code = pb.ErrorCode_ReqParameterError
return return
@ -107,7 +107,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero
} }
/// 英雄升级 /// 英雄升级
func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) { func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]interface{}, req *pb.HeroStrengthenUplvReq) (code pb.ErrorCode) {
var ( var (
curLv int32 curLv int32
curExp int32 // 当前英雄的经验 curExp int32 // 当前英雄的经验
@ -117,7 +117,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{}) session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{})
} }
}() }()
costGold = agrs["costGold"].(int32) costGold = agrs["costGold"].(int32)

View File

@ -6,7 +6,7 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.Hero_Info_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.HeroInfoReq) (result map[string]interface{}, code comm.ErrorCode) {
result = map[string]interface{}{} result = map[string]interface{}{}
hero := this.moduleHero.modelHero.getOneHero(session.GetUserId(), req.HeroId) hero := this.moduleHero.modelHero.getOneHero(session.GetUserId(), req.HeroId)
if hero == nil { if hero == nil {
@ -16,10 +16,10 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.Hero_Info_Req)
return return
} }
func (this *apiComp) Info(session comm.IUserSession, result map[string]interface{}, req *pb.Hero_Info_Req) (code pb.ErrorCode) { func (this *apiComp) Info(session comm.IUserSession, result map[string]interface{}, req *pb.HeroInfoReq) (code pb.ErrorCode) {
rsp := &pb.Hero_Info_Rsp{} rsp := &pb.HeroInfoRsp{}
defer func() { defer func() {
err := session.SendMsg(string(this.moduleHero.GetType()), Hero_SubType_Info, rsp) err := session.SendMsg(string(this.moduleHero.GetType()), HeroSubTypeInfo, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -27,7 +27,7 @@ func (this *apiComp) Info(session comm.IUserSession, result map[string]interface
}() }()
if v, ok := result["hero"]; ok { if v, ok := result["hero"]; ok {
rsp.Base = v.(*pb.DB_HeroData) rsp.Base = v.(*pb.DBHero)
} }
return return
} }

View File

@ -6,15 +6,15 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.Hero_List_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.HeroListReq) (result map[string]interface{}, code comm.ErrorCode) {
return return
} }
func (this *apiComp) List(session comm.IUserSession, result map[string]interface{}, req *pb.Hero_List_Req) (code pb.ErrorCode) { func (this *apiComp) List(session comm.IUserSession, result map[string]interface{}, req *pb.HeroListReq) (code pb.ErrorCode) {
rsp := &pb.Hero_List_Rsp{} rsp := &pb.HeroListRsp{}
defer func() { defer func() {
err := session.SendMsg(this.moduleHero.api.service.GetType(), Hero_SubType_List, rsp) err := session.SendMsg(string(this.moduleHero.GetType()), HeroSubTypeList, rsp)
if err != nil { if err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
} }

View File

@ -5,7 +5,6 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"math" "math"
@ -27,14 +26,14 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
} }
//初始化英雄 //初始化英雄
func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DB_HeroData { func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
heroCfg := this.moduleHero.configure.GetHero(heroCfgId) heroCfg := this.moduleHero.configure.GetHero(heroCfgId)
if heroCfg == nil { if heroCfg == nil {
log.Errorf("%v hero not found from config %v", heroCfgId) log.Errorf("%v hero not found from config %v", heroCfgId)
return nil return nil
} }
objId := primitive.NewObjectID().Hex() objId := primitive.NewObjectID().Hex()
newHero := &pb.DB_HeroData{ newHero := &pb.DBHero{
Id: objId, Id: objId,
Uid: uid, Uid: uid,
HeroID: heroCfg.Hid, HeroID: heroCfg.Hid,
@ -78,8 +77,8 @@ func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
} }
//获取一个英雄 //获取一个英雄
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DB_HeroData { func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
hero := &pb.DB_HeroData{} hero := &pb.DBHero{}
err := this.moduleHero.modelHero.GetListObj(uid, heroId, hero) err := this.moduleHero.modelHero.GetListObj(uid, heroId, hero)
if err != nil { if err != nil {
return nil return nil
@ -92,24 +91,15 @@ func (this *ModelHero) consumeOneHeroCard(uid, heroId string) error {
return this.moduleHero.modelHero.DelListlds(uid, heroId) return this.moduleHero.modelHero.DelListlds(uid, heroId)
} }
func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorCode) { func (this *Hero) ModifyHero(heroId *pb.DBHero) (*pb.DBHero, pb.ErrorCode) {
return nil, pb.ErrorCode_HeroNoExist return nil, pb.ErrorCode_HeroNoExist
} }
//获取玩家的英雄列表 //获取玩家的英雄列表
func (this *ModelHero) getHeroList(uid string) ([]*pb.DB_HeroData, error) { func (this *ModelHero) getHeroList(uid string) ([]*pb.DBHero, error) {
herokeys := make(map[string]string) heroes := make([]*pb.DBHero, 0)
err := this.Get(uid, herokeys) err := this.GetList(uid, &heroes)
if err != nil {
if err == redis.RedisNil {
return make([]*pb.DB_HeroData, 0), nil
}
return nil, err
}
heroes := make([]*pb.DB_HeroData, 0)
err = this.GetList(uid, &heroes)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -130,7 +120,7 @@ func (this *ModelHero) setEquipment(uid, heroId string, equipIds []string) pb.Er
//指定英雄升级 //指定英雄升级
func (this *ModelHero) levelUp(uid string, heroId int32) error { func (this *ModelHero) levelUp(uid string, heroId int32) error {
var heroes []*pb.DB_HeroData var heroes []*pb.DBHero
err := this.moduleHero.modelHero.GetList(uid, heroes) err := this.moduleHero.modelHero.GetList(uid, heroes)
if err != nil { if err != nil {
log.Errorf("levelUp err:%v", err) log.Errorf("levelUp err:%v", err)

View File

@ -22,7 +22,7 @@ type Hero struct {
//模块名 //模块名
func (this *Hero) GetType() core.M_Modules { func (this *Hero) GetType() core.M_Modules {
return comm.SM_HeroModule return comm.ModuleHero
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件
@ -47,7 +47,7 @@ func (this *Hero) CreateHero(uid string, heroCfgId ...int32) error {
//消耗英雄卡 //消耗英雄卡
func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode) { func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode) {
heroes := this.GetHeroList(uId) heroes := this.GetHeroList(uId)
var curList []*pb.DB_HeroData var curList []*pb.DBHero
for _, v := range heroes { for _, v := range heroes {
if heroCfgId == v.HeroID { if heroCfgId == v.HeroID {
curList = append(curList, v) curList = append(curList, v)
@ -68,7 +68,7 @@ func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.
} }
//获取英雄 //获取英雄
func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) { func (this *Hero) GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
hero := this.modelHero.getOneHero(uid, heroId) hero := this.modelHero.getOneHero(uid, heroId)
if hero == nil { if hero == nil {
return nil, pb.ErrorCode_HeroNoExist return nil, pb.ErrorCode_HeroNoExist
@ -77,7 +77,7 @@ func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) {
} }
//佩戴装备 //佩戴装备
func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) { func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
equipIds := make([]string, 4) equipIds := make([]string, 4)
for _, v := range equip { for _, v := range equip {
equipIds = append(equipIds, v.Id) equipIds = append(equipIds, v.Id)
@ -86,7 +86,7 @@ func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment
} }
//英雄列表 //英雄列表
func (this *Hero) GetHeroList(uid string) []*pb.DB_HeroData { func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
list, err := this.modelHero.getHeroList(uid) list, err := this.modelHero.getHeroList(uid)
if err != nil { if err != nil {
return nil return nil

View File

@ -28,7 +28,7 @@ type Items struct {
//模块名称 //模块名称
func (this *Items) GetType() core.M_Modules { func (this *Items) GetType() core.M_Modules {
return comm.SM_ItemsModule return comm.ModuleItems
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -34,7 +34,7 @@ func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start() err = this.MCompGate.Start()
var module core.IModule var module core.IModule
if module, err = this.service.GetModule(comm.SM_ItemsModule); err != nil { if module, err = this.service.GetModule(comm.ModuleItems); err != nil {
return return
} }
this.items = module.(comm.IItems) this.items = module.(comm.IItems)

View File

@ -30,7 +30,7 @@ type Mail struct {
} }
func (this *Mail) GetType() core.M_Modules { func (this *Mail) GetType() core.M_Modules {
return comm.SM_MailModule return comm.ModuleMail
} }
func (this *Mail) OnInstallComp() { func (this *Mail) OnInstallComp() {

View File

@ -89,15 +89,15 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
hero comm.IHero //英雄模块 hero comm.IHero //英雄模块
// equipment comm.IEquipment //装备模块 // equipment comm.IEquipment //装备模块
) )
if module, err = this.service.GetModule(comm.SM_UserModule); err == nil { if module, err = this.service.GetModule(comm.ModuleUser); err == nil {
return return
} }
user = module.(comm.IUser) user = module.(comm.IUser)
if module, err = this.service.GetModule(comm.SM_ItemsModule); err == nil { if module, err = this.service.GetModule(comm.ModuleItems); err == nil {
return return
} }
items = module.(comm.IItems) items = module.(comm.IItems)
if module, err = this.service.GetModule(comm.SM_HeroModule); err == nil { if module, err = this.service.GetModule(comm.ModuleHero); err == nil {
return return
} }
hero = module.(comm.IHero) hero = module.(comm.IHero)

View File

@ -33,7 +33,7 @@ func (this *apiComp) Start() (err error) {
var module core.IModule var module core.IModule
//get module hero //get module hero
if module, err = this.service.GetModule(comm.SM_HeroModule); err != nil { if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
return return
} }
this.hero = module.(comm.IHero) this.hero = module.(comm.IHero)

View File

@ -33,7 +33,7 @@ func (this *apiComp) Login(session comm.IUserSession, result map[string]interfac
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
} }
event.TriggerEvent(comm.Event_UserLogin, user.Uid) event.TriggerEvent(comm.EventUserLogin, user.Uid)
} }
}() }()

View File

@ -21,7 +21,7 @@ type User struct {
} }
func (this *User) GetType() core.M_Modules { func (this *User) GetType() core.M_Modules {
return comm.SM_UserModule return comm.ModuleUser
} }
func (this *User) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *User) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
@ -38,7 +38,7 @@ func (this *User) OnInstallComp() {
} }
//获取英雄列表 //获取英雄列表
func (this *User) GetHeroList(uid string) []*pb.DB_HeroData { func (this *User) GetHeroList(uid string) []*pb.DBHero {
return nil return nil
} }

View File

@ -27,7 +27,7 @@ type Web struct {
//模块名 //模块名
func (this *Web) GetType() core.M_Modules { func (this *Web) GetType() core.M_Modules {
return comm.SM_WebModule return comm.ModuleWeb
} }
//模块自定义参数 //模块自定义参数

View File

@ -692,7 +692,8 @@ type NoticeUserCloseReq struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId"` UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId"`
UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId"`
} }
func (x *NoticeUserCloseReq) Reset() { func (x *NoticeUserCloseReq) Reset() {
@ -727,6 +728,13 @@ func (*NoticeUserCloseReq) Descriptor() ([]byte, []int) {
return file_comm_proto_rawDescGZIP(), []int{9} return file_comm_proto_rawDescGZIP(), []int{9}
} }
func (x *NoticeUserCloseReq) GetUserSessionId() string {
if x != nil {
return x.UserSessionId
}
return ""
}
func (x *NoticeUserCloseReq) GetUserId() string { func (x *NoticeUserCloseReq) GetUserId() string {
if x != nil { if x != nil {
return x.UserId return x.UserId
@ -814,15 +822,17 @@ var file_comm_proto_rawDesc = []byte{
0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55,
0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49,
0x64, 0x22, 0x2c, 0x0a, 0x12, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x64, 0x22, 0x52, 0x0a, 0x12, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43,
0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,
0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a,
0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55,
0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74,
0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48,
0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03,
0x6f, 0x74, 0x6f, 0x33, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03,
0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -20,7 +20,7 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type DB_FriendData struct { type DBFriend struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -31,8 +31,8 @@ type DB_FriendData struct {
BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID
} }
func (x *DB_FriendData) Reset() { func (x *DBFriend) Reset() {
*x = DB_FriendData{} *x = DBFriend{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_friend_friend_db_proto_msgTypes[0] mi := &file_friend_friend_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -40,13 +40,13 @@ func (x *DB_FriendData) Reset() {
} }
} }
func (x *DB_FriendData) String() string { func (x *DBFriend) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*DB_FriendData) ProtoMessage() {} func (*DBFriend) ProtoMessage() {}
func (x *DB_FriendData) ProtoReflect() protoreflect.Message { func (x *DBFriend) ProtoReflect() protoreflect.Message {
mi := &file_friend_friend_db_proto_msgTypes[0] mi := &file_friend_friend_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -58,33 +58,33 @@ func (x *DB_FriendData) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use DB_FriendData.ProtoReflect.Descriptor instead. // Deprecated: Use DBFriend.ProtoReflect.Descriptor instead.
func (*DB_FriendData) Descriptor() ([]byte, []int) { func (*DBFriend) Descriptor() ([]byte, []int) {
return file_friend_friend_db_proto_rawDescGZIP(), []int{0} return file_friend_friend_db_proto_rawDescGZIP(), []int{0}
} }
func (x *DB_FriendData) GetUId() string { func (x *DBFriend) GetUId() string {
if x != nil { if x != nil {
return x.UId return x.UId
} }
return "" return ""
} }
func (x *DB_FriendData) GetFriendIds() []string { func (x *DBFriend) GetFriendIds() []string {
if x != nil { if x != nil {
return x.FriendIds return x.FriendIds
} }
return nil return nil
} }
func (x *DB_FriendData) GetApplyIds() []string { func (x *DBFriend) GetApplyIds() []string {
if x != nil { if x != nil {
return x.ApplyIds return x.ApplyIds
} }
return nil return nil
} }
func (x *DB_FriendData) GetBlackIds() []string { func (x *DBFriend) GetBlackIds() []string {
if x != nil { if x != nil {
return x.BlackIds return x.BlackIds
} }
@ -95,16 +95,15 @@ var File_friend_friend_db_proto protoreflect.FileDescriptor
var file_friend_friend_db_proto_rawDesc = []byte{ var file_friend_friend_db_proto_rawDesc = []byte{
0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x0d, 0x44, 0x42, 0x5f, 0x46, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x72, 0x0a, 0x08, 0x44, 0x42, 0x46, 0x72,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e,
0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73,
0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73,
0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03,
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04,
0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x33,
} }
var ( var (
@ -121,7 +120,7 @@ func file_friend_friend_db_proto_rawDescGZIP() []byte {
var file_friend_friend_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_friend_friend_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_friend_friend_db_proto_goTypes = []interface{}{ var file_friend_friend_db_proto_goTypes = []interface{}{
(*DB_FriendData)(nil), // 0: DB_FriendData (*DBFriend)(nil), // 0: DBFriend
} }
var file_friend_friend_db_proto_depIdxs = []int32{ var file_friend_friend_db_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method output_type
@ -138,7 +137,7 @@ func file_friend_friend_db_proto_init() {
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_friend_friend_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_friend_friend_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DB_FriendData); i { switch v := v.(*DBFriend); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ func (x *SkillData) GetSkillLv() int32 {
return 0 return 0
} }
type DB_HeroData struct { type DBHero struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -103,8 +103,8 @@ type DB_HeroData struct {
Count int32 `protobuf:"varint,21,opt,name=count,proto3" json:"count"` // 数量 Count int32 `protobuf:"varint,21,opt,name=count,proto3" json:"count"` // 数量
} }
func (x *DB_HeroData) Reset() { func (x *DBHero) Reset() {
*x = DB_HeroData{} *x = DBHero{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_hero_hero_db_proto_msgTypes[1] mi := &file_hero_hero_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -112,13 +112,13 @@ func (x *DB_HeroData) Reset() {
} }
} }
func (x *DB_HeroData) String() string { func (x *DBHero) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*DB_HeroData) ProtoMessage() {} func (*DBHero) ProtoMessage() {}
func (x *DB_HeroData) ProtoReflect() protoreflect.Message { func (x *DBHero) ProtoReflect() protoreflect.Message {
mi := &file_hero_hero_db_proto_msgTypes[1] mi := &file_hero_hero_db_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))
@ -130,152 +130,152 @@ func (x *DB_HeroData) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use DB_HeroData.ProtoReflect.Descriptor instead. // Deprecated: Use DBHero.ProtoReflect.Descriptor instead.
func (*DB_HeroData) Descriptor() ([]byte, []int) { func (*DBHero) Descriptor() ([]byte, []int) {
return file_hero_hero_db_proto_rawDescGZIP(), []int{1} return file_hero_hero_db_proto_rawDescGZIP(), []int{1}
} }
func (x *DB_HeroData) GetId() string { func (x *DBHero) GetId() string {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return ""
} }
func (x *DB_HeroData) GetUid() string { func (x *DBHero) GetUid() string {
if x != nil { if x != nil {
return x.Uid return x.Uid
} }
return "" return ""
} }
func (x *DB_HeroData) GetHeroID() int32 { func (x *DBHero) GetHeroID() int32 {
if x != nil { if x != nil {
return x.HeroID return x.HeroID
} }
return 0 return 0
} }
func (x *DB_HeroData) GetStar() int32 { func (x *DBHero) GetStar() int32 {
if x != nil { if x != nil {
return x.Star return x.Star
} }
return 0 return 0
} }
func (x *DB_HeroData) GetLv() int32 { func (x *DBHero) GetLv() int32 {
if x != nil { if x != nil {
return x.Lv return x.Lv
} }
return 0 return 0
} }
func (x *DB_HeroData) GetExp() int32 { func (x *DBHero) GetExp() int32 {
if x != nil { if x != nil {
return x.Exp return x.Exp
} }
return 0 return 0
} }
func (x *DB_HeroData) GetJuexingLv() int32 { func (x *DBHero) GetJuexingLv() int32 {
if x != nil { if x != nil {
return x.JuexingLv return x.JuexingLv
} }
return 0 return 0
} }
func (x *DB_HeroData) GetCaptainSkill() int32 { func (x *DBHero) GetCaptainSkill() int32 {
if x != nil { if x != nil {
return x.CaptainSkill return x.CaptainSkill
} }
return 0 return 0
} }
func (x *DB_HeroData) GetNormalSkill() []*SkillData { func (x *DBHero) GetNormalSkill() []*SkillData {
if x != nil { if x != nil {
return x.NormalSkill return x.NormalSkill
} }
return nil return nil
} }
func (x *DB_HeroData) GetProperty() map[int32]int32 { func (x *DBHero) GetProperty() map[int32]int32 {
if x != nil { if x != nil {
return x.Property return x.Property
} }
return nil return nil
} }
func (x *DB_HeroData) GetAddProperty() map[int32]int32 { func (x *DBHero) GetAddProperty() map[int32]int32 {
if x != nil { if x != nil {
return x.AddProperty return x.AddProperty
} }
return nil return nil
} }
func (x *DB_HeroData) GetFormation() int32 { func (x *DBHero) GetFormation() int32 {
if x != nil { if x != nil {
return x.Formation return x.Formation
} }
return 0 return 0
} }
func (x *DB_HeroData) GetCardType() int32 { func (x *DBHero) GetCardType() int32 {
if x != nil { if x != nil {
return x.CardType return x.CardType
} }
return 0 return 0
} }
func (x *DB_HeroData) GetCurSkin() int32 { func (x *DBHero) GetCurSkin() int32 {
if x != nil { if x != nil {
return x.CurSkin return x.CurSkin
} }
return 0 return 0
} }
func (x *DB_HeroData) GetSkins() []int32 { func (x *DBHero) GetSkins() []int32 {
if x != nil { if x != nil {
return x.Skins return x.Skins
} }
return nil return nil
} }
func (x *DB_HeroData) GetBlock() bool { func (x *DBHero) GetBlock() bool {
if x != nil { if x != nil {
return x.Block return x.Block
} }
return false return false
} }
func (x *DB_HeroData) GetEquipID() []string { func (x *DBHero) GetEquipID() []string {
if x != nil { if x != nil {
return x.EquipID return x.EquipID
} }
return nil return nil
} }
func (x *DB_HeroData) GetResonateNum() int32 { func (x *DBHero) GetResonateNum() int32 {
if x != nil { if x != nil {
return x.ResonateNum return x.ResonateNum
} }
return 0 return 0
} }
func (x *DB_HeroData) GetDistributionResonate() int32 { func (x *DBHero) GetDistributionResonate() int32 {
if x != nil { if x != nil {
return x.DistributionResonate return x.DistributionResonate
} }
return 0 return 0
} }
func (x *DB_HeroData) GetEnergy() map[int32]int32 { func (x *DBHero) GetEnergy() map[int32]int32 {
if x != nil { if x != nil {
return x.Energy return x.Energy
} }
return nil return nil
} }
func (x *DB_HeroData) GetCount() int32 { func (x *DBHero) GetCount() int32 {
if x != nil { if x != nil {
return x.Count return x.Count
} }
@ -290,62 +290,61 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x12,
0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xe2, 0x06, 0x0a, 0x0b, 0x44, 0x42, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xce, 0x06, 0x0a, 0x06, 0x44, 0x42,
0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x48, 0x65, 0x72, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x44,
0x65, 0x72, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x44, 0x12, 0x12,
0x6f, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74,
0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x06, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x75, 0x65, 0x03, 0x65, 0x78, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x4c,
0x78, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x75, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67,
0x65, 0x78, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x61, 0x4c, 0x76, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x6b, 0x69,
0x69, 0x6e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69,
0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x2f, 0x0a, 0x0b, 0x6e, 0x6e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x2f, 0x0a, 0x0b, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c,
0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62,
0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x6e, 0x6f, 0x72, 0x6d,
0x0b, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x39, 0x0a, 0x08, 0x61, 0x6c, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65,
0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x72, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44,
0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e,
0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x3d, 0x0a,
0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03,
0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x41,
0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09,
0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61,
0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x72, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61,
0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61, 0x72, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69,
0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69, 0x6e, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69, 0x6e,
0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69, 0x6e, 0x12, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x6b, 0x69, 0x6e, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x05, 0x52,
0x14, 0x0a, 0x05, 0x73, 0x6b, 0x69, 0x6e, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x05, 0x73, 0x6b, 0x69, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18,
0x73, 0x6b, 0x69, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x10, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x65, 0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x65,
0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x65, 0x71, 0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x6e, 0x61,
0x75, 0x69, 0x70, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x73,
0x65, 0x4e, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x32, 0x0a, 0x14, 0x64, 0x69, 0x73, 0x74,
0x6e, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x32, 0x0a, 0x14, 0x64, 0x69, 0x73, 0x74, 0x72, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65,
0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x18, 0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x06,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x65, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70,
0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45,
0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x45, 0x6e, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75,
0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, 0x52, 0x6e, 0x74, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e,
0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e,
0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -363,16 +362,16 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte {
var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_hero_hero_db_proto_goTypes = []interface{}{ var file_hero_hero_db_proto_goTypes = []interface{}{
(*SkillData)(nil), // 0: pb.SkillData (*SkillData)(nil), // 0: pb.SkillData
(*DB_HeroData)(nil), // 1: pb.DB_HeroData (*DBHero)(nil), // 1: pb.DBHero
nil, // 2: pb.DB_HeroData.PropertyEntry nil, // 2: pb.DBHero.PropertyEntry
nil, // 3: pb.DB_HeroData.AddPropertyEntry nil, // 3: pb.DBHero.AddPropertyEntry
nil, // 4: pb.DB_HeroData.EnergyEntry nil, // 4: pb.DBHero.EnergyEntry
} }
var file_hero_hero_db_proto_depIdxs = []int32{ var file_hero_hero_db_proto_depIdxs = []int32{
0, // 0: pb.DB_HeroData.normalSkill:type_name -> pb.SkillData 0, // 0: pb.DBHero.normalSkill:type_name -> pb.SkillData
2, // 1: pb.DB_HeroData.property:type_name -> pb.DB_HeroData.PropertyEntry 2, // 1: pb.DBHero.property:type_name -> pb.DBHero.PropertyEntry
3, // 2: pb.DB_HeroData.addProperty:type_name -> pb.DB_HeroData.AddPropertyEntry 3, // 2: pb.DBHero.addProperty:type_name -> pb.DBHero.AddPropertyEntry
4, // 3: pb.DB_HeroData.energy:type_name -> pb.DB_HeroData.EnergyEntry 4, // 3: pb.DBHero.energy:type_name -> pb.DBHero.EnergyEntry
4, // [4:4] is the sub-list for method output_type 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 method input_type
4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension type_name
@ -399,7 +398,7 @@ func file_hero_hero_db_proto_init() {
} }
} }
file_hero_hero_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_hero_hero_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DB_HeroData); i { switch v := v.(*DBHero); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,7 @@ message BroadCastMessageReq {
message AgentCloseeReq { string UserSessionId = 1; } message AgentCloseeReq { string UserSessionId = 1; }
//线 //线
message NoticeUserCloseReq { string UserId = 1; } message NoticeUserCloseReq {string UserSessionId = 1; string UserId = 2; }
// //
enum HeroAttributesType{ enum HeroAttributesType{

View File

@ -1,7 +1,7 @@
syntax = "proto3"; syntax = "proto3";
option go_package = ".;pb"; option go_package = ".;pb";
message DB_FriendData { message DBFriend {
string uId = 1; //@go_tags(`bson:"uId"`) ID string uId = 1; //@go_tags(`bson:"uId"`) ID
repeated string friendIds = 2; //@go_tags(`bson:"friendIds"`) ID repeated string friendIds = 2; //@go_tags(`bson:"friendIds"`) ID
repeated string applyIds = 3; //@go_tags(`bson:"applyIds"`) ID repeated string applyIds = 3; //@go_tags(`bson:"applyIds"`) ID

View File

@ -12,97 +12,97 @@ message FriendBase {
} }
// //
message Friend_List_Req {} message FriendListReq {}
message Friend_List_Rsp { repeated FriendBase list = 1; } message FriendListRsp { repeated FriendBase list = 1; }
// //
message Friend_Apply_Req { message FriendApplyReq {
string friendId = 1; //ID string friendId = 1; //ID
} }
message Friend_Apply_Rsp { message FriendApplyRsp {
string userId = 1; //ID string userId = 1; //ID
string friendId = 2; //ID string friendId = 2; //ID
} }
// //
message Friend_Del_Req { message FriendDelReq {
string friendId = 1; //ID string friendId = 1; //ID
} }
message Friend_Del_Rsp { message FriendDelRsp {
string friendId = 1; //ID string friendId = 1; //ID
string userId = 2; //ID string userId = 2; //ID
} }
// //
message Friend_Agree_Req { message FriendAgreeReq {
repeated string friendIds = 1; // repeated string friendIds = 1; //
} }
message Friend_Agree_Rsp { message FriendAgreeRsp {
int32 Num = 1; // int32 Num = 1; //
} }
// //
message Friend_Refuse_Req { message FriendRefuseReq {
repeated string friendIds = 1; // repeated string friendIds = 1; //
} }
message Friend_Refuse_Rsp { message FriendRefuseRsp {
int32 Num = 1; // int32 Num = 1; //
} }
// //
message Friend_ApplyList_Req {} message FriendApplyListReq {}
message Friend_ApplyList_Rsp { repeated FriendBase list = 1; } message FriendApplyListRsp { repeated FriendBase list = 1; }
// //
message Friend_Search_Req { message FriendSearchReq {
string nickName = 1; // string nickName = 1; //
} }
message Friend_Search_Rsp { FriendBase friend = 1; } message FriendSearchRsp { FriendBase friend = 1; }
// //
message Friend_BlackList_Req {} message FriendBlackListReq {}
message Friend_BlackList_Rsp { repeated FriendBase friends = 1; } message FriendBlackListRsp { repeated FriendBase friends = 1; }
// //
message Friend_BlackAdd_Req { string friendId = 1; } message FriendBlackAddReq { string friendId = 1; }
message Friend_BlackAdd_Rsp { message FriendBlackAddRsp {
string friendId = 1; string friendId = 1;
string userId = 2; string userId = 2;
} }
// //
message Friend_DelBlack_Req { string friendId = 1; } message FriendDelBlackReq { string friendId = 1; }
message Friend_DelBlack_Rsp { message FriendDelBlackRsp {
string friendId = 1; string friendId = 1;
string userId = 2; string userId = 2;
} }
// //
message Friend_Receive_Req { string friendId = 1; } message FriendReceiveReq { string friendId = 1; }
message Friend_Receive_Rsp { message FriendReceiveRsp {
string friendId = 1; string friendId = 1;
string userId = 2; string userId = 2;
} }
// //
message Friend_Give_Req { string friendId = 1; } message FriendGiveReq { string friendId = 1; }
message Friend_Give_Rsp { message FriendGiveRsp {
string friendId = 1; string friendId = 1;
string userId = 2; string userId = 2;
} }
// //
message Friend_Total_Req { string friendId = 1; } message FriendTotalReq { string friendId = 1; }
message Friend_Total_Rsp { message FriendTotalRsp {
string friendId = 1; string friendId = 1;
int32 total = 2; // int32 total = 2; //
} }

View File

@ -2,19 +2,12 @@ syntax = "proto3";
option go_package = ".;pb"; option go_package = ".;pb";
package pb; package pb;
// enum PropertyType{
// Hp = 0; //
// Atk = 1; //
// Def = 2; //
// Speed = 3; //
// Crit = 4; //
// }
message SkillData { message SkillData {
int32 skillID = 1; int32 skillID = 1;
int32 skillLv = 2; int32 skillLv = 2;
} }
message DB_HeroData {
message DBHero {
string id = 1; //@go_tags(`bson:"_id"`) ID string id = 1; //@go_tags(`bson:"_id"`) ID
string uid = 2; string uid = 2;
int32 heroID = 3; //@go_tags(`bson:"heroID"`) ID int32 heroID = 3; //@go_tags(`bson:"heroID"`) ID

View File

@ -4,15 +4,15 @@ package pb;
import "hero/hero_db.proto"; import "hero/hero_db.proto";
// //
message Hero_Info_Req { message HeroInfoReq {
string heroId = 1; //ID string heroId = 1; //ID
} }
message Hero_Info_Rsp { DB_HeroData base = 1; } message HeroInfoRsp { DBHero base = 1; }
// //
message Hero_List_Req {} message HeroListReq {}
message Hero_List_Rsp { repeated DB_HeroData list = 1; } message HeroListRsp { repeated DBHero list = 1; }
/// : () /// : ()
/// : (使) /// : (使)
@ -24,15 +24,15 @@ message ItemData {
} }
// //
message Hero_StrengthenUplv_Req { message HeroStrengthenUplvReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
string expCardID = 2; // ID string expCardID = 2; // ID
int32 amount = 3; // } int32 amount = 3; // }
} }
// //
message Hero_StrengthenUplv_Resp { message HeroStrengthenUplvResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
message CostCardData { message CostCardData {
@ -40,69 +40,69 @@ message CostCardData {
int32 amount = 2; // int32 amount = 2; //
} }
// //
message Hero_StrengthenUpStar_Req { message HeroStrengthenUpStarReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
repeated CostCardData hero = 2; // ID repeated CostCardData hero = 2; // ID
repeated CostCardData heroRace = 3; // ID repeated CostCardData heroRace = 3; // ID
} }
// //
message Hero_StrengthenUpStar_Resp { message HeroStrengthenUpStarResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
// //
message Hero_StrengthenUpSkill_Req { message HeroStrengthenUpSkillReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
int32 skillIndex = 2; // int32 skillIndex = 2; //
CostCardData items = 3; // CostCardData items = 3; //
} }
// //
message Hero_StrengthenUpSkill_Resp { message HeroStrengthenUpSkillResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
// //
message Hero_Gongming_Req { message HeroGongmingReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
string costObjID = 2; // string costObjID = 2; //
} }
message Hero_Gongming_Resp { message HeroGongmingResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
int32 energy = 2; // int32 energy = 2; //
DB_HeroData upStarCard = 3; // DBHero upStarCard = 3; //
} }
// //
message Hero_GongmingReset_Req { message HeroGongmingResetReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
} }
message Hero_GongmingReset_Resp { message HeroGongmingResetResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
int32 energy = 2; // int32 energy = 2; //
} }
// 使 // 使
message Hero_GongmingUseEnergy_Req { message HeroGongmingUseEnergyReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
int32 useEnergy = 2; // 使 int32 useEnergy = 2; // 使
int32 useType = 3; // 使 int32 useType = 3; // 使
} }
message Hero_GongmingUseEnergy_Resp { message HeroGongmingUseEnergyResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
// //
message Hero_Juexing_Req { message HeroJuexingReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
ItemData costItmes = 2; // ItemData costItmes = 2; //
} }
// //
message Hero_Juexing_Resp { message HeroJuexingResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }

View File

@ -45,6 +45,8 @@ type SCompGateRoute struct {
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
mrlock sync.RWMutex //msghandles 对象的锁 mrlock sync.RWMutex //msghandles 对象的锁
msghandles map[string]*msghandle //处理函数的管理对象 msghandles map[string]*msghandle //处理函数的管理对象
sessionslock sync.RWMutex //msghandles 对象的锁
sessions map[string]comm.IUserSession //用户会话管理 避免频繁创建
} }
//设置服务组件名称 方便业务模块中获取此组件对象 //设置服务组件名称 方便业务模块中获取此组件对象
@ -57,6 +59,7 @@ func (this *SCompGateRoute) Init(service core.IService, comp core.IServiceComp,
err = this.ServiceCompBase.Init(service, comp, options) err = this.ServiceCompBase.Init(service, comp, options)
this.service = service.(base.IRPCXService) this.service = service.(base.IRPCXService)
this.msghandles = make(map[string]*msghandle) this.msghandles = make(map[string]*msghandle)
this.sessions = make(map[string]comm.IUserSession)
return err return err
} // } //
@ -106,8 +109,17 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
msghandle, ok := this.msghandles[method] msghandle, ok := this.msghandles[method]
this.mrlock.RUnlock() this.mrlock.RUnlock()
if ok { if ok {
//读取会话对象
this.sessionslock.RLock()
session, ok := this.sessions[args.UserSessionId]
this.sessionslock.RUnlock()
if !ok { //没有 创建会话
//封装用户会话 //封装用户会话
session := comm.NewUserSession(this.service, args.Ip, args.UserSessionId, args.GatewayServiceId, args.UserId) session = comm.NewUserSession(this.service, args.Ip, args.UserSessionId, args.GatewayServiceId, args.UserId)
this.sessionslock.Lock()
this.sessions[args.UserSessionId] = session
this.sessionslock.Unlock()
}
//序列化用户消息对象 //序列化用户消息对象
msg := reflect.New(msghandle.msgType.Elem()).Interface() msg := reflect.New(msghandle.msgType.Elem()).Interface()
if err := ptypes.UnmarshalAny(args.Message, msg.(proto.Message)); err != nil { if err := ptypes.UnmarshalAny(args.Message, msg.(proto.Message)); err != nil {
@ -154,7 +166,9 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
//RPC_NoticeUserClose 接收用户离线通知 //RPC_NoticeUserClose 接收用户离线通知
func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error { func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error {
event.TriggerEvent(comm.Event_UserOffline, args.UserId) event.TriggerEvent(comm.EventUserOffline, args.UserId)
this.sessionslock.Lock()
delete(this.sessions, args.UserSessionId)
this.sessionslock.Unlock()
return nil return nil
} }