|
@@ -26,7 +26,6 @@ type PcIndex struct {
|
|
|
newSordfish xweb.Mapper `xweb:"/"` //剑鱼标讯pc首页
|
|
|
newSordfishC xweb.Mapper `xweb:"/pcindex.html"` //剑鱼标讯pc首页-统计
|
|
|
searchResult xweb.Mapper `xweb:"/list/(\\w+)/(\\w+).html"` //剑鱼标讯分类 地区结果列表
|
|
|
- labelUrl xweb.Mapper `xweb:"/index/labelUrl"` //首页链接跳转地址
|
|
|
tesa xweb.Mapper `xweb:"/index/tesa"`
|
|
|
}
|
|
|
|
|
@@ -35,9 +34,11 @@ func init() {
|
|
|
}
|
|
|
|
|
|
func (d *PcIndex) Tesa() {
|
|
|
+ typ, _ := d.GetInteger("typ")
|
|
|
// d.WriteBytes([]byte("ok,清除路径:" + "pc/index.html"))
|
|
|
// m := GetNewBlog()
|
|
|
- m := getkeysMap()
|
|
|
+ // m := getstypeMap()
|
|
|
+ m := GetLabUrl(typ)
|
|
|
d.ServeJson(m)
|
|
|
}
|
|
|
|
|
@@ -45,10 +46,14 @@ func (d *PcIndex) Tesa() {
|
|
|
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", "jypcindex")
|
|
|
+ redis.Del("other", pcindexKey)
|
|
|
}
|
|
|
m.T["logid"] = config.Seoconfig["jysy"].(string)
|
|
|
m.T["shareid"] = se.EncodeString(shareid)
|
|
@@ -62,7 +67,7 @@ func (m *PcIndex) NewSordfish() error {
|
|
|
m.T["avatar"] = util.ObjToString(m.GetSession("s_avatar"))
|
|
|
return m.Render("/pc/mobileindex.html", &m.T)
|
|
|
} else {
|
|
|
- if ret := redis.Get("other", "jypcindex"); ret != nil {
|
|
|
+ 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
|
|
@@ -81,7 +86,7 @@ func (m *PcIndex) NewSordfish() error {
|
|
|
m.T["infoNum"] = GetInfoNum()
|
|
|
content, _ := m.Render4Cache("/pc/index.html", &m.T)
|
|
|
timeout := util.IntAllDef(config.Sysconfig["pcindexCacheTime"], 7200)
|
|
|
- redis.Put("other", "jypcindex", string(content), timeout)
|
|
|
+ redis.Put("other", pcindexKey, string(content), timeout)
|
|
|
return m.SetBody(content)
|
|
|
}
|
|
|
}
|
|
@@ -147,10 +152,10 @@ func GetNewArticle(typ int) (list []map[string]interface{}) {
|
|
|
subtype = "预告"
|
|
|
case 3:
|
|
|
//招标公告
|
|
|
- subtype = "招标,邀标,询价,竞谈,单一,竞价,变更,其他"
|
|
|
+ subtype = "招标,邀标,询价,竞谈,单一,竞价,变更,其它"
|
|
|
case 4:
|
|
|
//招标结果
|
|
|
- subtype = "中标,成交,废标,流标"
|
|
|
+ subtype = "中标,成交,废标,流标,其它"
|
|
|
}
|
|
|
if l, ok := redis.Get("other", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
|
|
|
list = util.ObjArrToMapArr(l)
|
|
@@ -201,7 +206,8 @@ func GetLabUrl(typ int) interface{} {
|
|
|
}
|
|
|
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`)
|
|
|
+(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"])
|
|
@@ -219,15 +225,13 @@ func GetLabUrl(typ int) interface{} {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return m
|
|
|
+ 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()
|
|
|
- for _, v := range stypeMap {
|
|
|
- // stypeMap[k] = fmt.Sprintf("/list/stype/%s.html", v)
|
|
|
- for _, vv := range v {
|
|
|
- vv["url"] = fmt.Sprintf("/list/stype/%s.html", vv["url"])
|
|
|
- }
|
|
|
- }
|
|
|
return stypeMap
|
|
|
} else if typ == 3 { //热门招标
|
|
|
keysMap := getkeysMap()
|
|
@@ -236,6 +240,15 @@ func GetLabUrl(typ int) interface{} {
|
|
|
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()
|
|
@@ -292,8 +305,6 @@ func (f *PcIndex) SearchResult(at, name string) error {
|
|
|
}
|
|
|
f.T["logid"] = config.Seoconfig["jybqy"].(string)
|
|
|
if at == "area" {
|
|
|
- // log.Println("config.Seoconfig", config.Seoconfig)
|
|
|
- // log.Println("config.Seoconfig.area", config.Seoconfig["area"])
|
|
|
areamp, _ := config.Seoconfig["area"].(map[string]interface{})
|
|
|
if areamp != nil {
|
|
|
areamp1 := areamp[name].(map[string]interface{})
|
|
@@ -338,25 +349,30 @@ func (f *PcIndex) SearchResult(at, name string) error {
|
|
|
}
|
|
|
}
|
|
|
} else if at == "keywords" {
|
|
|
- keywordsmp, _ := config.Seoconfig["keywords"].(map[string]interface{})
|
|
|
- if keywordsmp != nil {
|
|
|
- keywordsmp1 := keywordsmp[name].(map[string]interface{})
|
|
|
- if keywordsmp1 != nil {
|
|
|
- keywords = keywordsmp1["NAME"].(string)
|
|
|
- seotitle = keywordsmp1["TITLE"].(string)
|
|
|
- seokeywords = keywordsmp1["KEYWORDS"].(string)
|
|
|
- seodescription = keywordsmp1["DESCRIPTION"].(string)
|
|
|
- key_industry = keywordsmp1["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
|
|
|
+ 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
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ log.Println(industry, keywords)
|
|
|
f.T["seoarea"] = area
|
|
|
f.T["seostype"] = stype
|
|
|
f.T["seotitle"] = seotitle
|
|
@@ -412,7 +428,7 @@ func (f *PcIndex) SearchResult(at, name string) error {
|
|
|
*datas = (*datas)[0:limitcount]
|
|
|
}
|
|
|
}
|
|
|
- if len(*datas) > 0 {
|
|
|
+ if len(*datas) > 0 && datas != nil {
|
|
|
for _, v := range *datas {
|
|
|
v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
|
}
|
|
@@ -441,51 +457,6 @@ func (f *PcIndex) SearchResult(at, name string) error {
|
|
|
return f.Render("/pc/classifylist.html", &f.T)
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
-func (p *PcIndex) LabelUrl() {
|
|
|
- typ, _ := p.GetInteger("typ")
|
|
|
- r := func() interface{} {
|
|
|
- if typ == 1 { //地区
|
|
|
- m := map[string][]map[string]interface{}{}
|
|
|
- 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`)
|
|
|
- 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 _, vv := range m {
|
|
|
- for _, vvv := range vv {
|
|
|
- city := util.ObjToString(vvv["city"])
|
|
|
- vvv["url"] = fmt.Sprintf("/list/city/%s.html", cityMap[city])
|
|
|
- }
|
|
|
- }
|
|
|
- return m
|
|
|
- } else if typ == 2 { //信息类型
|
|
|
- stypeMap := getstypeMap()
|
|
|
- for _, v := range stypeMap {
|
|
|
- // stypeMap[k] = fmt.Sprintf("/list/stype/%s.html", v)
|
|
|
- for _, vv := range v {
|
|
|
- vv["url"] = fmt.Sprintf("/list/stype/%s.html", vv["url"])
|
|
|
- }
|
|
|
- }
|
|
|
- return stypeMap
|
|
|
- } else if typ == 3 { //热门招标
|
|
|
- keysMap := getkeysMap()
|
|
|
- return keysMap
|
|
|
- }
|
|
|
- return nil
|
|
|
- }()
|
|
|
- p.ServeJson(map[string]interface{}{
|
|
|
- "data": r,
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
func getCityMap() map[string]interface{} {
|
|
|
m := map[string]interface{}{}
|
|
|
citymp, _ := config.Seoconfig["city"].(map[string]interface{})
|
|
@@ -498,7 +469,7 @@ func getCityMap() map[string]interface{} {
|
|
|
}
|
|
|
return m
|
|
|
}
|
|
|
-func getstypeMap() map[string][]map[string]interface{} {
|
|
|
+func getstypeMap() []map[string][]map[string]interface{} {
|
|
|
m := map[string]interface{}{}
|
|
|
stypemap, _ := config.Seoconfig["stype"].(map[string]interface{})
|
|
|
if stypemap != nil && len(stypemap) > 0 {
|
|
@@ -507,81 +478,98 @@ func getstypeMap() map[string][]map[string]interface{} {
|
|
|
stypename := util.ObjToString(stype["NAME"])
|
|
|
if stypename == "拟建" {
|
|
|
stypename = "拟建项目"
|
|
|
- } else if stypename == "预告" {
|
|
|
- stypename = "招标预告"
|
|
|
}
|
|
|
m[stypename] = k
|
|
|
}
|
|
|
}
|
|
|
- m2 := map[string][]map[string]interface{}{} //结构整理 返给前端
|
|
|
- stype_1reg := regexp.MustCompile(`拟建项目|招标预告|招标公告|招标结果|招标信用信息`)
|
|
|
- notice := regexp.MustCompile(`招标|询价|邀标|竞谈|单一|竞价|变更|其他`) //招标公告
|
|
|
- result := regexp.MustCompile(`中标|成交|废标|流标`) //招标结果
|
|
|
- credit := regexp.MustCompile(`合同|验收|违规`) //招标信用信息
|
|
|
- for k, v := range m {
|
|
|
- if stype_1reg.MatchString(k) {
|
|
|
- m2[k] = append(m2[k], map[string]interface{}{
|
|
|
- "key": k,
|
|
|
- "url": v,
|
|
|
- })
|
|
|
- } else if notice.MatchString(k) {
|
|
|
- m2["招标公告"] = append(m2["招标公告"], map[string]interface{}{
|
|
|
- "key": k,
|
|
|
- "url": v,
|
|
|
- })
|
|
|
- } else if result.MatchString(k) {
|
|
|
- m2["招标结果"] = append(m2["招标结果"], map[string]interface{}{
|
|
|
- "key": k,
|
|
|
- "url": v,
|
|
|
- })
|
|
|
- } else if credit.MatchString(k) {
|
|
|
- m2["招标信用信息"] = append(m2["招标信用信息"], map[string]interface{}{
|
|
|
- "key": k,
|
|
|
- "url": v,
|
|
|
- })
|
|
|
+ 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 getkeysMap() map[string][]map[string]interface{} {
|
|
|
+//给前端格式化数据结构
|
|
|
+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{}{}, ""
|
|
|
- keymap, _ := config.Seoconfig["keywords"].(map[string]interface{})
|
|
|
+ sortArr := util.ObjArrToStringArr(config.Seoconfig["hotlabkeywordsSort"].([]interface{}))
|
|
|
+ keymap, _ := config.Seoconfig["keywordsArr"].([]interface{})
|
|
|
//
|
|
|
industrymp, _ := config.Seoconfig["industry"].(map[string]interface{})
|
|
|
- log.Println(industrymp)
|
|
|
- if keymap != nil && len(keymap) > 0 {
|
|
|
- for k, v := range keymap {
|
|
|
+ if len(keymap) > 0 {
|
|
|
+ for _, v := range keymap {
|
|
|
keys := v.(map[string]interface{})
|
|
|
- keysname := util.ObjToString(keys["NAME"])
|
|
|
- key_industry := util.ObjToString(keys["INDUSTRY"])
|
|
|
- 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]
|
|
|
+ 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),
|
|
|
+ })
|
|
|
}
|
|
|
- m[industry] = append(m[industry], map[string]interface{}{
|
|
|
- "key": keysname,
|
|
|
- "url": fmt.Sprintf("/list/keywords/%s.html", k),
|
|
|
- })
|
|
|
+ }
|
|
|
+ for _, v := range sortArr {
|
|
|
+ mar = append(mar, map[string][]map[string]interface{}{v: m[v]})
|
|
|
}
|
|
|
}
|
|
|
- return m
|
|
|
+
|
|
|
+ return mar
|
|
|
}
|
|
|
|
|
|
//
|
|
|
func getstype(stype string) string {
|
|
|
switch stype {
|
|
|
case "招标公告":
|
|
|
- stype = "招标,邀标,询价,竞谈,单一,竞价,变更,其他"
|
|
|
+ stype = "招标,邀标,询价,竞谈,单一,竞价,变更,其它"
|
|
|
case "招标结果":
|
|
|
- stype = "中标,成交,废标,流标"
|
|
|
+ stype = "中标,成交,废标,流标,结果变更,其它"
|
|
|
case "招标信用信息":
|
|
|
- stype = "合同,验收,违规"
|
|
|
+ stype = "合同,验收,违规,其它"
|
|
|
+ case "招标预告":
|
|
|
+ stype = "预告,需求公示,预审,论证意见,预审结果,其它"
|
|
|
+ }
|
|
|
+ if stype == "招标公告其它" || stype == "招标结果其它" || stype == "招标信用信息其它" || stype == "招标预告其它" {
|
|
|
+ stype = "其它"
|
|
|
}
|
|
|
return stype
|
|
|
}
|
|
@@ -602,5 +590,5 @@ func NumberFormat(i int) string {
|
|
|
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来分隔。
|
|
|
+ return strings.Join(arr, ".") //将一系列字符串连接为一个字符串,之间用sep来分隔。
|
|
|
}
|