|
@@ -0,0 +1,596 @@
|
|
|
+package front
|
|
|
+
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "jfw/config"
|
|
|
+ "log"
|
|
|
+ "strconv"
|
|
|
+ "strings"
|
|
|
+
|
|
|
+ "encoding/json"
|
|
|
+ "jfw/jylabutil"
|
|
|
+ "jfw/public"
|
|
|
+ "jfw/wx"
|
|
|
+ "math/rand"
|
|
|
+ "qfw/util"
|
|
|
+ "qfw/util/elastic"
|
|
|
+ "qfw/util/redis"
|
|
|
+ "regexp"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ "github.com/go-xweb/xweb"
|
|
|
+)
|
|
|
+
|
|
|
+type PcIndex struct {
|
|
|
+ *xweb.Action
|
|
|
+ newSordfish xweb.Mapper `xweb:"/"` //剑鱼标讯pc首页
|
|
|
+ newSordfishC xweb.Mapper `xweb:"/pcindex.html"` //剑鱼标讯pc首页-统计
|
|
|
+ searchResult xweb.Mapper `xweb:"/list/(\\w+)/(\\w+).html"` //剑鱼标讯分类 地区结果列表
|
|
|
+ tesa xweb.Mapper `xweb:"/index/tesa"`
|
|
|
+}
|
|
|
+
|
|
|
+func init() {
|
|
|
+ xweb.AddAction(&PcIndex{})
|
|
|
+}
|
|
|
+
|
|
|
+func (d *PcIndex) Tesa() {
|
|
|
+ typ, _ := d.GetInteger("typ")
|
|
|
+ // d.WriteBytes([]byte("ok,清除路径:" + "pc/index.html"))
|
|
|
+ // m := GetNewBlog()
|
|
|
+ // m := getstypeMap()
|
|
|
+ m := GetLabUrl(typ)
|
|
|
+ d.ServeJson(m)
|
|
|
+}
|
|
|
+
|
|
|
+//剑鱼标讯pc首页
|
|
|
+func (m *PcIndex) NewSordfish() error {
|
|
|
+ ispc, _ := m.GetInteger("ispc")
|
|
|
+ var shareid = m.GetString("id")
|
|
|
+ pcindexKey := "jypcindex"
|
|
|
+ if cacheKey, _ := config.Sysconfig["pcindexCacheKey"].(string); cacheKey != "" {
|
|
|
+ pcindexKey = cacheKey
|
|
|
+ }
|
|
|
+ if len(shareid) == 0 {
|
|
|
+ shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
|
|
|
+ } else {
|
|
|
+ redis.Del("other", pcindexKey)
|
|
|
+ }
|
|
|
+ m.T["logid"] = config.Seoconfig["jysy"].(string)
|
|
|
+ m.T["shareid"] = se.EncodeString(shareid)
|
|
|
+ m.T["activestart"] = config.ActiveConfig.DoubleEleven.Active_Start
|
|
|
+ m.T["activeend"] = config.ActiveConfig.DoubleEleven.Active_End
|
|
|
+ regex, _ := regexp.Compile("(Android|Mobile)")
|
|
|
+ if ispc == 0 && len(regex.FindAllString(m.Header("User-Agent"), -1)) > 0 {
|
|
|
+ m.T["s_m_openid"] = util.ObjToString(m.GetSession("s_m_openid"))
|
|
|
+ m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
|
|
|
+ m.T["nickname"] = util.ObjToString(m.GetSession("s_nickname"))
|
|
|
+ m.T["avatar"] = util.ObjToString(m.GetSession("s_avatar"))
|
|
|
+ return m.Render("/pc/mobileindex.html", &m.T)
|
|
|
+ } else {
|
|
|
+ if ret := redis.Get("other", pcindexKey); ret != nil {
|
|
|
+ return m.SetBody([]byte(ret.(string)))
|
|
|
+ } else {
|
|
|
+ m.T["live_Preheat_Start"] = config.ActiveConfig.Live_Preheat_Start
|
|
|
+ m.T["live_Active_End"] = config.ActiveConfig.Live_Active_End
|
|
|
+ //最新资讯
|
|
|
+ m.T["blog"] = GetNewBlog()
|
|
|
+ //最新公告信息
|
|
|
+ for _, v := range []int{1, 2, 3, 4} { //1拟建 2招标预告 3招标公告 4招标结果
|
|
|
+ m.T[fmt.Sprintf("newArticle_%d", v)] = GetNewArticle(v)
|
|
|
+ }
|
|
|
+ //前端需要跳转的路由
|
|
|
+ for _, v := range []int{1, 2, 3} {
|
|
|
+ m.T[fmt.Sprintf("labUrl_%d", v)] = GetLabUrl(v) //1地域 2信息类型 3热门招标
|
|
|
+ }
|
|
|
+ //信息条数(上线以来..)
|
|
|
+ m.T["infoNum"] = GetInfoNum()
|
|
|
+ content, _ := m.Render4Cache("/pc/index.html", &m.T)
|
|
|
+ timeout := util.IntAllDef(config.Sysconfig["pcindexCacheTime"], 7200)
|
|
|
+ redis.Put("other", pcindexKey, string(content), timeout)
|
|
|
+ return m.SetBody(content)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return m.Render("/pc/index.html", &m.T)
|
|
|
+}
|
|
|
+
|
|
|
+//剑鱼标讯pc首页-统计
|
|
|
+func (m *PcIndex) NewSordfishC() error {
|
|
|
+ var shareid = m.GetString("id")
|
|
|
+ if len(shareid) == 0 {
|
|
|
+ shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
|
|
|
+ } else {
|
|
|
+ redis.Del("other", "jypcindex")
|
|
|
+ }
|
|
|
+ m.T["logid"] = config.Seoconfig["jysy"].(string)
|
|
|
+ m.T["shareid"] = se.EncodeString(shareid)
|
|
|
+ if ret := redis.Get("other", "jypcindex"); ret != nil {
|
|
|
+ return m.SetBody([]byte(ret.(string)))
|
|
|
+ } else {
|
|
|
+ m.DisableHttpCache()
|
|
|
+ content, _ := m.Render4Cache("/pc/index.html", &m.T)
|
|
|
+ redis.Put("other", "jypcindex", string(content), 60*60*2)
|
|
|
+ return m.SetBody(content)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//首页资讯
|
|
|
+func GetNewBlog() (r []map[string]interface{}) {
|
|
|
+ rediskey := "pcindex_blog"
|
|
|
+ if data, ok := redis.Get("other", rediskey).([]interface{}); ok && data != nil && len(data) > 0 {
|
|
|
+ r = util.ObjArrToMapArr(data)
|
|
|
+ } else {
|
|
|
+ rs, _ := SearhWebContentblog(map[string]string{
|
|
|
+ "contentType": "jybk",
|
|
|
+ })
|
|
|
+ if rs != nil && len(*rs) > 4 {
|
|
|
+ *rs = (*rs)[0:5]
|
|
|
+ for _, v := range *rs {
|
|
|
+ delete(v, "praise")
|
|
|
+ delete(v, "s_contenttype")
|
|
|
+ delete(v, "s_source")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ r = *rs
|
|
|
+ redis.Put("other", rediskey, r, 24*60*60)
|
|
|
+ }
|
|
|
+ return r
|
|
|
+}
|
|
|
+
|
|
|
+//最新公告信息
|
|
|
+func GetNewArticle(typ int) (list []map[string]interface{}) {
|
|
|
+ if typ == 0 {
|
|
|
+ typ = 1
|
|
|
+ }
|
|
|
+ rediskey := fmt.Sprintf("pcindex_newArticle_%d", typ)
|
|
|
+ subtype := ""
|
|
|
+ switch typ {
|
|
|
+ case 1:
|
|
|
+ //拟建
|
|
|
+ subtype = "拟建"
|
|
|
+ case 2:
|
|
|
+ //招标预告
|
|
|
+ subtype = "预告"
|
|
|
+ case 3:
|
|
|
+ //招标公告
|
|
|
+ subtype = "招标,邀标,询价,竞谈,单一,竞价,变更,其它"
|
|
|
+ case 4:
|
|
|
+ //招标结果
|
|
|
+ subtype = "中标,成交,废标,流标,其它"
|
|
|
+ }
|
|
|
+ if l, ok := redis.Get("other", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
|
|
|
+ list = util.ObjArrToMapArr(l)
|
|
|
+ } else {
|
|
|
+ _, _, lists := getBidSearchData("", "", "", subtype, "", "", "", 1, false, "", "")
|
|
|
+ if lists != nil && len(*lists) > 5 {
|
|
|
+ *lists = (*lists)[0:6]
|
|
|
+ for _, v := range *lists {
|
|
|
+ v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
|
+ delete(v, "toptype")
|
|
|
+ delete(v, "s_subscopeclass")
|
|
|
+ tmpdate := v["publishtime"]
|
|
|
+ v["publishtime"] = util.TimeDiff(time.Unix(util.Int64All(tmpdate.(float64)), 0))
|
|
|
+ if v["budget"] != nil {
|
|
|
+ v["budget"] = ConversionMoeny(v["budget"])
|
|
|
+ } else if v["bidamount"] != nil {
|
|
|
+ v["budget"] = ConversionMoeny(v["bidamount"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ list = *lists
|
|
|
+ redis.Put("other", rediskey, list, 2*60*60)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list
|
|
|
+}
|
|
|
+
|
|
|
+//前端跳转地址
|
|
|
+func GetLabUrl(typ int) interface{} {
|
|
|
+ if typ == 1 { //地区
|
|
|
+ areaM := map[string]interface{}{}
|
|
|
+ //省份
|
|
|
+ areamap, _ := config.Seoconfig["area"].(map[string]interface{})
|
|
|
+ if areamap != nil && len(areamap) > 0 {
|
|
|
+ for k, v := range areamap {
|
|
|
+ area := v.(map[string]interface{})
|
|
|
+ areaname := util.ObjToString(area["NAME"])
|
|
|
+ areaM[areaname] = k
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //城市
|
|
|
+ m := map[string][]map[string]interface{}{}
|
|
|
+ for k, v := range areaM {
|
|
|
+ a, _ := v.(string)
|
|
|
+ m[k] = append(m[k], map[string]interface{}{
|
|
|
+ "city": k,
|
|
|
+ "url": fmt.Sprintf("/list/area/%s.html", a),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ cityMap := getCityMap()
|
|
|
+ r := public.PushMysql.SelectBySql(`select a.name province,b.name city from
|
|
|
+(select name,cid from province where level =1) a left join province b on a.cid =b.pid order by id `)
|
|
|
+ provinceArr := util.ObjArrToStringArr(config.Seoconfig["hotlabcitySort"].([]interface{}))
|
|
|
+ if r != nil && len(*r) > 0 {
|
|
|
+ for _, v := range *r {
|
|
|
+ province := util.ObjToString(v["province"])
|
|
|
+ city := util.ObjToString(v["city"])
|
|
|
+ m[province] = append(m[province], map[string]interface{}{
|
|
|
+ "city": city,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for kk, vv := range m {
|
|
|
+ for _, vvv := range vv {
|
|
|
+ city := util.ObjToString(vvv["city"])
|
|
|
+ if kk != city {
|
|
|
+ vvv["url"] = fmt.Sprintf("/list/city/%s.html", cityMap[city])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mar := []map[string][]map[string]interface{}{}
|
|
|
+ for _, v := range provinceArr {
|
|
|
+ mar = append(mar, map[string][]map[string]interface{}{v: m[v]})
|
|
|
+ }
|
|
|
+ return mar
|
|
|
+ } else if typ == 2 { //信息类型
|
|
|
+ stypeMap := getstypeMap()
|
|
|
+ return stypeMap
|
|
|
+ } else if typ == 3 { //热门招标
|
|
|
+ keysMap := getkeysMap()
|
|
|
+ return keysMap
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func isin(arr []string, s string) bool {
|
|
|
+ for _, v := range arr {
|
|
|
+ if v == s {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|
|
|
+
|
|
|
+//招标搜索数量
|
|
|
+func GetInfoNum() (one map[string]interface{}) {
|
|
|
+ defer util.Catch()
|
|
|
+ redis_obj := redis.Get("other", "pcsw_index")
|
|
|
+ if redis_obj != nil {
|
|
|
+ one = redis_obj.(map[string]interface{})
|
|
|
+ log.Println("newpage from the cache...")
|
|
|
+ } else {
|
|
|
+ rs, err := mongodb.Find("swordfish_index", nil, `{"_id":-1}`, nil, false, 0, 1)
|
|
|
+ if err {
|
|
|
+ one = (*rs)[0]
|
|
|
+ one["i_site"] = util.IntAll(one["i_entsite"]) + util.IntAll(one["i_govsite"])
|
|
|
+ avg := util.IntAll(one["i_bidmonth"])/21 + util.IntAll(one["i_bidmonth"])%21
|
|
|
+ one["i_avg"] = avg
|
|
|
+ one["i_my"] = util.IntAll(one["i_entsite"]) * 35 / 100
|
|
|
+ one["i_hy"] = util.IntAll(one["i_entsite"]) * 15 / 100
|
|
|
+ one["i_zb"] = util.IntAll(one["i_entsite"]) - util.IntAll(one["i_my"]) - util.IntAll(one["i_hy"])
|
|
|
+ one["i_push"] = NumberFormat(util.IntAll(one["i_push"]))
|
|
|
+ one["i_bidmonth"] = NumberFormat(util.IntAll(one["i_bidmonth"]))
|
|
|
+ one["i_site"] = NumberFormat(util.IntAll(one["i_site"]))
|
|
|
+ one["i_bidtoday"] = NumberFormat(util.IntAll(one["i_bidtoday"]))
|
|
|
+ redis.Put("other", "pcsw_index", one, 60*60*2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return one
|
|
|
+}
|
|
|
+
|
|
|
+//标签查询
|
|
|
+func (f *PcIndex) SearchResult(at, name string) error {
|
|
|
+ defer util.Catch()
|
|
|
+ if at == "stype" && name == "NJ" {
|
|
|
+ return f.Redirect("/jylab/supsearch/proposedProject.html")
|
|
|
+ }
|
|
|
+ var no = 5
|
|
|
+ var area = ""
|
|
|
+ var stype = ""
|
|
|
+ var industry = ""
|
|
|
+ var city = ""
|
|
|
+ var keywords, key_industry = "", ""
|
|
|
+ var startPage, currentPage, limitcount int
|
|
|
+ limitcount = util.IntAll(config.Seoconfig["limitcount"])
|
|
|
+ var res = ""
|
|
|
+ var seotitle = ""
|
|
|
+ var seokeywords = ""
|
|
|
+ var seodescription = ""
|
|
|
+ if len(industrylist) > 0 {
|
|
|
+ f.T["industrylist"], f.T["sortArray"] = industrylist, sortArray
|
|
|
+ } else {
|
|
|
+ f.T["industrylist"], f.T["sortArray"] = getindustrys()
|
|
|
+ }
|
|
|
+ var shareid = f.GetString("id")
|
|
|
+ if len(shareid) == 0 {
|
|
|
+ shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jybqy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
|
|
|
+ }
|
|
|
+ f.T["logid"] = config.Seoconfig["jybqy"].(string)
|
|
|
+ if at == "area" {
|
|
|
+ areamp, _ := config.Seoconfig["area"].(map[string]interface{})
|
|
|
+ if areamp != nil {
|
|
|
+ areamp1 := areamp[name].(map[string]interface{})
|
|
|
+ if areamp1 != nil {
|
|
|
+ area = areamp1["NAME"].(string)
|
|
|
+ seotitle = areamp1["TITLE"].(string)
|
|
|
+ seokeywords = areamp1["KEYWORDS"].(string)
|
|
|
+ seodescription = areamp1["DESCRIPTION"].(string)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if at == "stype" {
|
|
|
+ stypemp, _ := config.Seoconfig["stype"].(map[string]interface{})
|
|
|
+ if stypemp != nil {
|
|
|
+ stypemp1 := stypemp[name].(map[string]interface{})
|
|
|
+ if stypemp1 != nil {
|
|
|
+ stype = stypemp1["NAME"].(string)
|
|
|
+ seotitle = stypemp1["TITLE"].(string)
|
|
|
+ seokeywords = stypemp1["KEYWORDS"].(string)
|
|
|
+ seodescription = stypemp1["DESCRIPTION"].(string)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if at == "industry" {
|
|
|
+ industrymp, _ := config.Seoconfig["industry"].(map[string]interface{})
|
|
|
+ if industrymp != nil {
|
|
|
+ industrymp1 := industrymp[name].(map[string]interface{})
|
|
|
+ if industrymp1 != nil {
|
|
|
+ industry = industrymp1["NAME"].(string)
|
|
|
+ seotitle = industrymp1["TITLE"].(string)
|
|
|
+ seokeywords = industrymp1["KEYWORDS"].(string)
|
|
|
+ seodescription = industrymp1["DESCRIPTION"].(string)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if at == "city" {
|
|
|
+ citymp, _ := config.Seoconfig["city"].(map[string]interface{})
|
|
|
+ if citymp != nil {
|
|
|
+ citymp1 := citymp[name].(map[string]interface{})
|
|
|
+ if citymp1 != nil {
|
|
|
+ city = citymp1["NAME"].(string)
|
|
|
+ seotitle = citymp1["TITLE"].(string)
|
|
|
+ seokeywords = citymp1["KEYWORDS"].(string)
|
|
|
+ seodescription = citymp1["DESCRIPTION"].(string)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if at == "keywords" {
|
|
|
+ keywordsArr, _ := config.Seoconfig["keywordsArr"].([]interface{})
|
|
|
+ if len(keywordsArr) > 0 {
|
|
|
+ for _, v := range keywordsArr {
|
|
|
+ keys := v.(map[string]interface{})
|
|
|
+ keywordsmp1 := keys[name]
|
|
|
+ if keywordsmp1 != nil {
|
|
|
+ km := keywordsmp1.(map[string]interface{})
|
|
|
+ keywords = km["NAME"].(string)
|
|
|
+ seotitle = km["TITLE"].(string)
|
|
|
+ seokeywords = km["KEYWORDS"].(string)
|
|
|
+ seodescription = km["DESCRIPTION"].(string)
|
|
|
+ key_industry = km["INDUSTRY"].(string)
|
|
|
+ //行业
|
|
|
+ industrymp, _ := config.Seoconfig["industry"].(map[string]interface{})
|
|
|
+ industrymp1 := industrymp[key_industry].(map[string]interface{})
|
|
|
+ if industrymp1 != nil {
|
|
|
+ key_industry = industrymp1["NAME"].(string)
|
|
|
+ industry = key_industry
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ f.T["seoarea"] = area
|
|
|
+ f.T["seostype"] = stype
|
|
|
+ f.T["seotitle"] = seotitle
|
|
|
+ f.T["seokeywords"] = seokeywords
|
|
|
+ f.T["seodption"] = seodescription
|
|
|
+ f.T["seocity"] = city
|
|
|
+ f.T["keywords"] = keywords
|
|
|
+ if area == "全国" {
|
|
|
+ return f.Redirect("/swordfish/searchinfolist.html")
|
|
|
+ }
|
|
|
+ if area != "" || stype != "" || industry != "" || city != "" || keywords != "" {
|
|
|
+ list := redis.Get("other", "classify_"+name)
|
|
|
+ query1 := `{"query": {"bool": {"must":[`
|
|
|
+ if area != "" {
|
|
|
+ query1 += `{"term":{"area":"` + area + `"}}`
|
|
|
+ } else if stype != "" {
|
|
|
+ stype = getstype(stype)
|
|
|
+ query1 += `{"terms":{"subtype":[`
|
|
|
+ for k, v := range strings.Split(stype, ",") {
|
|
|
+ if k > 0 {
|
|
|
+ query1 += `,`
|
|
|
+ }
|
|
|
+ query1 += `"` + v + `"`
|
|
|
+ }
|
|
|
+ query1 += `]}}`
|
|
|
+ // query1 += `{"term":{"subtype":"` + stype + `"}}`
|
|
|
+ } else if industry != "" {
|
|
|
+ query1 += `{"term":{"industry":"` + industry + `"}}`
|
|
|
+ } else if city != "" {
|
|
|
+ query1 += `{"term":{"city":"` + city + `"}}`
|
|
|
+ }
|
|
|
+ query1 += `],"should": [],"minimum_should_match": 0}}}`
|
|
|
+ query := getLastNewsQuery(area, "", stype, industry, city)
|
|
|
+ log.Println(query)
|
|
|
+ var datas *[]map[string]interface{}
|
|
|
+ if list == nil {
|
|
|
+ if keywords == "" {
|
|
|
+ count := elastic.Count(INDEX, TYPE, query1)
|
|
|
+ r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
|
+ currentPage = no
|
|
|
+ startPage = r.Intn(currentPage * limitcount)
|
|
|
+ count1 := util.IntAll(count)
|
|
|
+ if count1 < startPage || startPage < 0 {
|
|
|
+ startPage = 0
|
|
|
+ }
|
|
|
+ datas = elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","buyer","bidamount","budget","s_subscopeclass","projectname"`, startPage, limitcount)
|
|
|
+ //log.Println("datas:", *datas)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //关键词
|
|
|
+ _, _, datas = getBidSearchData(keywords, "", "", "", key_industry, "", "", 0, false, "title", "")
|
|
|
+ if datas != nil && len(*datas) > limitcount {
|
|
|
+ *datas = (*datas)[0:limitcount]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if datas != nil && len(*datas) > 0 {
|
|
|
+ for _, v := range *datas {
|
|
|
+ v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ timeout := util.IntAllDef(config.Sysconfig["pcIndexHotCacheTime"], 7200)
|
|
|
+ redis.Put("other", "classify_"+name, datas, timeout)
|
|
|
+ } else {
|
|
|
+ b, _ := json.Marshal(list)
|
|
|
+ json.Unmarshal(b, &datas)
|
|
|
+ }
|
|
|
+ if datas != nil && len(*datas) > 0 {
|
|
|
+ public.BidListConvert(industry, datas)
|
|
|
+ res = searchresulthtml(datas)
|
|
|
+ }
|
|
|
+ f.T["res"] = res
|
|
|
+ f.T["area"] = area
|
|
|
+ f.T["stype"] = stype
|
|
|
+ f.T["industry"] = industry
|
|
|
+ f.T["classifyname"] = name
|
|
|
+ f.SetSession("paramarea", area)
|
|
|
+ f.SetSession("paraminfotype", stype)
|
|
|
+ f.T["shareid"] = se.EncodeString(shareid)
|
|
|
+ }
|
|
|
+ //
|
|
|
+ if userid := f.GetSession("userId"); userid != nil {
|
|
|
+ f.T["portraitpower"] = jylabutil.IsAuthorized(userid.(string), "i_portraitpower")
|
|
|
+ }
|
|
|
+ return f.Render("/pc/classifylist.html", &f.T)
|
|
|
+}
|
|
|
+
|
|
|
+func getCityMap() map[string]interface{} {
|
|
|
+ m := map[string]interface{}{}
|
|
|
+ citymp, _ := config.Seoconfig["city"].(map[string]interface{})
|
|
|
+ if citymp != nil && len(citymp) > 0 {
|
|
|
+ for k, v := range citymp {
|
|
|
+ city := v.(map[string]interface{})
|
|
|
+ cityname := util.ObjToString(city["NAME"])
|
|
|
+ m[cityname] = k
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return m
|
|
|
+}
|
|
|
+func getstypeMap() []map[string][]map[string]interface{} {
|
|
|
+ m := map[string]interface{}{}
|
|
|
+ stypemap, _ := config.Seoconfig["stype"].(map[string]interface{})
|
|
|
+ if stypemap != nil && len(stypemap) > 0 {
|
|
|
+ for k, v := range stypemap {
|
|
|
+ stype := v.(map[string]interface{})
|
|
|
+ stypename := util.ObjToString(stype["NAME"])
|
|
|
+ if stypename == "拟建" {
|
|
|
+ stypename = "拟建项目"
|
|
|
+ }
|
|
|
+ m[stypename] = k
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m2 := []map[string][]map[string]interface{}{} //结构整理 返给前端
|
|
|
+ stype_1reg := []string{"招标公告", "招标结果", "招标信用信息", "招标预告", "拟建项目"}
|
|
|
+ hotlabstypSort := config.Seoconfig["hotlabstypSort"].([]interface{})
|
|
|
+ notice := util.ObjArrToStringArr(hotlabstypSort[0].([]interface{}))
|
|
|
+ result := util.ObjArrToStringArr(hotlabstypSort[1].([]interface{}))
|
|
|
+ credit := util.ObjArrToStringArr(hotlabstypSort[2].([]interface{}))
|
|
|
+ herald := util.ObjArrToStringArr(hotlabstypSort[3].([]interface{}))
|
|
|
+ for k, v := range stype_1reg {
|
|
|
+ m2 = append(m2, map[string][]map[string]interface{}{
|
|
|
+ v: []map[string]interface{}{map[string]interface{}{"key": v, "url": fmt.Sprintf("/list/stype/%s.html", m[v])}},
|
|
|
+ })
|
|
|
+ switch k {
|
|
|
+ case 0:
|
|
|
+ m2 = stypeformat(k, v, m, m2, notice)
|
|
|
+ case 1:
|
|
|
+ m2 = stypeformat(k, v, m, m2, result)
|
|
|
+ case 2:
|
|
|
+ m2 = stypeformat(k, v, m, m2, credit)
|
|
|
+ case 3:
|
|
|
+ m2 = stypeformat(k, v, m, m2, herald)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return m2
|
|
|
+}
|
|
|
+
|
|
|
+//给前端格式化数据结构
|
|
|
+func stypeformat(k int, v string, m map[string]interface{}, m1 []map[string][]map[string]interface{}, arr []string) []map[string][]map[string]interface{} {
|
|
|
+ for _, vv := range arr {
|
|
|
+ vvstr := vv
|
|
|
+ if strings.Contains(vv, "其它") {
|
|
|
+ vvstr = "其它"
|
|
|
+ }
|
|
|
+ m1[k][v] = append(m1[k][v], map[string]interface{}{"key": vvstr, "url": fmt.Sprintf("/list/stype/%s.html", m[vv])})
|
|
|
+ }
|
|
|
+ return m1
|
|
|
+}
|
|
|
+
|
|
|
+func getkeysMap() []map[string][]map[string]interface{} {
|
|
|
+ mar := []map[string][]map[string]interface{}{}
|
|
|
+ m, industry := map[string][]map[string]interface{}{}, ""
|
|
|
+ sortArr := util.ObjArrToStringArr(config.Seoconfig["hotlabkeywordsSort"].([]interface{}))
|
|
|
+ keymap, _ := config.Seoconfig["keywordsArr"].([]interface{})
|
|
|
+ //
|
|
|
+ industrymp, _ := config.Seoconfig["industry"].(map[string]interface{})
|
|
|
+ if len(keymap) > 0 {
|
|
|
+ for _, v := range keymap {
|
|
|
+ keys := v.(map[string]interface{})
|
|
|
+ for kk, vv := range keys {
|
|
|
+ vvmap := vv.(map[string]interface{})
|
|
|
+ key_industry := util.ObjToString(vvmap["INDUSTRY"])
|
|
|
+ keysname := util.ObjToString(vvmap["NAME"])
|
|
|
+ if industrymp != nil {
|
|
|
+ industrymp1 := industrymp[key_industry].(map[string]interface{})
|
|
|
+ if industrymp1 != nil {
|
|
|
+ industry = industrymp1["NAME"].(string)
|
|
|
+ if industryArr := strings.Split(industry, "_"); len(industryArr) > 0 {
|
|
|
+ industry = industryArr[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m[industry] = append(m[industry], map[string]interface{}{
|
|
|
+ "key": keysname,
|
|
|
+ "url": fmt.Sprintf("/list/keywords/%s.html", kk),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, v := range sortArr {
|
|
|
+ mar = append(mar, map[string][]map[string]interface{}{v: m[v]})
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return mar
|
|
|
+}
|
|
|
+
|
|
|
+//
|
|
|
+func getstype(stype string) string {
|
|
|
+ switch stype {
|
|
|
+ case "招标公告":
|
|
|
+ stype = "招标,邀标,询价,竞谈,单一,竞价,变更,其它"
|
|
|
+ case "招标结果":
|
|
|
+ stype = "中标,成交,废标,流标,结果变更,其它"
|
|
|
+ case "招标信用信息":
|
|
|
+ stype = "合同,验收,违规,其它"
|
|
|
+ case "招标预告":
|
|
|
+ stype = "预告,需求公示,预审,论证意见,预审结果,其它"
|
|
|
+ }
|
|
|
+ if stype == "招标公告其它" || stype == "招标结果其它" || stype == "招标信用信息其它" || stype == "招标预告其它" {
|
|
|
+ stype = "其它"
|
|
|
+ }
|
|
|
+ return stype
|
|
|
+}
|
|
|
+
|
|
|
+//
|
|
|
+func NumberFormat(i int) string {
|
|
|
+ str := strconv.Itoa(i)
|
|
|
+ length := len(str)
|
|
|
+ if length < 4 {
|
|
|
+ return str
|
|
|
+ }
|
|
|
+ arr := strings.Split(str, ".") //用小数点符号分割字符串,为数组接收
|
|
|
+ length1 := len(arr[0])
|
|
|
+ if length1 < 4 {
|
|
|
+ return str
|
|
|
+ }
|
|
|
+ count := (length1 - 1) / 3
|
|
|
+ for i := 0; i < count; i++ {
|
|
|
+ arr[0] = arr[0][:length1-(i+1)*3] + "," + arr[0][length1-(i+1)*3:]
|
|
|
+ }
|
|
|
+ return strings.Join(arr, ".") //将一系列字符串连接为一个字符串,之间用sep来分隔。
|
|
|
+}
|