rcvr.go 678 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package impl
  4. import (
  5. "context"
  6. "property-management/impl/v1/user"
  7. "property-management/pb"
  8. pb_v1 "property-management/pb/v1"
  9. "git.getensh.com/common/gopkgs/tasker/rpctasker"
  10. "google.golang.org/grpc"
  11. )
  12. // 具体实现
  13. type Rcvr struct {
  14. }
  15. func Register(s *grpc.Server) {
  16. pb.RegisterManagementServer(s, &Rcvr{})
  17. }
  18. // 系统用户登录
  19. func (c *Rcvr) Login(ctx context.Context, req *pb_v1.LoginRequest) (reply *pb_v1.LoginReply, err error) {
  20. t1 := func() error {
  21. reply, err = user.Login(ctx, req)
  22. return err
  23. }
  24. return reply, rpctasker.Exec(ctx, t1)
  25. }