|
@@ -31,12 +31,12 @@ import (
|
|
|
|
|
|
type Pcsearch struct {
|
|
|
*xweb.Action
|
|
|
- pcSearchIndex xweb.Mapper `xweb:"/jylab/(supsearch|medical|bi)/index.html"` //搜索首页
|
|
|
- getNewBids xweb.Mapper `xweb:"/jylab/supsearch/getNewBids"` //最新招标信息
|
|
|
- getstatus xweb.Mapper `xweb:"/jylab/supsearch/getstatus"` //实验室开启状态
|
|
|
- proposedProject xweb.Mapper `xweb:"/jylab/supsearch/proposedProject.html"` //拟建项目
|
|
|
- qr xweb.Mapper `xweb:"/jylab/supsearch/qr/(.*)"` //生成进入实验室的二维码
|
|
|
- changePro xweb.Mapper `xweb:"/jylab/changePro"` //修改提示信息状态
|
|
|
+ pcSearchIndex xweb.Mapper `xweb:"/jylab/(supsearch|medical|bi)/index.html"` //搜索首页
|
|
|
+ getNewBids xweb.Mapper `xweb:"/jylab/supsearch/getNewBids"` //最新招标信息
|
|
|
+ getstatus xweb.Mapper `xweb:"/jylab/supsearch/getstatus"` //实验室开启状态
|
|
|
+ //proposedProject xweb.Mapper `xweb:"/jylab/supsearch/proposedProject.html"` //拟建项目-- 此功能已取消 影响es 检索功能
|
|
|
+ qr xweb.Mapper `xweb:"/jylab/supsearch/qr/(.*)"` //生成进入实验室的二维码
|
|
|
+ changePro xweb.Mapper `xweb:"/jylab/changePro"` //修改提示信息状态
|
|
|
}
|
|
|
|
|
|
var industrylist map[string][]string
|
|
@@ -134,6 +134,7 @@ func (p *Pcsearch) ChangePro() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 此功能已失效
|
|
|
func (p *Pcsearch) ProposedProject() error {
|
|
|
defer util.Catch()
|
|
|
var shareid = p.GetString("id")
|
|
@@ -565,74 +566,111 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
|
|
|
return p.Render("/pc/supsearch.html", &p.T)
|
|
|
}
|
|
|
|
|
|
-// Newbids 最新招标信息
|
|
|
+// Newbids 最新招标信息 --已失效
|
|
|
func Newbids(p, userId string) []map[string]interface{} {
|
|
|
- //fmt.Println("11111", redis.Get("newother", "index_list"))
|
|
|
- nologin := ""
|
|
|
- count := 500
|
|
|
- pagenum := 10
|
|
|
- limit := 50
|
|
|
- if userId == "" {
|
|
|
- nologin = "_nologin"
|
|
|
- count = bidsearch.SearchMaxPageCount_NOLOGIN
|
|
|
- pagenum = 20
|
|
|
- limit = 250
|
|
|
- }
|
|
|
- indexOk, _ := redis.Exists("newother", "index_list"+p+nologin)
|
|
|
+ return nil
|
|
|
+ ////fmt.Println("11111", redis.Get("newother", "index_list"))
|
|
|
+ //nologin := ""
|
|
|
+ //count := 500
|
|
|
+ //pagenum := 10
|
|
|
+ //limit := 50
|
|
|
+ //if userId == "" {
|
|
|
+ // nologin = "_nologin"
|
|
|
+ // count = bidsearch.SearchMaxPageCount_NOLOGIN
|
|
|
+ // pagenum = 20
|
|
|
+ // limit = 250
|
|
|
+ //}
|
|
|
+ //indexOk, _ := redis.Exists("newother", "index_list"+p+nologin)
|
|
|
+ //pages := []map[string]interface{}{}
|
|
|
+ //if indexOk {
|
|
|
+ // pages = util.ObjArrToMapArr(redis.Get("newother", "index_list"+p+nologin).([]interface{}))
|
|
|
+ //}
|
|
|
+ //if len(pages) == 0 {
|
|
|
+ // var list *[]map[string]interface{}
|
|
|
+ // subtype := ""
|
|
|
+ // bidField := ""
|
|
|
+ // // 判断是不是医疗行业
|
|
|
+ // if p == "medical" {
|
|
|
+ // bidField = "0101"
|
|
|
+ // } else {
|
|
|
+ // if len(p) > 0 {
|
|
|
+ // subtype = "拟建"
|
|
|
+ // }
|
|
|
+ // //未登录用户访问全部信息类型 需要过滤掉 拟建和采购意向
|
|
|
+ // if subtype == "" {
|
|
|
+ // subtype = "拟建,招标预告,招标公告,招标结果,招标信用信息"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //查询置顶信息
|
|
|
+ // var ss []map[string]interface{}
|
|
|
+ // ls := top500(subtype, bidField, userId)
|
|
|
+ // if ls != nil && len(*ls) > 0 {
|
|
|
+ // ss = append(ss, *ls...)
|
|
|
+ // }
|
|
|
+ // //pages = append(pages, ls)
|
|
|
+ // if ls == nil || len(*ls) < count {
|
|
|
+ // intns := make([]int, 0)
|
|
|
+ // for i := 0; i < pagenum; i++ {
|
|
|
+ // if len(intns) == 0 {
|
|
|
+ // intns = append(intns, rand.Intn(1000))
|
|
|
+ // } else {
|
|
|
+ // for {
|
|
|
+ // v := rand.Intn(intns[(i-1)] + 1000)
|
|
|
+ // if v-intns[(i-1)] > limit {
|
|
|
+ // intns = append(intns, v)
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // for i := 0; i < pagenum; i++ {
|
|
|
+ // _, list = getLastNewsData("", "", "", "", subtype, "", "", "", "", "", "", "", "Y", intns[i], true, false, "", bidField, limit)
|
|
|
+ // if list != nil && len(*list) > 0 {
|
|
|
+ // ss = append(ss, *list...)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // data := duplicateRemoval(ss)
|
|
|
+ // if len(data) > 0 {
|
|
|
+ // pages = data
|
|
|
+ // redis.Put("newother", "index_list"+p+nologin, pages, 60*60*24)
|
|
|
+ // pages = util.ObjArrToMapArr(redis.Get("newother", "index_list"+p+nologin).([]interface{}))
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //return pages
|
|
|
+}
|
|
|
+
|
|
|
+// Newbids 最新招标信息
|
|
|
+func NewBidddingsForSEO(p string, pageNum, limit int) []map[string]interface{} {
|
|
|
+ indexOk, _ := redis.Exists("newother", "index_list_"+p)
|
|
|
pages := []map[string]interface{}{}
|
|
|
if indexOk {
|
|
|
- pages = util.ObjArrToMapArr(redis.Get("newother", "index_list"+p+nologin).([]interface{}))
|
|
|
- }
|
|
|
- if len(pages) == 0 {
|
|
|
- var list *[]map[string]interface{}
|
|
|
- subtype := ""
|
|
|
- bidField := ""
|
|
|
- // 判断是不是医疗行业
|
|
|
- if p == "medical" {
|
|
|
- bidField = "0101"
|
|
|
- } else {
|
|
|
- if len(p) > 0 {
|
|
|
- subtype = "拟建"
|
|
|
- }
|
|
|
- //未登录用户访问全部信息类型 需要过滤掉 拟建和采购意向
|
|
|
- if subtype == "" {
|
|
|
- subtype = "拟建,招标预告,招标公告,招标结果,招标信用信息"
|
|
|
- }
|
|
|
- }
|
|
|
- //查询置顶信息
|
|
|
+ pages = util.ObjArrToMapArr(redis.Get("newother", "index_list_"+p).([]interface{}))
|
|
|
+ } else {
|
|
|
var ss []map[string]interface{}
|
|
|
- ls := top500(subtype, bidField, userId)
|
|
|
- if ls != nil && len(*ls) > 0 {
|
|
|
- ss = append(ss, *ls...)
|
|
|
- }
|
|
|
- //pages = append(pages, ls)
|
|
|
- if ls == nil || len(*ls) < count {
|
|
|
- intns := make([]int, 0)
|
|
|
- for i := 0; i < pagenum; i++ {
|
|
|
- if len(intns) == 0 {
|
|
|
- intns = append(intns, rand.Intn(1000))
|
|
|
- } else {
|
|
|
- for {
|
|
|
- v := rand.Intn(intns[(i-1)] + 1000)
|
|
|
- if v-intns[(i-1)] > limit {
|
|
|
- intns = append(intns, v)
|
|
|
- break
|
|
|
- }
|
|
|
+ intns := make([]int, 0)
|
|
|
+ for i := 0; i < pageNum; i++ {
|
|
|
+ if len(intns) == 0 {
|
|
|
+ intns = append(intns, rand.Intn(30))
|
|
|
+ } else {
|
|
|
+ for {
|
|
|
+ v := rand.Intn(intns[(i-1)] + 50)
|
|
|
+ if v-intns[(i-1)] > limit {
|
|
|
+ intns = append(intns, v)
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- for i := 0; i < pagenum; i++ {
|
|
|
- _, list = getLastNewsData("", "", "", "", subtype, "", "", "", "", "", "", "", "Y", intns[i], true, false, "", bidField, limit)
|
|
|
- if list != nil && len(*list) > 0 {
|
|
|
- ss = append(ss, *list...)
|
|
|
- }
|
|
|
+ }
|
|
|
+ for i := 0; i < pageNum; i++ {
|
|
|
+ list := elastic.GetPage(INDEX, TYPE, "", `{"publishtime":-1}`, bidField, intns[i], limit)
|
|
|
+ if list != nil && len(*list) > 0 {
|
|
|
+ ss = append(ss, *list...)
|
|
|
}
|
|
|
}
|
|
|
- data := duplicateRemoval(ss)
|
|
|
- if len(data) > 0 {
|
|
|
- pages = data
|
|
|
- redis.Put("newother", "index_list"+p+nologin, pages, 60*60*24)
|
|
|
- pages = util.ObjArrToMapArr(redis.Get("newother", "index_list"+p+nologin).([]interface{}))
|
|
|
+ if len(ss) > 0 {
|
|
|
+ pages = ss
|
|
|
+ redis.Put("newother", "index_list_"+p, ss, 60*60*24)
|
|
|
}
|
|
|
}
|
|
|
return pages
|