|
@@ -34,8 +34,10 @@ func init() {
|
|
|
xweb.AddAction(&PcIndex{})
|
|
|
}
|
|
|
|
|
|
-func (a *PcIndex) Tesa() {
|
|
|
- GetNewArticle(4)
|
|
|
+func (d *PcIndex) Tesa() {
|
|
|
+ d.WriteBytes([]byte("ok,清除路径:" + "pc/index.html"))
|
|
|
+ // m := GetLabUrl(1)
|
|
|
+ // d.ServeJson(m)
|
|
|
}
|
|
|
|
|
|
//剑鱼标讯pc首页
|
|
@@ -59,27 +61,27 @@ 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 {
|
|
|
- // 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热门招标
|
|
|
+ if ret := redis.Get("other", "jypcindex"); 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)
|
|
|
+ redis.Put("other", "jypcindex", string(content), 60*60*2)
|
|
|
+ return m.SetBody(content)
|
|
|
}
|
|
|
- //信息条数(上线以来..)
|
|
|
- m.T["infoNum"] = GetInfoNum()
|
|
|
- content, _ := m.Render4Cache("/pc/index.html", &m.T)
|
|
|
- //redis.Put("other", "jypcindex", string(content), 60*60*2)
|
|
|
- return m.SetBody(content)
|
|
|
- // }
|
|
|
}
|
|
|
return m.Render("/pc/index.html", &m.T)
|
|
|
}
|
|
@@ -175,7 +177,25 @@ func GetNewArticle(typ int) (list []map[string]interface{}) {
|
|
|
//前端跳转地址
|
|
|
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`)
|
|
@@ -188,10 +208,12 @@ func GetLabUrl(typ int) interface{} {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- for _, vv := range m {
|
|
|
+ for kk, vv := range m {
|
|
|
for _, vvv := range vv {
|
|
|
city := util.ObjToString(vvv["city"])
|
|
|
- vvv["url"] = fmt.Sprintf("/list/city/%s.html", cityMap[city])
|
|
|
+ if kk != city {
|
|
|
+ vvv["url"] = fmt.Sprintf("/list/city/%s.html", cityMap[city])
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return m
|