getentuserinfologic.go 1.0 KB

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