searchListLogic.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package logic
  2. import (
  3. "context"
  4. "jyBXCore/rpc/type/bxcore"
  5. "net/http"
  6. "jyBXCore/api/internal/svc"
  7. "jyBXCore/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type SearchListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. r *http.Request
  15. }
  16. func NewSearchListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *SearchListLogic {
  17. return &SearchListLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. r: r,
  22. }
  23. }
  24. func (l *SearchListLogic) SearchList(req *types.SearchReq) (resp *types.CommonResp, err error) {
  25. res, err := l.svcCtx.BxCore.GetSearchList(l.ctx, &bxcore.SearchReq{
  26. PageNum: req.PageNum,
  27. PageSize: req.PageSize,
  28. PublishTime: req.PublishTime,
  29. Province: req.Province,
  30. City: req.City,
  31. Industry: req.Industry,
  32. BuyerClass: req.BuyerClass,
  33. KeyWords: req.KeyWords,
  34. Subtype: req.Subtype,
  35. SelectType: req.SelectType,
  36. Price: req.Price,
  37. FileExists: req.FileExists,
  38. BuyerTel: req.BuyerTel,
  39. WinnerTel: req.WinnerTel,
  40. ExclusionWords: req.ExclusionWords,
  41. AppId: req.AppId,
  42. UserId: l.r.Header.Get("userId"),
  43. EntId: l.r.Header.Get("entId"),
  44. })
  45. if err != nil {
  46. return &types.CommonResp{
  47. Err_code: res.ErrCode,
  48. Err_msg: res.ErrMsg,
  49. Data: nil,
  50. }, nil
  51. }
  52. return &types.CommonResp{
  53. Err_code: res.ErrCode,
  54. Err_msg: res.ErrMsg,
  55. Data: res.Data,
  56. }, nil
  57. }