service

package
v0.0.0-...-06ebf3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeTimeOut   = 3 * time.Minute
	GenSignUpCode = "GenSignUpCode"
	Login         = ""
)
View Source
const (
	OkCode  = 200
	ErrCode = -1
)
View Source
const (
	RoomIdKey   = "_RoomId"
	UserInfoKey = "_UserInfo"
)

Variables

This section is empty.

Functions

func EmailSend

func EmailSend(to []string, title string, context string, from string) error

func GenEmailCode

func GenEmailCode(digit int) string

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func (*Account) Alias

func (a *Account) Alias() string

func (*Account) ComparePwd

func (a *Account) ComparePwd(reqPwd string, hashPwd string) bool

func (*Account) EmailCode

func (a *Account) EmailCode(ctx *protocol.Context, req *EmailCodeReq, rsp *ApiRsp, tag struct{}) *gnetrpc.CallMode

func (*Account) HashPwd

func (a *Account) HashPwd(pwd string) string

func (*Account) Init

func (a *Account) Init(v ...interface{}) gnetrpc.IService

func (*Account) Login

func (a *Account) Login(ctx *protocol.Context, req *LoginReq, rsp *ApiRsp, tag struct{}) *gnetrpc.CallMode

{"Email":"1273014435@qq.com","Pwd":"123"}

func (*Account) Logout

func (a *Account) Logout(ctx *protocol.Context, req *struct{}, rsp *ApiRsp, tag struct{}) *gnetrpc.CallMode

func (*Account) Register

func (a *Account) Register(ctx *protocol.Context, req *RegisterReq, rsp *ApiRsp, tag struct{}) *gnetrpc.CallMode

type ApiRsp

type ApiRsp struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

func (*ApiRsp) Err

func (a *ApiRsp) Err(msg string)

func (*ApiRsp) Ok

func (a *ApiRsp) Ok(data interface{}) *ApiRsp

type ClosePlugin

type ClosePlugin struct {
}

func (*ClosePlugin) Init

func (c *ClosePlugin) Init(args ...interface{}) gnetrpc.Plugin

func (*ClosePlugin) OnDo

func (c *ClosePlugin) OnDo(args ...interface{}) error

func (*ClosePlugin) Type

func (c *ClosePlugin) Type() gnetrpc.PluginType

type CreateRoomReq

type CreateRoomReq struct {
	Pwd       string `json:"pwd"`
	MaxNum    int    `json:"max_num"` //
	JoinState bool   `json:"join_state"`
}

type CreateRoomRsp

type CreateRoomRsp struct {
	Id string `json:"id"`
}

type EmailCodeReq

type EmailCodeReq struct {
	Email string `json:"email"`
}

type GameMgr

type GameMgr struct {
}

func (*GameMgr) Alias

func (r *GameMgr) Alias() string

func (*GameMgr) ConnOnClose

func (r *GameMgr) ConnOnClose(ctx *protocol.Context)

func (*GameMgr) GlobalChat

func (r *GameMgr) GlobalChat(ctx *protocol.Context, req *string, rsp *string) *gnetrpc.CallMode

func (*GameMgr) Init

func (r *GameMgr) Init(v ...interface{}) gnetrpc.IService

type LoginReq

type LoginReq struct {
	Email string `json:"Email"`
	Pwd   string `json:"Pwd"`
}

type LoginRsp

type LoginRsp struct {
	UserId string `json:"UserId"`
	Nick   string `json:"Nick"`
}

type RegisterReq

type RegisterReq struct {
	Email string `json:"Email"`
	Pwd   string `json:"Pwd"`
	Nick  string `json:"Nick"`
	Code  string `json:"Code"`
}

type Room

type Room struct {
	// contains filtered or unexported fields
}

type RoomInfosRsp

type RoomInfosRsp struct {
	Id     string `json:"id"`
	MaxNum int    `json:"max_num"` //人数
	Pwd    string `json:"pwd"`     //密码
	Cnt    int    `json:"cnt"`
}

type RoomMgr

type RoomMgr struct {
	// contains filtered or unexported fields
}

func (*RoomMgr) AddRoom

func (r *RoomMgr) AddRoom(room *Room)

func (*RoomMgr) Alias

func (r *RoomMgr) Alias() string

func (*RoomMgr) Chat

func (r *RoomMgr) Chat(ctx *protocol.Context, txt *string, rsp *ApiRsp) *gnetrpc.CallMode

func (*RoomMgr) ConnOnClose

func (r *RoomMgr) ConnOnClose(conn gnet.Conn) error

func (*RoomMgr) Create

func (r *RoomMgr) Create(ctx *protocol.Context, req *CreateRoomReq, rsp *ApiRsp) *gnetrpc.CallMode

{"pwd":"123","max_num":10,"join_state":true}

func (*RoomMgr) DelRoom

func (r *RoomMgr) DelRoom(id string)

func (*RoomMgr) GetRoom

func (r *RoomMgr) GetRoom(id string) (*Room, bool)

func (*RoomMgr) Init

func (r *RoomMgr) Init(v ...interface{}) gnetrpc.IService

func (*RoomMgr) Join

func (r *RoomMgr) Join(ctx *protocol.Context, id *string, rsp *ApiRsp) *gnetrpc.CallMode

func (*RoomMgr) Leave

func (r *RoomMgr) Leave(ctx *protocol.Context, req *struct{}, rsp *ApiRsp) *gnetrpc.CallMode

func (*RoomMgr) RoomsInfo

func (r *RoomMgr) RoomsInfo(ctx *protocol.Context, req *struct{}, rsp *ApiRsp) *gnetrpc.CallMode

func (*RoomMgr) StartGame

func (r *RoomMgr) StartGame(ctx *protocol.Context, id *string, rsp *ApiRsp) *gnetrpc.CallMode

type ShutdownPlugin

type ShutdownPlugin struct {
}

func (*ShutdownPlugin) Init

func (s *ShutdownPlugin) Init(args ...interface{}) gnetrpc.Plugin

func (*ShutdownPlugin) OnDo

func (s *ShutdownPlugin) OnDo(args ...interface{}) error

func (*ShutdownPlugin) Type

func (s *ShutdownPlugin) Type() gnetrpc.PluginType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL