完善服务器

This commit is contained in:
2025-07-01 00:08:27 +08:00
parent b45eb83fe4
commit 7c2c32a31a
37 changed files with 1307 additions and 160 deletions

View File

@@ -0,0 +1,12 @@
package server
import (
"common/log"
"common/proto/gen/common"
"context"
)
func (s *Server) SendMessage(ctx context.Context, req *common.Empty) (*common.Empty, error) {
log.Infof("未实现函数")
return nil, nil
}

View File

@@ -0,0 +1,32 @@
package server
import (
"common/discover/common"
"common/net/grpc/service"
"common/proto/gen/grpc_pb"
"google.golang.org/grpc"
)
type Server struct {
grpc_pb.UnimplementedGatewayServer
service.Base
}
func NewServer(ttl int64) *Server {
s := &Server{
Base: service.Base{
Target: common.KeyDiscoverGateway,
EtcdTTL: ttl,
},
}
s.Base.OnInit = s.OnInit
s.Base.OnClose = s.OnClose
return s
}
func (s *Server) OnInit(serve *grpc.Server) {
grpc_pb.RegisterGatewayServer(serve, s)
}
func (s *Server) OnClose() {
}