go_dreamfactory/modules/core.go
2022-07-04 18:21:09 +08:00

28 lines
815 B
Go

package modules
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"github.com/golang/protobuf/proto"
)
type (
//业务模块基类接口 定义所有业务模块都可以使用的接口
IModule interface {
core.IModule
//获取用户对象
GetUserSession(uid string) (session comm.IUserSession, ok bool)
//归还会话对象
PutUserSession(session comm.IUserSession)
//向指定用户发送消息
SendMsgToUser(mainType, subType string, msg proto.Message, user *pb.CacheUser) (err error)
//向多个用户发送消息
SendMsgToUsers(mainType, subType string, msg proto.Message, user ...*pb.CacheUser) (err error)
//校验消耗资源
CheckConsumeRes(uid string, res []*cfg.Game_atn) (code pb.ErrorCode)
}
)