package logic import ( "app.yhyue.com/moapp/jybase/common" "context" "github.com/zeromicro/go-zero/core/logx" IC "jyBXCore/api/init" "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 w http.ResponseWriter } func NewSearchListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request, w http.ResponseWriter) *SearchListLogic { return &SearchListLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, r: r, w: w, } } func (l *SearchListLogic) SearchList(req *types.SearchReq) (resp *types.CommonResp, err error) { t := time.Now() limitFlag, isNew := util.GetFlag(l.r, l.w, req.UserId) res, err := l.svcCtx.BxCore.GetSearchList(l.ctx, &bxcore.SearchReq{ AppId: req.AppId, UserId: req.UserId, Phone: req.Phone, NewUserId: req.NewUserId, EntId: req.EntId, EntUserId: req.EntUserId, PageNum: req.PageNum, PageSize: req.PageSize, Province: req.Province, City: req.City, Subtype: req.Subtype, TopType: req.TopType, PublishTime: req.PublishTime, SelectType: req.SelectType, Price: req.Price, Industry: req.Industry, BuyerClass: req.BuyerClass, BuyerTel: req.BuyerTel, WinnerTel: req.WinnerTel, FileExists: req.FileExists, SearchGroup: req.SearchGroup, SearchMode: req.SearchMode, WordsMode: req.WordsMode, KeyWords: req.KeyWords, AdditionalWords: req.AdditionalWords, ExclusionWords: req.ExclusionWords, UserType: req.UserType, Platform: util.CheckPlatform(l.r), BidField: req.BidField, <<<<<<< HEAD PositionType: req.PositionType, PositionId: req.PositionId, AccountId: req.AccountId, MgoUserId: req.MgoUserId, ======= LimitFlag: limitFlag, IsNew: isNew, >>>>>>> master }) log.Println("请求接口耗时:", time.Since(t).Seconds()) if err != nil { return &types.CommonResp{ Err_code: res.ErrCode, Err_msg: res.ErrMsg, Data: nil, }, err } if req.UserId == "" { var data []map[string]interface{} detailMosaicTxt := IC.C.DetailMosaicTxt sm := common.StructToMapMore(IC.C.SearchMosaic) for _, v := range res.Data.List { d := common.StructToMapMore(v) for name, t1 := range sm { ts, _ := t1.(bool) if v1, ok := d[name]; ok && v1 != "" && v1 != 0 && ts { d[name] = detailMosaicTxt } } data = append(data, d) } dataAll := common.StructToMapMore(res.Data) dataAll["list"] = data return &types.CommonResp{ Err_code: res.ErrCode, Err_msg: res.ErrMsg, Data: dataAll, }, nil } return &types.CommonResp{ Err_code: res.ErrCode, Err_msg: res.ErrMsg, Data: res.Data, }, nil }