searchListLogic.go 1.7 KB

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