|
@@ -21,7 +21,7 @@ func (s *SwordFish) Swordfish() error {
|
|
s.T["data"] = r
|
|
s.T["data"] = r
|
|
}
|
|
}
|
|
content, _ := s.Render4Cache("/swordfish/index.html", &s.T)
|
|
content, _ := s.Render4Cache("/swordfish/index.html", &s.T)
|
|
- redis.Put("other", "swordfish", string(content), 1000) //缓存半个小时
|
|
|
|
|
|
+ redis.Put("other", "swordfish", string(content), 30*60*1000) //缓存半个小时
|
|
return s.SetBody(content)
|
|
return s.SetBody(content)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -49,22 +49,24 @@ func (s *SwordFish) RssSet() error {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //list := mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
|
|
|
|
- if ret := redis.Get("other", "swordfish_rsset"); ret != nil {
|
|
|
|
- s.T["list"] = ret.([]interface{})
|
|
|
|
- } else {
|
|
|
|
- now := time.Now()
|
|
|
|
- unix := time.Date(now.Year(), now.Month(), now.Day(), now.Hour()-2, now.Minute(), now.Second(), now.Nanosecond(), time.Local).Unix()
|
|
|
|
- r := mongodb.Find("bidding", bson.M{"comeintime": bson.M{"$lte": unix}}, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 5)
|
|
|
|
- if r != nil {
|
|
|
|
- s.T["list"] = *r
|
|
|
|
- }
|
|
|
|
- redis.Put("other", "swordfish_rsset", *r, 1000) //缓存半个小时
|
|
|
|
- }
|
|
|
|
|
|
+ list := getNewest()
|
|
|
|
+ s.T["list"] = list
|
|
s.T["msgset"] = msgset
|
|
s.T["msgset"] = msgset
|
|
return s.Render("/swordfish/rssset.html", &s.T)
|
|
return s.Render("/swordfish/rssset.html", &s.T)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//剑鱼用户协议
|
|
|
|
+func (s *SwordFish) Protocol() error {
|
|
|
|
+ data := getNewest()
|
|
|
|
+ s.T["data"] = data
|
|
|
|
+ return s.Render("/swordfish/protocol.html", &s.T)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//剑鱼用户协议
|
|
|
|
+func (s *SwordFish) Wxprotocol() error {
|
|
|
|
+ return s.Render("/swordfish/protocoltxt.html")
|
|
|
|
+}
|
|
|
|
+
|
|
//跳转到用户中心剑鱼信息列表
|
|
//跳转到用户中心剑鱼信息列表
|
|
func (s *SwordFish) Infolist() error {
|
|
func (s *SwordFish) Infolist() error {
|
|
ms := mongodb.FindById("user", s.GetSession("userId").(string), `{"o_msgset":1}`)
|
|
ms := mongodb.FindById("user", s.GetSession("userId").(string), `{"o_msgset":1}`)
|
|
@@ -146,3 +148,20 @@ func (s *SwordFish) VisitRedirect() {
|
|
s.Redirect(surl)
|
|
s.Redirect(surl)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//剑鱼最新信息列表
|
|
|
|
+func getNewest() (list []interface{}) {
|
|
|
|
+ if ret := redis.Get("other", "swordfish_newest_list"); ret != nil {
|
|
|
|
+ list = ret.([]interface{})
|
|
|
|
+ return list
|
|
|
|
+ } else {
|
|
|
|
+ now := time.Now()
|
|
|
|
+ unix := time.Date(now.Year(), now.Month(), now.Day(), now.Hour()-2, now.Minute(), now.Second(), now.Nanosecond(), time.Local).Unix()
|
|
|
|
+ r := mongodb.Find("bidding", bson.M{"comeintime": bson.M{"$lte": unix}}, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 5)
|
|
|
|
+ redis.Put("other", "swordfish_newest_list", *r, 30*60*1000) //缓存半个小时
|
|
|
|
+ for _, v := range *r {
|
|
|
|
+ list = append(list, v)
|
|
|
|
+ }
|
|
|
|
+ return list
|
|
|
|
+ }
|
|
|
|
+}
|