12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package logic
- import (
- "app.yhyue.com/moapp/jybase/common"
- "context"
- "jyBXBase/rpc/type/bxbase"
- "net/http"
- "jyBXBase/api/internal/svc"
- "jyBXBase/api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type AddSearchScreenLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- r *http.Request
- }
- func NewAddSearchScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *AddSearchScreenLogic {
- return &AddSearchScreenLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- r: r,
- }
- }
- func (l *AddSearchScreenLogic) AddSearchScreen(req *types.AddSearchScreen) (resp *types.CommonRes, err error) {
- region := map[string]*bxbase.Area{}
- if req.RegionMap != nil {
- for k, v := range req.RegionMap {
- areaMap := map[string]*bxbase.District{}
- if v != nil {
- for k1, v1 := range v {
- areaMap[k1] = &bxbase.District{
- District: v1,
- }
- }
- }
- region[k] = &bxbase.Area{
- Area: areaMap,
- }
- }
- }
- res, err0 := l.svcCtx.Bxbase.AddSearch(l.ctx, &bxbase.AddSearchReq{
- UserId: req.UserId,
- Type: req.Type,
- Keywords: req.Keywords,
- PublishTime: req.Publishtime,
- City: req.City,
- Area: req.Area,
- Subtype: req.Subtype,
- MinPrice: req.Minprice,
- MaxPrice: req.Maxprice,
- Industry: req.Industry,
- SelectType: req.SelectType,
- BuyerClass: req.Buyerclass,
- HasBuyerTel: req.Hasbuyertel,
- HasWinnerTel: req.Haswinnertel,
- FileExists: req.FileExists,
- NotKey: req.Notkey,
- InKey: req.InKey,
- AppId: req.AppId,
- SearchGroup: int64(req.SearchGroup),
- SearchMode: int64(req.SearchMode),
- WordsMode: int64(req.WordsMode),
- AdditionalWords: req.AdditionalWords,
- RegionMap: region,
- })
- if err0 != nil {
- return &types.CommonRes{
- Err_code: -1,
- Err_msg: "错误",
- Data: nil,
- }, nil
- }
- return &types.CommonRes{
- Err_code: common.IntAll(res.ErrCode),
- Err_msg: res.ErrMsg,
- Data: nil,
- }, nil
- }
|