getuserinfologic.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
  6. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
  8. "bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type GetUserInfoLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
  17. return &GetUserInfoLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *GetUserInfoLogic) GetUserInfo(req *types.UserReq) (resp *types.Resp, err error) {
  24. // todo: add your logic here and delete this line
  25. resp = &types.Resp{}
  26. res, err := entity.UserCenterRpc.GetUserInfo(l.ctx, &pb.UserReq{
  27. AppId: req.AppId,
  28. UserId: req.UserId,
  29. BaseUserId: req.BaseUserId,
  30. Types: req.Types,
  31. EntId: req.EntId,
  32. EntUserId: req.EntUserId,
  33. })
  34. if res.ErrorMsg != "" {
  35. resp.Error_msg = res.ErrorMsg
  36. resp.Error_code = -1
  37. l.Error(fmt.Sprintf("%+v", req), res.ErrorMsg)
  38. }
  39. resp.Data = res.Data
  40. return
  41. }