From 48119603bf803aecf3030e4beea1d17cf3cfa007 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 20 Oct 2022 18:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A9=E6=88=98RPC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/module.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/friend/module.go b/modules/friend/module.go index 33df6d14c..a1a761cf2 100644 --- a/modules/friend/module.go +++ b/modules/friend/module.go @@ -1,6 +1,7 @@ package friend import ( + "context" "go_dreamfactory/comm" "go_dreamfactory/modules" "go_dreamfactory/pb" @@ -46,7 +47,7 @@ func (this *Friend) OnInstallComp() { func (this *Friend) Start() (err error) { err = this.ModuleBase.Start() - this.service.RegisterFunctionName(string(comm.Rpc_ModuleFriendUseAssitHero), this.UseAssistHero) + this.service.RegisterFunctionName(string(comm.Rpc_ModuleFriendUseAssitHero), this.RpcUseAssisHero) return } @@ -86,6 +87,15 @@ func (this *Friend) GetFriendList(uid string) (uids []string) { return } +func (this *Friend) RpcUseAssisHero(ctx context.Context, req *pb.RPCGeneralReqA2, reply *pb.DBHero) error { + hero, err := this.UseAssistHero(req.Param1, req.Param2) + if err != nil { + return err + } + reply = hero + return nil +} + // 使用好友助战英雄 func (this *Friend) UseAssistHero(uid, friendId string) (*pb.DBHero, error) { //指定好友