|
@@ -6,6 +6,7 @@ import (
|
|
"jfw/filter"
|
|
"jfw/filter"
|
|
"jfw/jylabutil"
|
|
"jfw/jylabutil"
|
|
"jfw/public"
|
|
"jfw/public"
|
|
|
|
+ "log"
|
|
"math/rand"
|
|
"math/rand"
|
|
"net/http"
|
|
"net/http"
|
|
"qfw/util"
|
|
"qfw/util"
|
|
@@ -37,12 +38,52 @@ type Pcsearch struct {
|
|
var industrylist map[string][]string
|
|
var industrylist map[string][]string
|
|
var sortArray []string
|
|
var sortArray []string
|
|
var industryname string
|
|
var industryname string
|
|
|
|
+var PCS_index map[string]interface{}
|
|
|
|
+var PCS_time int
|
|
|
|
|
|
//
|
|
//
|
|
func init() {
|
|
func init() {
|
|
xweb.AddAction(&Pcsearch{})
|
|
xweb.AddAction(&Pcsearch{})
|
|
industryname = util.ObjToString(config.Sysconfig["industry"])
|
|
industryname = util.ObjToString(config.Sysconfig["industry"])
|
|
industrylist, sortArray = getindustrys()
|
|
industrylist, sortArray = getindustrys()
|
|
|
|
+ //清除搜索列表内存缓存 间隔时间
|
|
|
|
+ PCS_time = util.IntAll(config.Sysconfig["PCS_time"])
|
|
|
|
+ go func() {
|
|
|
|
+ time.Sleep(time.Second * 5)
|
|
|
|
+ PCS_task()
|
|
|
|
+ }()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//定时清理搜索列表页 从redis获取存入内存中的数据
|
|
|
|
+func PCS_task() {
|
|
|
|
+ //根据配置延迟 PCS_time 小时执行
|
|
|
|
+ sub := time.Hour * time.Duration(PCS_time)
|
|
|
|
+ timer := time.NewTimer(sub)
|
|
|
|
+ log.Println(PCS_time, "小时后执行清除缓存操作")
|
|
|
|
+ defer timer.Stop()
|
|
|
|
+ for {
|
|
|
|
+ select {
|
|
|
|
+ case <-timer.C:
|
|
|
|
+ {
|
|
|
|
+ PCS_index = map[string]interface{}{}
|
|
|
|
+ timer.Reset(time.Hour * time.Duration(PCS_time))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//返回内存中列表也的数据,只获取首页,其他页面访问量暂时不多
|
|
|
|
+func PCS_list(page_type string) interface{} {
|
|
|
|
+ var _page_type = page_type
|
|
|
|
+ //如果page_type为空,则是获取非拟建数据。
|
|
|
|
+ if page_type == "" {
|
|
|
|
+ _page_type = "page_index"
|
|
|
|
+ }
|
|
|
|
+ if PCS_index[_page_type] == nil {
|
|
|
|
+ PCS_index[_page_type] = Newbids(page_type)[0]
|
|
|
|
+ }
|
|
|
|
+ return PCS_index[_page_type]
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|
|
@@ -89,7 +130,7 @@ func (p *Pcsearch) ProposedProject() error {
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
p.DisableHttpCache()
|
|
p.DisableHttpCache()
|
|
- p.T["list"] = Newbids("nijian")[0]
|
|
|
|
|
|
+ p.T["list"] = PCS_list("nijian") //Newbids("nijian")[0]
|
|
}
|
|
}
|
|
if status == 2 {
|
|
if status == 2 {
|
|
if list != nil {
|
|
if list != nil {
|
|
@@ -194,13 +235,9 @@ func (p *Pcsearch) GetNewBids() error {
|
|
//
|
|
//
|
|
func (p *Pcsearch) PcSearchIndex() error {
|
|
func (p *Pcsearch) PcSearchIndex() error {
|
|
defer util.Catch()
|
|
defer util.Catch()
|
|
- var shareid = p.GetString("id")
|
|
|
|
- if len(shareid) == 0 {
|
|
|
|
- shareid = "10"
|
|
|
|
- }
|
|
|
|
p.T["logid"] = config.Seoconfig["jysslby"].(string)
|
|
p.T["logid"] = config.Seoconfig["jysslby"].(string)
|
|
- fmt.Println("logid:", config.Seoconfig["jysslby"].(string))
|
|
|
|
keywords := p.GetString("keywords")
|
|
keywords := p.GetString("keywords")
|
|
|
|
+ industry := strings.TrimSpace(p.GetString("industry")) //选中的行业
|
|
area := p.GetString("area") //地区
|
|
area := p.GetString("area") //地区
|
|
publishtime := p.GetString("publishtime") //发布时间
|
|
publishtime := p.GetString("publishtime") //发布时间
|
|
timeslot := p.GetString("timeslot") //显示选择时间
|
|
timeslot := p.GetString("timeslot") //显示选择时间
|
|
@@ -208,17 +245,7 @@ func (p *Pcsearch) PcSearchIndex() error {
|
|
subtype := p.GetString("subtype") //信息类型
|
|
subtype := p.GetString("subtype") //信息类型
|
|
minprice := p.GetString("minprice") //最低价格
|
|
minprice := p.GetString("minprice") //最低价格
|
|
maxprice := p.GetString("maxprice") //最高价格
|
|
maxprice := p.GetString("maxprice") //最高价格
|
|
- industry := strings.TrimSpace(p.GetString("industry")) //选中的行业
|
|
|
|
- p.SetSession("industry", industry)
|
|
|
|
- selectType := p.GetString("selectType") //标题或全文
|
|
|
|
- selectTypesess := p.GetSession("selectType")
|
|
|
|
-
|
|
|
|
- if selectTypesess != nil && selectTypesess != "" {
|
|
|
|
- selectType = selectTypesess.(string)
|
|
|
|
- }
|
|
|
|
- //if selectType == "" {
|
|
|
|
- selectType = "title"
|
|
|
|
- //}
|
|
|
|
|
|
+ selectType := "title"
|
|
|
|
|
|
//历史导出数据回显
|
|
//历史导出数据回显
|
|
if strings.Contains(p.Url(), "?goback") {
|
|
if strings.Contains(p.Url(), "?goback") {
|
|
@@ -232,8 +259,10 @@ func (p *Pcsearch) PcSearchIndex() error {
|
|
selectType = util.ObjToString(p.GetSession("Echo_selectType"))
|
|
selectType = util.ObjToString(p.GetSession("Echo_selectType"))
|
|
timeslot = util.ObjToString(p.GetSession("Echo_timeslot"))
|
|
timeslot = util.ObjToString(p.GetSession("Echo_timeslot"))
|
|
}
|
|
}
|
|
-
|
|
|
|
- b_word, _, s_word := jy.InterceptSearchKW(keywords, false, len(industry) == 0)
|
|
|
|
|
|
+ b_word, s_word := "", ""
|
|
|
|
+ if keywords != "" {
|
|
|
|
+ b_word, _, s_word = jy.InterceptSearchKW(keywords, false, len(industry) == 0)
|
|
|
|
+ }
|
|
var list *[]map[string]interface{}
|
|
var list *[]map[string]interface{}
|
|
var status = 1
|
|
var status = 1
|
|
var count, totalPage int64
|
|
var count, totalPage int64
|
|
@@ -281,7 +310,7 @@ func (p *Pcsearch) PcSearchIndex() error {
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
p.DisableHttpCache()
|
|
p.DisableHttpCache()
|
|
- p.T["list"] = Newbids("")[0]
|
|
|
|
|
|
+ p.T["list"] = PCS_list("") //Newbids("")[0]
|
|
}
|
|
}
|
|
if status == 2 {
|
|
if status == 2 {
|
|
if list != nil {
|
|
if list != nil {
|
|
@@ -315,45 +344,44 @@ func (p *Pcsearch) PcSearchIndex() error {
|
|
totalPage = 1
|
|
totalPage = 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ p.T["secondFlag"] = secondFlag
|
|
|
|
+ p.T["area"] = area
|
|
|
|
+ p.T["publishtime"] = publishtime
|
|
|
|
+ p.T["timeslot"] = timeslot
|
|
|
|
+ p.T["toptype"] = toptype
|
|
|
|
+ p.T["subtype"] = subtype
|
|
|
|
+ p.T["searchvalue"] = s_word
|
|
|
|
+ p.T["selectType"] = selectType
|
|
|
|
+ p.T["minprice"] = minprice
|
|
|
|
+ p.T["maxprice"] = maxprice
|
|
|
|
+ p.T["login"] = p.Session().Get("user")
|
|
|
|
+ p.T["totalPage"] = totalPage
|
|
|
|
+ p.T["count"] = count
|
|
|
|
+ p.SetSession("paramkey", b_word)
|
|
|
|
+ switch publishtime {
|
|
|
|
+ case "lately-7":
|
|
|
|
+ p.SetSession("parampublishtime", "最近7天")
|
|
|
|
+ case "lately-30":
|
|
|
|
+ p.SetSession("parampublishtime", "最近30天")
|
|
|
|
+ case "thisyear":
|
|
|
|
+ p.SetSession("parampublishtime", "去年")
|
|
|
|
+ default:
|
|
|
|
+ p.SetSession("parampublishtime", publishtime)
|
|
|
|
+ }
|
|
|
|
+ p.SetSession("paramarea", area)
|
|
|
|
+ if subtype != "" {
|
|
|
|
+ p.SetSession("paraminfotype", subtype)
|
|
|
|
+ } else {
|
|
|
|
+ p.SetSession("paraminfotype", toptype)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- p.T["secondFlag"] = secondFlag
|
|
|
|
- p.T["area"] = area
|
|
|
|
- p.T["publishtime"] = publishtime
|
|
|
|
- p.T["timeslot"] = timeslot
|
|
|
|
- p.T["toptype"] = toptype
|
|
|
|
- p.T["subtype"] = subtype
|
|
|
|
p.T["keywords"] = b_word
|
|
p.T["keywords"] = b_word
|
|
- p.T["searchvalue"] = s_word
|
|
|
|
- p.T["selectType"] = selectType
|
|
|
|
p.T["industry"] = industry
|
|
p.T["industry"] = industry
|
|
- p.T["minprice"] = minprice
|
|
|
|
- p.T["maxprice"] = maxprice
|
|
|
|
- p.T["login"] = p.Session().Get("user")
|
|
|
|
- p.T["totalPage"] = totalPage
|
|
|
|
- p.T["count"] = count
|
|
|
|
- p.SetSession("paramkey", b_word)
|
|
|
|
- if publishtime == "lately-7" {
|
|
|
|
- p.SetSession("parampublishtime", "最近7天")
|
|
|
|
- } else if publishtime == "lately-30" {
|
|
|
|
- p.SetSession("parampublishtime", "最近30天")
|
|
|
|
- } else if publishtime == "thisyear" {
|
|
|
|
- p.SetSession("parampublishtime", "去年")
|
|
|
|
- } else {
|
|
|
|
- p.SetSession("parampublishtime", publishtime)
|
|
|
|
- }
|
|
|
|
- p.SetSession("paramarea", area)
|
|
|
|
- if subtype != "" {
|
|
|
|
- p.SetSession("paraminfotype", subtype)
|
|
|
|
- } else {
|
|
|
|
- p.SetSession("paraminfotype", toptype)
|
|
|
|
- }
|
|
|
|
p.T["industrylist"] = industrylist
|
|
p.T["industrylist"] = industrylist
|
|
p.T["sortArray"] = sortArray
|
|
p.T["sortArray"] = sortArray
|
|
- p.T["shareid"] = se.EncodeString(shareid)
|
|
|
|
-
|
|
|
|
//
|
|
//
|
|
if userid := p.GetSession("userId"); userid != nil {
|
|
if userid := p.GetSession("userId"); userid != nil {
|
|
|
|
+ //企业画像 权限
|
|
p.T["portraitpower"] = jylabutil.IsAuthorized(userid.(string), "i_portraitpower")
|
|
p.T["portraitpower"] = jylabutil.IsAuthorized(userid.(string), "i_portraitpower")
|
|
}
|
|
}
|
|
return p.Render("/pc/supsearch.html", &p.T)
|
|
return p.Render("/pc/supsearch.html", &p.T)
|