mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-13 21:43:44 +08:00
发布v2.8.4版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
@@ -7,42 +7,35 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/servmsg"
|
||||
"hotgo/internal/library/network/tcp"
|
||||
)
|
||||
|
||||
type (
|
||||
IAuthClient interface {
|
||||
Instance() *tcp.Client
|
||||
Start(ctx context.Context)
|
||||
Stop(ctx context.Context)
|
||||
IsLogin() bool
|
||||
OnResponseAuthSummary(ctx context.Context, args ...interface{})
|
||||
OnResponseAuthSummary(ctx context.Context, req *servmsg.AuthSummaryRes)
|
||||
OnResponseExampleHello(ctx context.Context, req *servmsg.ExampleHelloRes)
|
||||
}
|
||||
ICronClient interface {
|
||||
Instance() *tcp.Client
|
||||
Start(ctx context.Context)
|
||||
Stop(ctx context.Context)
|
||||
IsLogin() bool
|
||||
OnCronDelete(ctx context.Context, args ...interface{})
|
||||
OnCronEdit(ctx context.Context, args ...interface{})
|
||||
OnCronStatus(ctx context.Context, args ...interface{})
|
||||
OnCronOnlineExec(ctx context.Context, args ...interface{})
|
||||
OnCronDelete(ctx context.Context, req *servmsg.CronDeleteReq) (res *servmsg.CronDeleteRes, err error)
|
||||
OnCronEdit(ctx context.Context, req *servmsg.CronEditReq) (res *servmsg.CronEditRes, err error)
|
||||
OnCronStatus(ctx context.Context, req *servmsg.CronStatusReq) (res *servmsg.CronStatusRes, err error)
|
||||
OnCronOnlineExec(ctx context.Context, req *servmsg.CronOnlineExecReq) (res *servmsg.CronOnlineExecRes, err error)
|
||||
DefaultInterceptor(ctx context.Context, msg *tcp.Message) (err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localCronClient ICronClient
|
||||
localAuthClient IAuthClient
|
||||
localCronClient ICronClient
|
||||
)
|
||||
|
||||
func AuthClient() IAuthClient {
|
||||
if localAuthClient == nil {
|
||||
panic("implement not found for interface IAuthClient, forgot register?")
|
||||
}
|
||||
return localAuthClient
|
||||
}
|
||||
|
||||
func RegisterAuthClient(i IAuthClient) {
|
||||
localAuthClient = i
|
||||
}
|
||||
|
||||
func CronClient() ICronClient {
|
||||
if localCronClient == nil {
|
||||
panic("implement not found for interface ICronClient, forgot register?")
|
||||
@@ -53,3 +46,14 @@ func CronClient() ICronClient {
|
||||
func RegisterCronClient(i ICronClient) {
|
||||
localCronClient = i
|
||||
}
|
||||
|
||||
func AuthClient() IAuthClient {
|
||||
if localAuthClient == nil {
|
||||
panic("implement not found for interface IAuthClient, forgot register?")
|
||||
}
|
||||
return localAuthClient
|
||||
}
|
||||
|
||||
func RegisterAuthClient(i IAuthClient) {
|
||||
localAuthClient = i
|
||||
}
|
||||
|
Reference in New Issue
Block a user