123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package logic
- import (
- "context"
- "github.com/zeromicro/go-zero/core/logx"
- "jyBXCore/api/internal/svc"
- "jyBXCore/api/internal/types"
- "jyBXCore/api/internal/util"
- "jyBXCore/rpc/type/bxcore"
- "log"
- "net/http"
- "time"
- )
- type SearchListLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- r *http.Request
- }
- func NewSearchListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *SearchListLogic {
- return &SearchListLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- r: r,
- }
- }
- func (l *SearchListLogic) SearchList(req *types.SearchReq) (resp *types.CommonResp, err error) {
- t := time.Now()
- res, err := l.svcCtx.BxCore.GetSearchList(l.ctx, &bxcore.SearchReq{
- PageNum: req.PageNum,
- PageSize: req.PageSize,
- PublishTime: req.PublishTime,
- Province: req.Province,
- City: req.City,
- Industry: req.Industry,
- BuyerClass: req.BuyerClass,
- KeyWords: req.KeyWords,
- Subtype: req.Subtype,
- SelectType: req.SelectType,
- Price: req.Price,
- FileExists: req.FileExists,
- BuyerTel: req.BuyerTel,
- WinnerTel: req.WinnerTel,
- ExclusionWords: req.ExclusionWords,
- AppId: req.AppId,
- UserType: req.UserType,
- SecondSearch: req.SecondSearch,
- UserId: l.r.Header.Get("userId"),
- EntId: l.r.Header.Get("entId"),
- Platform: util.CheckPlatform(l.r),
- })
- log.Println("请求接口耗时:", time.Since(t).Seconds())
- if err != nil {
- return &types.CommonResp{
- Err_code: res.ErrCode,
- Err_msg: res.ErrMsg,
- Data: nil,
- }, nil
- }
- return &types.CommonResp{
- Err_code: res.ErrCode,
- Err_msg: res.ErrMsg,
- Data: res.Data,
- }, nil
- }
|