getentuserinfologic.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/internal/svc"
  6. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetEntUserInfoLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewGetEntUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEntUserInfoLogic {
  15. return &GetEntUserInfoLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 根据企业员工id获取员工的信息
  22. func (l *GetEntUserInfoLogic) GetEntUserInfo(in *pb.EntUserReq) (*pb.EntUserResp, error) {
  23. /// todo: add your logic here and delete this line
  24. resp := &pb.EntUserResp{}
  25. ret, msg := Entservice.GetEntUserInfo(in)
  26. if msg != "" {
  27. l.Error(fmt.Sprintf("%+v", in), msg)
  28. resp.ErrorMsg = msg
  29. resp.ErrorCode = -1
  30. } else {
  31. resp.Data = &pb.EntUser{
  32. Name: ret.Name,
  33. Phone: ret.Phone,
  34. Mail: ret.Mail,
  35. DeptName: ret.Dept_name,
  36. }
  37. }
  38. return resp, nil
  39. }