|
@@ -52,7 +52,7 @@ func (l *CheckSearchLogic) CheckSearch(in *bxbase.AddSearchReq) (res *bxbase.Che
|
|
|
query := map[string]interface{}{
|
|
|
"user_id": in.UserId,
|
|
|
}
|
|
|
- if IC.Mgo.Count("search_condition", query) > 0 {
|
|
|
+ if IC.Mgo.Count("search_condition", query) > 10 {
|
|
|
res.ErrCode = 1
|
|
|
res.ErrMsg = "对不起,最多可保存10个筛选条件。"
|
|
|
return
|
|
@@ -68,7 +68,7 @@ func (l *CheckSearchLogic) CheckSearch(in *bxbase.AddSearchReq) (res *bxbase.Che
|
|
|
inMap := common.StructToMapMore(in)
|
|
|
inKey := GetKeysByParam(inMap)
|
|
|
query["in_key"] = inKey
|
|
|
- res.ErrMsg = inKey
|
|
|
+ res.Data = inKey
|
|
|
if IC.Mgo.Count("search_condition", query) > 0 {
|
|
|
res.ErrCode = 1
|
|
|
res.ErrMsg = "该条件已保存,无需重复添加。"
|
|
@@ -88,7 +88,7 @@ func GetKeysByParam(param map[string]interface{}) string {
|
|
|
ps := ¶mSorter{[]string{}, []string{}}
|
|
|
for k, v := range param {
|
|
|
ps.Keys = append(ps.Keys, k)
|
|
|
- ps.Vals = append(ps.Vals, common.ObjToString(v))
|
|
|
+ ps.Values = append(ps.Values, common.ObjToString(v))
|
|
|
}
|
|
|
ps.Sort()
|
|
|
reqStr := ps.String()
|
|
@@ -113,14 +113,14 @@ func percentEncode(str string) string {
|
|
|
}
|
|
|
|
|
|
type paramSorter struct {
|
|
|
- Keys []string
|
|
|
- Vals []string
|
|
|
+ Keys []string
|
|
|
+ Values []string
|
|
|
}
|
|
|
|
|
|
func (ps *paramSorter) String() string {
|
|
|
str := ""
|
|
|
for n, k := range ps.Keys {
|
|
|
- str += k + "=" + ps.Vals[n]
|
|
|
+ str += k + "=" + ps.Values[n]
|
|
|
if n < len(ps.Keys)-1 {
|
|
|
str += "&"
|
|
|
}
|
|
@@ -132,7 +132,7 @@ func (ps *paramSorter) Sort() {
|
|
|
sort.Sort(ps)
|
|
|
}
|
|
|
func (ps *paramSorter) Len() int {
|
|
|
- return len(ps.Vals)
|
|
|
+ return len(ps.Values)
|
|
|
}
|
|
|
|
|
|
func (ps *paramSorter) Less(i, j int) bool {
|
|
@@ -140,6 +140,6 @@ func (ps *paramSorter) Less(i, j int) bool {
|
|
|
}
|
|
|
|
|
|
func (ps *paramSorter) Swap(i, j int) {
|
|
|
- ps.Vals[i], ps.Vals[j] = ps.Vals[j], ps.Vals[i]
|
|
|
+ ps.Values[i], ps.Values[j] = ps.Values[j], ps.Values[i]
|
|
|
ps.Keys[i], ps.Keys[j] = ps.Keys[j], ps.Keys[i]
|
|
|
}
|