subscribeListLogic.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package logic
  2. import (
  3. "context"
  4. "jyBXSubscribe/api/internal/svc"
  5. "jyBXSubscribe/api/internal/types"
  6. "jyBXSubscribe/rpc/type/bxsubscribe"
  7. "net/http"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type SubscribeListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. r *http.Request
  15. }
  16. func NewSubscribeListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *SubscribeListLogic {
  17. return &SubscribeListLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. r: r,
  22. }
  23. }
  24. func (l *SubscribeListLogic) SubscribeList(req *types.SubscribeReq) (resp *types.CommonResp, err error) {
  25. res, err := l.svcCtx.Suscribe.GetSubList(l.ctx, &bxsubscribe.SubscribeInfosReq{
  26. PageNum: req.PageNum,
  27. PageSize: req.PageSize,
  28. SelectTime: req.SelectTime,
  29. Area: req.Area,
  30. City: req.City,
  31. Industry: req.Industry,
  32. BuyerClass: req.BuyerClass,
  33. KeyWords: req.KeyWords,
  34. Subtype: req.Subtype,
  35. UserType: req.UserType,
  36. UserId: l.r.Header.Get("userId"),
  37. EntId: l.r.Header.Get("entId"),
  38. })
  39. if err != nil {
  40. return &types.CommonResp{
  41. Err_code: res.ErrCode,
  42. Err_msg: res.ErrMsg,
  43. Data: nil,
  44. }, nil
  45. }
  46. return &types.CommonResp{
  47. Err_code: res.ErrCode,
  48. Err_msg: res.ErrMsg,
  49. Data: res.Data,
  50. }, nil
  51. }