33 lines
728 B
Go
33 lines
728 B
Go
package app
|
|
|
|
import (
|
|
"git.hlsq.asia/mmorpg/service-common/module"
|
|
"git.hlsq.asia/mmorpg/service-common/net/grpc/service"
|
|
"git.hlsq.asia/mmorpg/service-qgdzs/config"
|
|
"git.hlsq.asia/mmorpg/service-qgdzs/internal/grpc_server"
|
|
)
|
|
|
|
// ModuleGrpcServer Grpc服务模块
|
|
type ModuleGrpcServer struct {
|
|
server service.IService
|
|
}
|
|
|
|
func (m *ModuleGrpcServer) Init() error {
|
|
return nil
|
|
}
|
|
|
|
func (m *ModuleGrpcServer) Start() error {
|
|
m.server = grpc_server.NewServer(config.Get().Serve.Grpc.TTL)
|
|
m.server.Init(config.Get().Serve.Grpc.Address, config.Get().Serve.Grpc.Port)
|
|
return nil
|
|
}
|
|
|
|
func (m *ModuleGrpcServer) Stop() error {
|
|
m.server.Close()
|
|
return nil
|
|
}
|
|
|
|
func (m *ModuleGrpcServer) Bind(_ ...any) module.Module {
|
|
return m
|
|
}
|