36 lines
788 B
Go
36 lines
788 B
Go
package infopb
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.5iot.com/iotlcm-public/iotlcm-upstream-chan/internal/pb"
|
|
"git.5iot.com/iotlcm-public/iotlcm-upstream-chan/internal/pub/xjpubservice"
|
|
|
|
"github.com/gogf/gf/contrib/rpc/grpcx/v2"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
type Controller struct {
|
|
pb.UnimplementedInfoServer
|
|
}
|
|
|
|
func Register(s *grpcx.GrpcServer) {
|
|
pb.RegisterInfoServer(s.Server, &Controller{})
|
|
}
|
|
|
|
func (*Controller) Info(ctx context.Context, req *pb.InfoReq) (*pb.InfoRes, error) {
|
|
g.Log().Info(ctx, req)
|
|
info := xjpubservice.InfoRpc().GetInfo()
|
|
return &pb.InfoRes{
|
|
Head: &pb.HeadRes{
|
|
Code: 0,
|
|
Message: "success",
|
|
},
|
|
Type: info.Type,
|
|
Name: info.Name,
|
|
Title: info.Title,
|
|
Description: info.Description,
|
|
Version: info.Version,
|
|
}, nil
|
|
}
|