|
@@ -1,7 +1,6 @@
|
|
package logic
|
|
package logic
|
|
|
|
|
|
import (
|
|
import (
|
|
- "app.yhyue.com/moapp/jybase/common"
|
|
|
|
"context"
|
|
"context"
|
|
"jyBXBase/rpc/bxcollection/model"
|
|
"jyBXBase/rpc/bxcollection/model"
|
|
"strings"
|
|
"strings"
|
|
@@ -45,41 +44,31 @@ func (l *CheckSearchLogic) CheckSearch(in *bxcol.AddSearchReq) (res *bxcol.Commo
|
|
query := map[string]interface{}{
|
|
query := map[string]interface{}{
|
|
"user_id": in.UserId,
|
|
"user_id": in.UserId,
|
|
}
|
|
}
|
|
- allData, b := model.Mgo.Find("search_condition", query, "", "", false, -1, -1)
|
|
|
|
- if !b {
|
|
|
|
|
|
+ if model.Mgo.Count("search_condition", query) >= 10 {
|
|
res.ErrCode = 1
|
|
res.ErrCode = 1
|
|
- res.ErrMsg = "查询失败"
|
|
|
|
|
|
+ res.ErrMsg = "对不起,最多可保存10个筛选条件。"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if allData != nil {
|
|
|
|
- if len(*allData) >= 10 {
|
|
|
|
- res.ErrCode = 1
|
|
|
|
- res.ErrMsg = "对不起,最多可保存10个筛选条件。"
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- //判重
|
|
|
|
- for _, vlu := range *allData {
|
|
|
|
- if in.Keywords == common.InterfaceToStr(vlu["keywords"]) &&
|
|
|
|
- in.Type == common.InterfaceToStr(vlu["type"]) &&
|
|
|
|
- in.PublishTime == common.InterfaceToStr(vlu["publish_time"]) &&
|
|
|
|
- in.Area == common.InterfaceToStr(vlu["area"]) &&
|
|
|
|
- in.City == common.InterfaceToStr(vlu["city"]) &&
|
|
|
|
- in.Subtype == common.InterfaceToStr(vlu["subtype"]) &&
|
|
|
|
- in.MinPrice == common.InterfaceToStr(vlu["min_price"]) &&
|
|
|
|
- in.MaxPrice == common.InterfaceToStr(vlu["max_price"]) &&
|
|
|
|
- in.Industry == common.InterfaceToStr(vlu["industry"]) &&
|
|
|
|
- in.SelectType == common.InterfaceToStr(vlu["select_type"]) &&
|
|
|
|
- in.BuyerClass == common.InterfaceToStr(vlu["buyer_class"]) &&
|
|
|
|
- in.HasBuyerTel == common.InterfaceToStr(vlu["buyer_tel"]) &&
|
|
|
|
- in.HasWinnerTel == common.InterfaceToStr(vlu["winner_tel"]) &&
|
|
|
|
- in.FileExists == common.InterfaceToStr(vlu["file_exists"]) &&
|
|
|
|
- in.NotKey == common.InterfaceToStr(vlu["not_key"]) &&
|
|
|
|
- in.TabularFlag == common.InterfaceToStr(vlu["tabular_flag"]) {
|
|
|
|
- res.ErrCode = 1
|
|
|
|
- res.ErrMsg = "该条件已保存,无需重复添加。"
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ query["keywords"] = in.Keywords
|
|
|
|
+ query["type"] = in.Type
|
|
|
|
+ query["publish_time"] = in.PublishTime
|
|
|
|
+ query["area"] = in.Area
|
|
|
|
+ query["city"] = in.City
|
|
|
|
+ query["subtype"] = in.Subtype
|
|
|
|
+ query["min_price"] = in.MinPrice
|
|
|
|
+ query["max_price"] = in.MaxPrice
|
|
|
|
+ query["industry"] = in.Industry
|
|
|
|
+ query["select_type"] = in.SelectType
|
|
|
|
+ query["buyer_class"] = in.BuyerClass
|
|
|
|
+ query["buyer_tel"] = in.HasBuyerTel
|
|
|
|
+ query["winner_tel"] = in.HasWinnerTel
|
|
|
|
+ query["file_exists"] = in.FileExists
|
|
|
|
+ query["not_key"] = in.NotKey
|
|
|
|
+ query["tabular_flag"] = in.TabularFlag
|
|
|
|
+ if model.Mgo.Count("search_condition", query) > 0 {
|
|
|
|
+ res.ErrCode = 1
|
|
|
|
+ res.ErrMsg = "该条件已保存,无需重复添加。"
|
|
|
|
+ return
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|