|
@@ -33,8 +33,11 @@ const (
|
|
|
BidSearchFieldFile = `,"isValidFile"` //根据配置开关 选择是否显示 是否有附件提示,IC.C.FileSignBool
|
|
|
BidSearchDomainField = BidSearchFieldOfVip + `,"purchasing"` //领域数据字段基本字段
|
|
|
//DefaultFields = `"title"`
|
|
|
- IndexProjectSet = "projectset" // 项目信息es index
|
|
|
- TypeProjectSet = "projectset" // 项目信息es type //最新招标信息
|
|
|
+ IndexProjectSet = "projectset" // 项目信息es index
|
|
|
+ TypeProjectSet = "projectset" // 项目信息es type //最新招标信息
|
|
|
+ LoginTypePay = 1 // 付费用户
|
|
|
+ LoginTypeFree = 2 // 免费用户
|
|
|
+ LoginTypeNoLogin = 3 // 未登录用户
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -64,7 +67,7 @@ type SearchByES struct {
|
|
|
}
|
|
|
|
|
|
// GetAllByNgramWithCount 获取es查询结果及总数量
|
|
|
-func (e *SearchByES) GetAllByNgramWithCount(isLogin bool) (int64, *[]map[string]interface{}) {
|
|
|
+func (e *SearchByES) GetAllByNgramWithCount(loginType int) (int64, *[]map[string]interface{}) {
|
|
|
if e.Query != "" {
|
|
|
queryStr := e.Query
|
|
|
if e.HighLight {
|
|
@@ -84,9 +87,14 @@ func (e *SearchByES) GetAllByNgramWithCount(isLogin bool) (int64, *[]map[string]
|
|
|
queryStr = queryStr[:len(queryStr)-1] + `,"from":` + strconv.Itoa(e.Start) + `,"size":` + strconv.Itoa(e.Limit) + "}"
|
|
|
}
|
|
|
log.Println("queryStr:", queryStr)
|
|
|
- if isLogin {
|
|
|
+ switch loginType {
|
|
|
+ case LoginTypePay:
|
|
|
return elastic.GetWithCount(e.Index, e.IType, e.Query, queryStr)
|
|
|
- } else {
|
|
|
+ case LoginTypeFree:
|
|
|
+ // 免费用户 todo
|
|
|
+ return IC.FreeEs.GetWithCount(e.Index, e.IType, e.Query, queryStr)
|
|
|
+ default:
|
|
|
+ // 未登录
|
|
|
return IC.NoLoginEs.GetWithCount(e.Index, e.IType, e.Query, queryStr)
|
|
|
}
|
|
|
} else {
|