searchListLogic.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package logic
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "jyBXCore/api/internal/svc"
  6. "jyBXCore/api/internal/types"
  7. "jyBXCore/api/internal/util"
  8. "jyBXCore/rpc/type/bxcore"
  9. "log"
  10. "net/http"
  11. "time"
  12. )
  13. type SearchListLogic struct {
  14. logx.Logger
  15. ctx context.Context
  16. svcCtx *svc.ServiceContext
  17. r *http.Request
  18. }
  19. func NewSearchListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *SearchListLogic {
  20. return &SearchListLogic{
  21. Logger: logx.WithContext(ctx),
  22. ctx: ctx,
  23. svcCtx: svcCtx,
  24. r: r,
  25. }
  26. }
  27. func (l *SearchListLogic) SearchList(req *types.SearchReq) (resp *types.CommonResp, err error) {
  28. t := time.Now()
  29. res, err := l.svcCtx.BxCore.GetSearchList(l.ctx, &bxcore.SearchReq{
  30. AppId: req.AppId,
  31. UserId: req.UserId,
  32. Phone: req.Phone,
  33. NewUserId: req.NewUserId,
  34. EntId: req.EntId,
  35. EntUserId: req.EntUserId,
  36. PageNum: req.PageNum,
  37. PageSize: req.PageSize,
  38. Province: req.Province,
  39. City: req.City,
  40. Subtype: req.Subtype,
  41. TopType: req.TopType,
  42. PublishTime: req.PublishTime,
  43. SelectType: req.SelectType,
  44. Price: req.Price,
  45. Industry: req.Industry,
  46. BuyerClass: req.BuyerClass,
  47. BuyerTel: req.BuyerTel,
  48. WinnerTel: req.WinnerTel,
  49. FileExists: req.FileExists,
  50. SearchGroup: req.SearchGroup,
  51. SearchMode: req.SearchMode,
  52. WordsMode: req.WordsMode,
  53. KeyWords: req.KeyWords,
  54. AdditionalWords: req.AdditionalWords,
  55. ExclusionWords: req.ExclusionWords,
  56. UserType: req.UserType,
  57. Platform: util.CheckPlatform(l.r),
  58. BidField: req.BidField,
  59. PositionType: req.PositionType,
  60. PositionId: req.PositionId,
  61. AccountId: req.AccountId,
  62. MgoUserId: req.MgoUserId,
  63. })
  64. log.Println("请求接口耗时:", time.Since(t).Seconds())
  65. if err != nil {
  66. return &types.CommonResp{
  67. Err_code: res.ErrCode,
  68. Err_msg: res.ErrMsg,
  69. Data: nil,
  70. }, nil
  71. }
  72. return &types.CommonResp{
  73. Err_code: res.ErrCode,
  74. Err_msg: res.ErrMsg,
  75. Data: res.Data,
  76. }, nil
  77. }