getUserLogic.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/type/bxsubscribe"
  4. "context"
  5. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/api/internal/svc"
  6. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetUserLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLogic {
  15. return &GetUserLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *GetUserLogic) GetUser(req *types.GetUserReq) (*types.CommonResp, error) {
  22. // todo: add your logic here and delete this line
  23. res, err := l.svcCtx.Suscribe.UserInfo(l.ctx, &bxsubscribe.GetUserInfoReq{
  24. UserId: req.UserId,
  25. EntId: req.EntId,
  26. EntUserId: req.EntUserId,
  27. PositionType: req.PositionType,
  28. BaseUserId: req.BaseUserId,
  29. ServiceType: req.ServiceType,
  30. })
  31. if err != nil {
  32. return &types.CommonResp{
  33. Err_code: res.ErrorCode,
  34. Err_msg: res.ErrorMsg,
  35. Data: nil,
  36. }, nil
  37. }
  38. return &types.CommonResp{
  39. Err_code: res.ErrorCode,
  40. Err_msg: res.ErrorMsg,
  41. Data: res.Data,
  42. }, nil
  43. }