|
@@ -145,7 +145,6 @@ func (d *DataExport) SieveData() {
|
|
|
subTypeArr = strings.Split(subType, ",")
|
|
|
log.Println("subTypeArr", subTypeArr)
|
|
|
}
|
|
|
- log.Println("keywordParam", keyword)
|
|
|
if keyword != "" {
|
|
|
err := json.Unmarshal([]byte(keyword), &keywordList)
|
|
|
if err != nil {
|
|
@@ -190,14 +189,52 @@ func (d *DataExport) SieveData() {
|
|
|
selectType = strings.Replace(strings.Join(detail, ","), "detail", "title,detail", -1)
|
|
|
}
|
|
|
}
|
|
|
- if len(keywordList) > util.IntAllDef(config.Sysconfig["keywordRestrict"], 100) {
|
|
|
- keywordList = keywordList[:util.IntAllDef(config.Sysconfig["keywordRestrict"], 100)]
|
|
|
+
|
|
|
+ exportLimit := util.StructToMapMore(config.ExportConfig["exportLimit"])
|
|
|
+ wordsLimit := util.IntAllDef(exportLimit["wordsLimit"], 100)
|
|
|
+ countLimit := util.IntAllDef(exportLimit["countLimit"], 300)
|
|
|
+ buyerLimit := util.IntAllDef(exportLimit["buyerLimit"], 100)
|
|
|
+ winnerLimit := util.IntAllDef(exportLimit["winnerLimit"], 100)
|
|
|
+
|
|
|
+ var count int
|
|
|
+ for k, kw := range keywordList {
|
|
|
+ if kw.Keyword != "" {
|
|
|
+ count++
|
|
|
+ }
|
|
|
+ count += len(kw.Appended)
|
|
|
+ count += len(kw.Exclude)
|
|
|
+ if len([]rune(kw.Keyword)) > wordsLimit {
|
|
|
+ keywordList[k].Keyword = util.SubString(kw.Keyword, 0, wordsLimit)
|
|
|
+ }
|
|
|
+
|
|
|
+ for k1, ad := range kw.Appended {
|
|
|
+ if len([]rune(ad)) > wordsLimit {
|
|
|
+ keywordList[k].Appended[k1] = util.SubString(ad, 0, wordsLimit)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for k1, el := range kw.Exclude {
|
|
|
+ if len([]rune(el)) > wordsLimit {
|
|
|
+ keywordList[k].Exclude[k1] = util.SubString(el, 0, wordsLimit)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if len(buyerArr) > util.IntAllDef(config.Sysconfig["buyerRestrict"], 100) {
|
|
|
- buyerArr = buyerArr[:util.IntAllDef(config.Sysconfig["buyerRestrict"], 100)]
|
|
|
+ if count > countLimit {
|
|
|
+ d.ServeJson(map[string]interface{}{
|
|
|
+ "error_code": -1,
|
|
|
+ "error_msg": fmt.Sprintf("关键词信息超过上限%d", countLimit),
|
|
|
+ })
|
|
|
}
|
|
|
- if len(winnerArr) > util.IntAllDef(config.Sysconfig["winnerRestrict"], 100) {
|
|
|
- winnerArr = winnerArr[:util.IntAllDef(config.Sysconfig["winnerRestrict"], 100)]
|
|
|
+ if len(buyerArr) > buyerLimit {
|
|
|
+ d.ServeJson(map[string]interface{}{
|
|
|
+ "error_code": -1,
|
|
|
+ "error_msg": fmt.Sprintf("采购单位超过上限%d", buyerLimit),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if len(winnerArr) > winnerLimit {
|
|
|
+ d.ServeJson(map[string]interface{}{
|
|
|
+ "error_code": -1,
|
|
|
+ "error_msg": fmt.Sprintf("中标单位超过上限%d", winnerLimit),
|
|
|
+ })
|
|
|
}
|
|
|
sieveCondition := map[string]interface{}{
|
|
|
"publishtime": publishtime,
|
|
@@ -244,12 +281,14 @@ func (d *DataExport) SieveData() {
|
|
|
var EntArr = []string{}
|
|
|
if dataType == "2" {
|
|
|
for _, v := range res_screen {
|
|
|
+ log.Println("res_screen====", v["buyer"], v["buyerclass"])
|
|
|
//高级字段查询且winner不为空
|
|
|
if v["s_winner"] != nil && v["s_winner"] != "" {
|
|
|
EntArr = append(EntArr, v["s_winner"].(string))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
list := dataexport.FormatExportData(public.Mgo_Ent, &res_screen, config.Sysconfig["webdomain"].(string), dataType, true)
|
|
|
/*if msgCount > 20000 {
|
|
|
msgCount = 20000
|
|
@@ -626,6 +665,7 @@ func (d *DataExport) FontSet(version string) {
|
|
|
|
|
|
func subUrl(list *[]map[string]interface{}, dataType string) *[]map[string]interface{} {
|
|
|
for _, v := range *list {
|
|
|
+ log.Println("res_screen1111111", v["title"], v["buyer"], v["buyerclass"])
|
|
|
//加密截取url
|
|
|
href := util.ObjToString(v["href"])
|
|
|
url := util.ObjToString(v["url"])
|