注册好友模块

This commit is contained in:
zhaocy 2022-06-08 14:49:09 +08:00
parent a65a61604f
commit d74fdd9f6f
3 changed files with 6 additions and 3 deletions

View File

@ -14,10 +14,11 @@ func NewModule() core.IModule {
type Friend struct { type Friend struct {
modules.ModuleBase modules.ModuleBase
friend_comp *FriendComp
} }
func (this *Friend) GetType() core.M_Modules { func (this *Friend) GetType() core.M_Modules {
return comm.SM_UserModule return comm.SM_FriendModule
} }
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) {
@ -28,5 +29,5 @@ func (this *Friend) Init(service core.IService, module core.IModule, options cor
func (this *Friend) OnInstallComp() { func (this *Friend) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.friend_comp = this.RegisterComp(new(FriendComp)).(*FriendComp)
} }

View File

@ -70,7 +70,7 @@ func (this *SComp_GateRouteComp) RegisterRoute(methodName string, comp reflect.V
} }
func (this *SComp_GateRouteComp) ReceiveMsg(ctx context.Context, args *pb.AgentMessage, reply *pb.RPCMessageReply) error { func (this *SComp_GateRouteComp) ReceiveMsg(ctx context.Context, args *pb.AgentMessage, reply *pb.RPCMessageReply) error {
log.Debugf("SComp_GateRouteComp ReceiveMsg agent:%s uId:%d MessageDistribution msg:%s", args.UserSessionId, args.UserId, args.Method) log.Debugf("SComp_GateRouteComp ReceiveMsg agent:%s uId:%s MessageDistribution msg:%s", args.UserSessionId, args.UserId, args.Method)
this.mrlock.RLock() this.mrlock.RLock()
msghandle, ok := this.msghandles[args.Method] msghandle, ok := this.msghandles[args.Method]
this.mrlock.RUnlock() this.mrlock.RUnlock()

View File

@ -3,6 +3,7 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"go_dreamfactory/modules/friend"
"go_dreamfactory/modules/mail" "go_dreamfactory/modules/mail"
"go_dreamfactory/modules/pack" "go_dreamfactory/modules/pack"
"go_dreamfactory/modules/user" "go_dreamfactory/modules/user"
@ -34,6 +35,7 @@ func main() {
user.NewModule(), user.NewModule(),
pack.NewModule(), pack.NewModule(),
mail.NewModule(), mail.NewModule(),
friend.NewModule(),
) )
} }