|
@@ -3,7 +3,9 @@ package entity
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
"jy/src/jfw/modules/publicapply/src/config"
|
|
|
+ "math"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -36,7 +38,7 @@ type EnterpriseSearch struct {
|
|
|
}
|
|
|
|
|
|
const (
|
|
|
- searchMaxLimit = 100 //最大查询数量限制
|
|
|
+ searchMaxLimit = 150 //最大查询数量限制
|
|
|
freeSearchNum = 4 //免费查询数量限制
|
|
|
entSearchCacheDB = "other"
|
|
|
entSearchCacheKey = "entSearchIndexCache_%v"
|
|
@@ -78,7 +80,8 @@ func (es *EnterpriseSearch) Check() (*EnterpriseSearch, error) {
|
|
|
if es.PageSize == 0 { //默认十条
|
|
|
es.PageSize = 10
|
|
|
}
|
|
|
- if (es.PageNum+1)*es.PageSize > searchMaxLimit {
|
|
|
+ maxPageSize := math.Ceil(gconv.Float64(config.Config.EntSearchLimit) / gconv.Float64(es.PageSize))
|
|
|
+ if es.PageNum > gconv.Int(maxPageSize) {
|
|
|
return nil, fmt.Errorf("超出查询数量限制")
|
|
|
}
|
|
|
//注册资本[min-max]
|
|
@@ -466,7 +469,7 @@ func GetEntIndexShow(isFree bool) (list *[]map[string]interface{}) {
|
|
|
}
|
|
|
}
|
|
|
var thisRow entIds
|
|
|
- entSql := fmt.Sprintf(`{"query": {"bool": {"must": []}},"aggs": {"entids": {"terms": {"field": "entidlist","size": 100,"exclude": ["-",""]}}},"size": 0}`)
|
|
|
+ entSql := fmt.Sprintf(`{"query": {"bool": {"must": []}},"aggs": {"entids": {"terms": {"field": "entidlist","size": %d,"exclude": ["-",""]}}},"size": 0}`, config.Config.EntSearchLimit)
|
|
|
entAggs, _, _ := elastic.GetAggs("projectset", "projectset", entSql)
|
|
|
if entAggs != nil {
|
|
|
for name, object := range entAggs {
|
|
@@ -486,7 +489,7 @@ func GetEntIndexShow(isFree bool) (list *[]map[string]interface{}) {
|
|
|
ids = append(ids, v.Key)
|
|
|
}
|
|
|
sql := fmt.Sprintf(entQuery, fmt.Sprintf(`{"terms":{"_id":["%s"]}}`, strings.Join(ids, "\",\"")), "")
|
|
|
- sql = sql[:len(sql)-1] + fmt.Sprintf(`,"from":%d,"size":%d}`, 0, 100)
|
|
|
+ sql = sql[:len(sql)-1] + fmt.Sprintf(`,"from":%d,"size":%d}`, 0, config.Config.EntSearchLimit)
|
|
|
listTmp := elastic.Get(index, itype, sql)
|
|
|
if listTmp != nil && len(*listTmp) > 0 {
|
|
|
list = formatData(listTmp, isFree)
|