subscribeListLogic.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. Price: req.Price,
  37. FileExists: req.FileExists,
  38. UserId: req.UserId,
  39. EntId: req.EntId,
  40. EntUserId: req.EntUserId,
  41. DeptId: req.DeptId,
  42. })
  43. if err != nil {
  44. return &types.CommonResp{
  45. Err_code: res.ErrCode,
  46. Err_msg: res.ErrMsg,
  47. Data: nil,
  48. }, nil
  49. }
  50. return &types.CommonResp{
  51. Err_code: res.ErrCode,
  52. Err_msg: res.ErrMsg,
  53. Data: res.Data,
  54. }, nil
  55. }