|
@@ -1,33 +1,33 @@
|
|
|
package front
|
|
|
|
|
|
import (
|
|
|
- "fmt"
|
|
|
- "jfw/config"
|
|
|
- "jfw/jylabutil"
|
|
|
- "jfw/public"
|
|
|
- "log"
|
|
|
- "math/rand"
|
|
|
- "qfw/util"
|
|
|
- "qfw/util/bidsearch"
|
|
|
- "qfw/util/jy"
|
|
|
- "qfw/util/redis"
|
|
|
- "strconv"
|
|
|
- "strings"
|
|
|
- "time"
|
|
|
+ "fmt"
|
|
|
+ "jfw/config"
|
|
|
+ "jfw/jylabutil"
|
|
|
+ "jfw/public"
|
|
|
+ "log"
|
|
|
+ "math/rand"
|
|
|
+ "qfw/util"
|
|
|
+ "qfw/util/bidsearch"
|
|
|
+ "qfw/util/jy"
|
|
|
+ "qfw/util/redis"
|
|
|
+ "strconv"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
|
|
|
- "github.com/SKatiyar/qr"
|
|
|
- "github.com/go-xweb/xweb"
|
|
|
+ "github.com/SKatiyar/qr"
|
|
|
+ "github.com/go-xweb/xweb"
|
|
|
)
|
|
|
|
|
|
type Pcsearch struct {
|
|
|
- *xweb.Action
|
|
|
+ *xweb.Action
|
|
|
|
|
|
- pcSearchIndex xweb.Mapper `xweb:"/jylab/supsearch/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/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"` //修改提示信息状态
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -38,393 +38,396 @@ var PCS_time int
|
|
|
|
|
|
//
|
|
|
func init() {
|
|
|
- xweb.AddAction(&Pcsearch{})
|
|
|
- industrylist, sortArray = jy.Getindustrys(util.ObjToString(config.Sysconfig["industry"]), mongodb)
|
|
|
- //清除搜索列表内存缓存 间隔时间
|
|
|
- PCS_time = util.IntAll(config.Sysconfig["PCS_time"])
|
|
|
- go func() {
|
|
|
- time.Sleep(time.Second * 5)
|
|
|
- PCS_task()
|
|
|
- }()
|
|
|
- PCS_index = map[string]interface{}{}
|
|
|
+ xweb.AddAction(&Pcsearch{})
|
|
|
+ industrylist, sortArray = jy.Getindustrys(util.ObjToString(config.Sysconfig["industry"]), mongodb)
|
|
|
+ //清除搜索列表内存缓存 间隔时间
|
|
|
+ PCS_time = util.IntAll(config.Sysconfig["PCS_time"])
|
|
|
+ go func() {
|
|
|
+ time.Sleep(time.Second * 5)
|
|
|
+ PCS_task()
|
|
|
+ }()
|
|
|
+ PCS_index = map[string]interface{}{}
|
|
|
}
|
|
|
|
|
|
//定时清理搜索列表页 从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))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //根据配置延迟 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]
|
|
|
+ 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]
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func (p *Pcsearch) ChangePro() {
|
|
|
- defer util.Catch()
|
|
|
- userid := p.GetSession("userId")
|
|
|
- if userid != nil {
|
|
|
- jylabutil.UpdateAuthory(userid.(string), "i_tablepro", 1)
|
|
|
- }
|
|
|
+ defer util.Catch()
|
|
|
+ userid := p.GetSession("userId")
|
|
|
+ if userid != nil {
|
|
|
+ jylabutil.UpdateAuthory(userid.(string), "i_tablepro", 1)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func (p *Pcsearch) ProposedProject() error {
|
|
|
- defer util.Catch()
|
|
|
- var shareid = p.GetString("id")
|
|
|
- if len(shareid) == 0 {
|
|
|
- shareid = "10"
|
|
|
- }
|
|
|
- p.T["logid"] = config.Seoconfig["jynjxmy"].(string)
|
|
|
- b_word, _, s_word := jy.InterceptSearchKW(p.GetString("keywords"), false, true)
|
|
|
- area := p.GetString("area") //地区
|
|
|
- publishtime := p.GetString("publishtime") //发布时间
|
|
|
- subtype := p.GetString("subtype") //信息类型
|
|
|
- if subtype == "" {
|
|
|
- subtype = "拟建"
|
|
|
- }
|
|
|
- var totalPage int64
|
|
|
- var list *[]map[string]interface{}
|
|
|
- var status = 1
|
|
|
- var count int64
|
|
|
- if len(s_word) > 0 {
|
|
|
- status = 2
|
|
|
- count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
|
|
|
- listSize := 0
|
|
|
- if list != nil {
|
|
|
- listSize = len(*list)
|
|
|
- }
|
|
|
- public.SaveUserSearchLog(p.Request, util.ObjToString(p.GetSession("userId")), count, "pc", "拟建", map[string]interface{}{
|
|
|
- "search_word": s_word,
|
|
|
- "search_area": area,
|
|
|
- "search_publishtime": publishtime,
|
|
|
- "pagenum": 1,
|
|
|
- "pagesize": listSize,
|
|
|
- })
|
|
|
- } else {
|
|
|
- p.DisableHttpCache()
|
|
|
- p.T["list"] = PCS_list("nijian") //Newbids("nijian")[0]
|
|
|
- totalPage = 10
|
|
|
- count = 500
|
|
|
- }
|
|
|
- if status == 2 {
|
|
|
- if list != nil {
|
|
|
- for _, v := range *list {
|
|
|
- v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
|
- stp, _ := v["subtype"].(string)
|
|
|
- if stp == "" {
|
|
|
- stp, _ = v["toptype"].(string)
|
|
|
- }
|
|
|
- area, _ := v["area"].(string)
|
|
|
- v["stypeadd"], v["areaadd"], _ = classify(stp, area, "")
|
|
|
- //正文匹配检索关键词
|
|
|
- highlight, _ := v["highlight"].(map[string][]string)
|
|
|
- detail := ""
|
|
|
- for _, val := range highlight["detail"] {
|
|
|
- detail += public.ClearHtml.ReplaceAllString(val, "")
|
|
|
- }
|
|
|
- v["detail"] = detail
|
|
|
- }
|
|
|
- }
|
|
|
- p.T["list"] = list
|
|
|
- }
|
|
|
- p.T["area"] = area
|
|
|
- p.T["subtype"] = subtype
|
|
|
- p.T["publishtime"] = publishtime
|
|
|
- p.T["timeslot"] = p.GetString("timeslot")
|
|
|
- p.T["totalPage"] = totalPage
|
|
|
- p.T["count"] = count
|
|
|
- p.T["keywords"] = b_word
|
|
|
- p.T["searchvalue"] = s_word
|
|
|
- p.T["login"] = p.Session().Get("user")
|
|
|
- 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)
|
|
|
- p.T["shareid"] = se.EncodeString(shareid)
|
|
|
- return p.Render("/pc/proproject.html", &p.T)
|
|
|
+ defer util.Catch()
|
|
|
+ var shareid = p.GetString("id")
|
|
|
+ if len(shareid) == 0 {
|
|
|
+ shareid = "10"
|
|
|
+ }
|
|
|
+ p.T["logid"] = config.Seoconfig["jynjxmy"].(string)
|
|
|
+ b_word, _, s_word := jy.InterceptSearchKW(p.GetString("keywords"), false, true)
|
|
|
+ area := p.GetString("area") //地区
|
|
|
+ publishtime := p.GetString("publishtime") //发布时间
|
|
|
+ subtype := p.GetString("subtype") //信息类型
|
|
|
+ if subtype == "" {
|
|
|
+ subtype = "拟建"
|
|
|
+ }
|
|
|
+ var totalPage int64
|
|
|
+ var list *[]map[string]interface{}
|
|
|
+ var status = 1
|
|
|
+ var count int64
|
|
|
+ if len(s_word) > 0 {
|
|
|
+ status = 2
|
|
|
+ count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
|
|
|
+ listSize := 0
|
|
|
+ if list != nil {
|
|
|
+ listSize = len(*list)
|
|
|
+ }
|
|
|
+ public.SaveUserSearchLog(p.Request, util.ObjToString(p.GetSession("userId")), count, "pc", "拟建", map[string]interface{}{
|
|
|
+ "search_word": s_word,
|
|
|
+ "search_area": area,
|
|
|
+ "search_publishtime": publishtime,
|
|
|
+ "pagenum": 1,
|
|
|
+ "pagesize": listSize,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ p.DisableHttpCache()
|
|
|
+ p.T["list"] = PCS_list("nijian") //Newbids("nijian")[0]
|
|
|
+ totalPage = 10
|
|
|
+ count = 500
|
|
|
+ }
|
|
|
+ if status == 2 {
|
|
|
+ if list != nil {
|
|
|
+ for _, v := range *list {
|
|
|
+ v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
|
+ stp, _ := v["subtype"].(string)
|
|
|
+ if stp == "" {
|
|
|
+ stp, _ = v["toptype"].(string)
|
|
|
+ }
|
|
|
+ area, _ := v["area"].(string)
|
|
|
+ v["stypeadd"], v["areaadd"], _ = classify(stp, area, "")
|
|
|
+ //正文匹配检索关键词
|
|
|
+ highlight, _ := v["highlight"].(map[string][]string)
|
|
|
+ detail := ""
|
|
|
+ for _, val := range highlight["detail"] {
|
|
|
+ detail += public.ClearHtml.ReplaceAllString(val, "")
|
|
|
+ }
|
|
|
+ v["detail"] = detail
|
|
|
+ }
|
|
|
+ }
|
|
|
+ p.T["list"] = list
|
|
|
+ }
|
|
|
+ p.T["area"] = area
|
|
|
+ p.T["subtype"] = subtype
|
|
|
+ p.T["publishtime"] = publishtime
|
|
|
+ p.T["timeslot"] = p.GetString("timeslot")
|
|
|
+ p.T["totalPage"] = totalPage
|
|
|
+ p.T["count"] = count
|
|
|
+ p.T["keywords"] = b_word
|
|
|
+ p.T["searchvalue"] = s_word
|
|
|
+ p.T["login"] = p.Session().Get("user")
|
|
|
+ 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)
|
|
|
+ p.T["shareid"] = se.EncodeString(shareid)
|
|
|
+ return p.Render("/pc/proproject.html", &p.T)
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func (p *Pcsearch) Getstatus() error {
|
|
|
- defer util.Catch()
|
|
|
- var supstatus, entstatus, tablepro, dataexportstatus, portraitpower, followent, smartstatus bool
|
|
|
- if userid := util.ObjToString(p.GetSession("userId")); userid != "" {
|
|
|
- user, b := mongodb.FindById("user", userid,
|
|
|
- `{"i_tablepro":1}`)
|
|
|
- if len(*user) > 0 && b {
|
|
|
- tablepro = util.Int64All((*user)["i_tablepro"]) == 1
|
|
|
- }
|
|
|
- }
|
|
|
- p.ServeJson(map[string]interface{}{
|
|
|
- "smartstatus": smartstatus,
|
|
|
- "supstatus": supstatus,
|
|
|
- "entstatus": entstatus,
|
|
|
- "tablepro": tablepro,
|
|
|
- "dataexportstatus": dataexportstatus,
|
|
|
- "portraitpower": portraitpower,
|
|
|
- "followent": followent,
|
|
|
- })
|
|
|
- return nil
|
|
|
+ defer util.Catch()
|
|
|
+ var supstatus, entstatus, tablepro, dataexportstatus, portraitpower, followent, smartstatus bool
|
|
|
+ if userid := util.ObjToString(p.GetSession("userId")); userid != "" {
|
|
|
+ user, b := mongodb.FindById("user", userid,
|
|
|
+ `{"i_tablepro":1}`)
|
|
|
+ if len(*user) > 0 && b {
|
|
|
+ tablepro = util.Int64All((*user)["i_tablepro"]) == 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ p.ServeJson(map[string]interface{}{
|
|
|
+ "smartstatus": smartstatus,
|
|
|
+ "supstatus": supstatus,
|
|
|
+ "entstatus": entstatus,
|
|
|
+ "tablepro": tablepro,
|
|
|
+ "dataexportstatus": dataexportstatus,
|
|
|
+ "portraitpower": portraitpower,
|
|
|
+ "followent": followent,
|
|
|
+ })
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func (p *Pcsearch) GetNewBids() error {
|
|
|
- pagenum, _ := p.GetInteger("pageNumber")
|
|
|
- pageType := p.GetString("pageType")
|
|
|
+ pagenum, _ := p.GetInteger("pageNumber")
|
|
|
+ pageType := p.GetString("pageType")
|
|
|
|
|
|
- list := util.ObjArrToMapArr(Newbids(pageType)[pagenum-1].([]interface{}))
|
|
|
- if pageType == "" { //最新招标信息仅第一页条展示表格多字段
|
|
|
- for k, v := range list {
|
|
|
- if pagenum == 1 && k < 20 {
|
|
|
- continue
|
|
|
- }
|
|
|
- // delete(v, "areaadd")
|
|
|
- delete(v, "bidopentime")
|
|
|
- delete(v, "buyer")
|
|
|
- // delete(v, "indadd")
|
|
|
- delete(v, "k")
|
|
|
- delete(v, "projectcode")
|
|
|
- delete(v, "projectname")
|
|
|
- // delete(v, "stypeadd")
|
|
|
- delete(v, "winner")
|
|
|
- delete(v, "timetemp")
|
|
|
- delete(v, "budget")
|
|
|
- delete(v, "s_subscopeclass")
|
|
|
- delete(v, "toptype")
|
|
|
- }
|
|
|
- }
|
|
|
+ list := util.ObjArrToMapArr(Newbids(pageType)[pagenum-1].([]interface{}))
|
|
|
+ if pageType == "" { //最新招标信息仅第一页条展示表格多字段
|
|
|
+ for k, v := range list {
|
|
|
+ if pagenum == 1 && k < 20 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ // delete(v, "areaadd")
|
|
|
+ delete(v, "bidopentime")
|
|
|
+ delete(v, "buyer")
|
|
|
+ // delete(v, "indadd")
|
|
|
+ delete(v, "k")
|
|
|
+ delete(v, "projectcode")
|
|
|
+ delete(v, "projectname")
|
|
|
+ // delete(v, "stypeadd")
|
|
|
+ delete(v, "winner")
|
|
|
+ delete(v, "timetemp")
|
|
|
+ delete(v, "budget")
|
|
|
+ delete(v, "s_subscopeclass")
|
|
|
+ delete(v, "toptype")
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- p.ServeJson(map[string]interface{}{
|
|
|
- "list": list,
|
|
|
- "count": 500,
|
|
|
- "totalPage": 10,
|
|
|
- })
|
|
|
- return nil
|
|
|
+ p.ServeJson(map[string]interface{}{
|
|
|
+ "list": list,
|
|
|
+ "count": 500,
|
|
|
+ "totalPage": 10,
|
|
|
+ })
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func (p *Pcsearch) PcSearchIndex() error {
|
|
|
- defer util.Catch()
|
|
|
- p.T["logid"] = config.Seoconfig["jysslby"].(string)
|
|
|
- keywords := p.GetString("keywords")
|
|
|
- industry := strings.TrimSpace(p.GetString("industry")) //选中的行业
|
|
|
- area := p.GetString("area") //地区
|
|
|
- publishtime := p.GetString("publishtime") //发布时间
|
|
|
- timeslot := p.GetString("timeslot") //显示选择时间
|
|
|
- toptype := p.GetString("toptype") //信息类型
|
|
|
- subtype := p.GetString("subtype") //信息类型
|
|
|
- minprice := p.GetString("minprice") //最低价格
|
|
|
- maxprice := p.GetString("maxprice") //最高价格
|
|
|
+ defer util.Catch()
|
|
|
+ p.T["logid"] = config.Seoconfig["jysslby"].(string)
|
|
|
+ keywords := p.GetString("keywords")
|
|
|
+ industry := strings.TrimSpace(p.GetString("industry")) //选中的行业
|
|
|
+ area := p.GetString("area") //地区
|
|
|
+ publishtime := p.GetString("publishtime") //发布时间
|
|
|
+ timeslot := p.GetString("timeslot") //显示选择时间
|
|
|
+ toptype := p.GetString("toptype") //信息类型
|
|
|
+ subtype := p.GetString("subtype") //信息类型
|
|
|
+ minprice := p.GetString("minprice") //最低价格
|
|
|
+ maxprice := p.GetString("maxprice") //最高价格
|
|
|
|
|
|
- userId, _ := p.GetSession("userId").(string)
|
|
|
+ userId, _ := p.GetSession("userId").(string)
|
|
|
|
|
|
- //高级筛选 仅vip用户可查询
|
|
|
- var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
|
|
|
- var buyerclass string = "" //采购单位类别
|
|
|
- var notkey string = "" //排除词
|
|
|
+ //高级筛选 仅vip用户可查询
|
|
|
+ var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
|
|
|
+ var buyerclass string = "" //采购单位类别
|
|
|
+ var notkey string = "" //排除词
|
|
|
|
|
|
- selectType := p.GetString("selectType")
|
|
|
- isPayedUser, publishtime, queryItems, _, _ := bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0)
|
|
|
- if isPayedUser {
|
|
|
- buyerclass = p.GetString("buyerclass")
|
|
|
- hasBuyerTel, hasWinnerTel = p.GetString("buyertel"), p.GetString("winnertel")
|
|
|
- notkey = p.GetString("notkey")
|
|
|
- }
|
|
|
- //历史导出数据回显
|
|
|
- if strings.Contains(p.Url(), "?goback") {
|
|
|
- keywords = util.ObjToString(p.GetSession("Echo_keywords"))
|
|
|
- publishtime = util.ObjToString(p.GetSession("Echo_publishtime"))
|
|
|
- area = util.ObjToString(p.GetSession("Echo_area"))
|
|
|
- subtype = util.ObjToString(p.GetSession("Echo_subtype"))
|
|
|
- minprice = util.ObjToString(p.GetSession("Echo_minprice"))
|
|
|
- maxprice = util.ObjToString(p.GetSession("Echo_maxprice"))
|
|
|
- buyerclass = util.ObjToString(p.GetSession("Echo_buyerclass"))
|
|
|
- selectType = util.ObjToString(p.GetSession("Echo_selectType"))
|
|
|
- timeslot = util.ObjToString(p.GetSession("Echo_timeslot"))
|
|
|
- hasBuyerTel = util.ObjToString(p.GetSession("Echo_hasBuyertel"))
|
|
|
- hasWinnerTel = util.ObjToString(p.GetSession("Echo_hasWinnertel"))
|
|
|
- industry = util.ObjToString(p.GetSession("Echo_industry"))
|
|
|
- notkey = util.ObjToString(p.GetSession("Echo_notkey"))
|
|
|
- }
|
|
|
+ selectType := p.GetString("selectType")
|
|
|
+ if selectType == "" {
|
|
|
+ selectType = "title,content"
|
|
|
+ }
|
|
|
+ isPayedUser, publishtime, queryItems, _, _ := bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0)
|
|
|
+ if isPayedUser {
|
|
|
+ buyerclass = p.GetString("buyerclass")
|
|
|
+ hasBuyerTel, hasWinnerTel = p.GetString("buyertel"), p.GetString("winnertel")
|
|
|
+ notkey = p.GetString("notkey")
|
|
|
+ }
|
|
|
+ //历史导出数据回显
|
|
|
+ if strings.Contains(p.Url(), "?goback") {
|
|
|
+ keywords = util.ObjToString(p.GetSession("Echo_keywords"))
|
|
|
+ publishtime = util.ObjToString(p.GetSession("Echo_publishtime"))
|
|
|
+ area = util.ObjToString(p.GetSession("Echo_area"))
|
|
|
+ subtype = util.ObjToString(p.GetSession("Echo_subtype"))
|
|
|
+ minprice = util.ObjToString(p.GetSession("Echo_minprice"))
|
|
|
+ maxprice = util.ObjToString(p.GetSession("Echo_maxprice"))
|
|
|
+ buyerclass = util.ObjToString(p.GetSession("Echo_buyerclass"))
|
|
|
+ selectType = util.ObjToString(p.GetSession("Echo_selectType"))
|
|
|
+ timeslot = util.ObjToString(p.GetSession("Echo_timeslot"))
|
|
|
+ hasBuyerTel = util.ObjToString(p.GetSession("Echo_hasBuyertel"))
|
|
|
+ hasWinnerTel = util.ObjToString(p.GetSession("Echo_hasWinnertel"))
|
|
|
+ industry = util.ObjToString(p.GetSession("Echo_industry"))
|
|
|
+ notkey = util.ObjToString(p.GetSession("Echo_notkey"))
|
|
|
+ }
|
|
|
|
|
|
- b_word, s_word := "", ""
|
|
|
- if keywords != "" {
|
|
|
- b_word, _, s_word = jy.InterceptSearchKW(keywords, false, len(industry) == 0)
|
|
|
- }
|
|
|
- var list *[]map[string]interface{}
|
|
|
- var status = 1
|
|
|
- var count, totalPage int64
|
|
|
- secondFlag := ""
|
|
|
- secondKWS := ""
|
|
|
- if len(s_word) > 0 || len(industry) > 0 {
|
|
|
- status = 2
|
|
|
- secondKWS, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser)
|
|
|
- } else {
|
|
|
- p.DisableHttpCache()
|
|
|
- p.T["list"] = PCS_list("") //Newbids("")[0]
|
|
|
- count, totalPage = 500, 10
|
|
|
- }
|
|
|
- if status == 2 {
|
|
|
- secondList, tp, _ := bidsearch.LisetData(1, 0, list, secondFlag, config.Seoconfig, isPayedUser)
|
|
|
- if tp == 1 {
|
|
|
- p.T["secondList"] = ""
|
|
|
- totalPage = 1
|
|
|
- } else if len(secondList) > 0 {
|
|
|
- p.T["secondList"] = secondList
|
|
|
- }
|
|
|
- if secondKWS != "" {
|
|
|
- s_word = s_word + "+" + secondKWS
|
|
|
- }
|
|
|
- p.T["list"] = list
|
|
|
- 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["buyerclass"] = buyerclass
|
|
|
- p.T["buyertel"] = hasBuyerTel
|
|
|
- p.T["winnertel"] = hasWinnerTel
|
|
|
- p.T["notkey"] = notkey
|
|
|
- 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", "近一年")
|
|
|
- case "threeyear":
|
|
|
- p.SetSession("parampublishtime", "近三年")
|
|
|
- case "fiveyear":
|
|
|
- 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["login"] = p.Session().Get("user")
|
|
|
- p.T["count"] = count
|
|
|
- p.T["totalPage"] = totalPage
|
|
|
- p.T["keywords"] = b_word
|
|
|
- p.T["industry"] = industry
|
|
|
- p.T["industrylist"] = industrylist
|
|
|
- p.T["sortArray"] = sortArray
|
|
|
- p.T["showVipScreen"] = isPayedUser
|
|
|
- //
|
|
|
- if userId != "" {
|
|
|
- //企业画像 权限
|
|
|
- p.T["portraitpower"] = jylabutil.IsAuthorized(userId, "i_portraitpower")
|
|
|
- }
|
|
|
- return p.Render("/pc/supsearch.html", &p.T)
|
|
|
+ b_word, s_word := "", ""
|
|
|
+ if keywords != "" {
|
|
|
+ b_word, _, s_word = jy.InterceptSearchKW(keywords, false, len(industry) == 0)
|
|
|
+ }
|
|
|
+ var list *[]map[string]interface{}
|
|
|
+ var status = 1
|
|
|
+ var count, totalPage int64
|
|
|
+ secondFlag := ""
|
|
|
+ secondKWS := ""
|
|
|
+ if len(s_word) > 0 || len(industry) > 0 {
|
|
|
+ status = 2
|
|
|
+ secondKWS, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser)
|
|
|
+ } else {
|
|
|
+ p.DisableHttpCache()
|
|
|
+ p.T["list"] = PCS_list("") //Newbids("")[0]
|
|
|
+ count, totalPage = 500, 10
|
|
|
+ }
|
|
|
+ if status == 2 {
|
|
|
+ secondList, tp, _ := bidsearch.LisetData(1, 0, list, secondFlag, config.Seoconfig, isPayedUser)
|
|
|
+ if tp == 1 {
|
|
|
+ p.T["secondList"] = ""
|
|
|
+ totalPage = 1
|
|
|
+ } else if len(secondList) > 0 {
|
|
|
+ p.T["secondList"] = secondList
|
|
|
+ }
|
|
|
+ if secondKWS != "" {
|
|
|
+ s_word = s_word + "+" + secondKWS
|
|
|
+ }
|
|
|
+ p.T["list"] = list
|
|
|
+ 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["buyerclass"] = buyerclass
|
|
|
+ p.T["buyertel"] = hasBuyerTel
|
|
|
+ p.T["winnertel"] = hasWinnerTel
|
|
|
+ p.T["notkey"] = notkey
|
|
|
+ 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", "近一年")
|
|
|
+ case "threeyear":
|
|
|
+ p.SetSession("parampublishtime", "近三年")
|
|
|
+ case "fiveyear":
|
|
|
+ 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["login"] = p.Session().Get("user")
|
|
|
+ p.T["count"] = count
|
|
|
+ p.T["totalPage"] = totalPage
|
|
|
+ p.T["keywords"] = b_word
|
|
|
+ p.T["industry"] = industry
|
|
|
+ p.T["industrylist"] = industrylist
|
|
|
+ p.T["sortArray"] = sortArray
|
|
|
+ p.T["showVipScreen"] = isPayedUser
|
|
|
+ //
|
|
|
+ if userId != "" {
|
|
|
+ //企业画像 权限
|
|
|
+ p.T["portraitpower"] = jylabutil.IsAuthorized(userId, "i_portraitpower")
|
|
|
+ }
|
|
|
+ return p.Render("/pc/supsearch.html", &p.T)
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func Newbids(p string) []interface{} {
|
|
|
- pages, _ := redis.Get("other", "index_list"+p).([]interface{})
|
|
|
- if len(pages) == 0 {
|
|
|
- var list *[]map[string]interface{}
|
|
|
- subtype := ""
|
|
|
- if len(p) > 0 {
|
|
|
- subtype = "拟建"
|
|
|
- }
|
|
|
- intns := make([]int, 0)
|
|
|
- for i := 0; i < 10; i++ {
|
|
|
- if len(intns) == 0 {
|
|
|
- intns = append(intns, rand.Intn(100))
|
|
|
- } else {
|
|
|
- for {
|
|
|
- v := rand.Intn(intns[(i-1)] + 100)
|
|
|
- if v-intns[(i-1)] >= 30 {
|
|
|
- intns = append(intns, v)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ pages, _ := redis.Get("other", "index_list"+p).([]interface{})
|
|
|
+ if len(pages) == 0 {
|
|
|
+ var list *[]map[string]interface{}
|
|
|
+ subtype := ""
|
|
|
+ if len(p) > 0 {
|
|
|
+ subtype = "拟建"
|
|
|
+ }
|
|
|
+ intns := make([]int, 0)
|
|
|
+ for i := 0; i < 10; i++ {
|
|
|
+ if len(intns) == 0 {
|
|
|
+ intns = append(intns, rand.Intn(100))
|
|
|
+ } else {
|
|
|
+ for {
|
|
|
+ v := rand.Intn(intns[(i-1)] + 100)
|
|
|
+ if v-intns[(i-1)] >= 30 {
|
|
|
+ intns = append(intns, v)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- for i := 0; i < 10; i++ {
|
|
|
- _, list = getLastNewsData("", "", "", subtype, "", "", "", "", "", "", "Y", intns[i], true, false, "")
|
|
|
- for k, v := range *list {
|
|
|
- v["k"] = (k + 1) + i*50
|
|
|
- t := time.Unix(util.Int64All(v["publishtime"]), 0)
|
|
|
- v["timetemp"] = fmt.Sprint(util.Int64All(v["publishtime"]))
|
|
|
- v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
|
- v["time"] = util.TimeDiff(t)
|
|
|
- var stp = ""
|
|
|
- if v["subtype"] != nil {
|
|
|
- stp, _ = v["subtype"].(string)
|
|
|
- } else {
|
|
|
- stp = ""
|
|
|
- }
|
|
|
- if stp == "" && v["toptype"] != nil {
|
|
|
- stp, _ = v["toptype"].(string)
|
|
|
- }
|
|
|
- area, _ := v["area"].(string)
|
|
|
- indtry := util.ObjToString(v["industry"])
|
|
|
- v["stypeadd"], v["areaadd"], v["indadd"] = classify(stp, area, indtry)
|
|
|
- }
|
|
|
- pages = append(pages, list)
|
|
|
- }
|
|
|
- redis.Put("other", "index_list"+p, pages, 60*60*24*2)
|
|
|
- pages, _ = redis.Get("other", "index_list"+p).([]interface{})
|
|
|
- }
|
|
|
- return pages
|
|
|
+ for i := 0; i < 10; i++ {
|
|
|
+ _, list = getLastNewsData("", "", "", subtype, "", "", "", "", "", "", "Y", intns[i], true, false, "")
|
|
|
+ for k, v := range *list {
|
|
|
+ v["k"] = (k + 1) + i*50
|
|
|
+ t := time.Unix(util.Int64All(v["publishtime"]), 0)
|
|
|
+ v["timetemp"] = fmt.Sprint(util.Int64All(v["publishtime"]))
|
|
|
+ v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
|
+ v["time"] = util.TimeDiff(t)
|
|
|
+ var stp = ""
|
|
|
+ if v["subtype"] != nil {
|
|
|
+ stp, _ = v["subtype"].(string)
|
|
|
+ } else {
|
|
|
+ stp = ""
|
|
|
+ }
|
|
|
+ if stp == "" && v["toptype"] != nil {
|
|
|
+ stp, _ = v["toptype"].(string)
|
|
|
+ }
|
|
|
+ area, _ := v["area"].(string)
|
|
|
+ indtry := util.ObjToString(v["industry"])
|
|
|
+ v["stypeadd"], v["areaadd"], v["indadd"] = classify(stp, area, indtry)
|
|
|
+ }
|
|
|
+ pages = append(pages, list)
|
|
|
+ }
|
|
|
+ redis.Put("other", "index_list"+p, pages, 60*60*24*2)
|
|
|
+ pages, _ = redis.Get("other", "index_list"+p).([]interface{})
|
|
|
+ }
|
|
|
+ return pages
|
|
|
}
|
|
|
|
|
|
//二维码图片
|
|
|
func (p *Pcsearch) Qr(t string) error {
|
|
|
- openid := p.GetSession("openid")
|
|
|
- if openid == nil {
|
|
|
- return nil
|
|
|
- }
|
|
|
- w := p.ResponseWriter
|
|
|
- w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
- w.Header().Set("Pragma", "no-cache")
|
|
|
- w.Header().Set("Expires", "0")
|
|
|
- w.Header().Set("Content-Type", "image/png")
|
|
|
- data := config.Sysconfig["webdomain"].(string) + "/front/sess/" + sewx.EncodeString(openid.(string)+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",qrToLab") + "__" + t
|
|
|
- r, _ := qr.Encode(data, qr.M)
|
|
|
- pngdat := r.PNG()
|
|
|
- _, err := w.Write(pngdat)
|
|
|
- return err
|
|
|
+ openid := p.GetSession("openid")
|
|
|
+ if openid == nil {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ w := p.ResponseWriter
|
|
|
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
+ w.Header().Set("Pragma", "no-cache")
|
|
|
+ w.Header().Set("Expires", "0")
|
|
|
+ w.Header().Set("Content-Type", "image/png")
|
|
|
+ data := config.Sysconfig["webdomain"].(string) + "/front/sess/" + sewx.EncodeString(openid.(string)+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",qrToLab") + "__" + t
|
|
|
+ r, _ := qr.Encode(data, qr.M)
|
|
|
+ pngdat := r.PNG()
|
|
|
+ _, err := w.Write(pngdat)
|
|
|
+ return err
|
|
|
}
|