package api import ( "context" "github.com/gogf/gf/contrib/rpc/grpcx/v2" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/os/glog" "jygit.jydev.jianyu360.cn/wangshan/user/api/user/v1" "jygit.jydev.jianyu360.cn/wangshan/user/internal/model/entity" "jygit.jydev.jianyu360.cn/wangshan/user/internal/service" ) type Controller struct { v1.UnimplementedUserServer } func Register(s *grpcx.GrpcServer) { v1.RegisterUserServer(s.Server, &Controller{}) } func (c *Controller) SayHello(ctx context.Context, req *v1.HelloReq) (res *v1.HelloRes, err error) { glog.Info(ctx, "----------------", gerror.NewCode(gcode.CodeNotImplemented), "----", req.UserName) res.Msg = service.User().GetMsg(ctx, &entity.MsgInfoInput{Name: req.GetUserName()}).Msg glog.Info(ctx, "--------msg--------", res.Msg) return }