getUserLogic.go 1.1 KB

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