This commit is contained in:
deepzz0
2016-10-02 19:30:58 +08:00
parent d4e5bf5d89
commit 0f3b3771ee
3 changed files with 7 additions and 7 deletions

View File

@@ -27,14 +27,13 @@ func CommentsCount() {
return return
} }
baseUrl := setting.Conf.Disqus.URL + "?api_key=" + setting.Conf.Disqus.PublicKey + "&forum=" + setting.Conf.Disqus.ShortName + "&" baseUrl := setting.Conf.Disqus.URL + "?api_key=" + setting.Conf.Disqus.PublicKey + "&forum=" + setting.Conf.Disqus.ShortName + "&"
domain := "https://" + runmode.Domain
var count, index int var count, index int
for index < len(Ei.Articles) { for index < len(Ei.Articles) {
logd.Debugf("count=====%d, index=======%d, length=======%d, bool=========%t", count, index, len(Ei.Articles), index < len(Ei.Articles) && count < 10) logd.Debugf("count=====%d, index=======%d, length=======%d, bool=========%t", count, index, len(Ei.Articles), index < len(Ei.Articles) && count < 10)
var threads []string var threads []string
for ; index < len(Ei.Articles) && count < 20; index++ { for ; index < len(Ei.Articles) && count < 20; index++ {
artc := Ei.Articles[index] artc := Ei.Articles[index]
threads = append(threads, fmt.Sprintf("thread=link:%s/post/%s.html", domain, artc.Slug)) threads = append(threads, fmt.Sprintf("thread=link:https://%s/post/%s.html", runmode.Domain, artc.Slug))
count++ count++
} }
count = 0 count = 0

View File

@@ -158,6 +158,7 @@ func HandleSearchPage(c *gin.Context) {
} }
if q != "" { if q != "" {
h["Word"] = q h["Word"] = q
h["HotWord"] = []string{}
var result *ESSearchResult var result *ESSearchResult
vals := c.Request.URL.Query() vals := c.Request.URL.Query()
reg := regexp.MustCompile(`^[a-z]+:\w+$`) reg := regexp.MustCompile(`^[a-z]+:\w+$`)
@@ -188,9 +189,6 @@ func HandleSearchPage(c *gin.Context) {
c.HTML(http.StatusOK, "homeLayout.html", h) c.HTML(http.StatusOK, "homeLayout.html", h)
} }
// 服务端推送谷歌统计
func HandleBeacon(c *gin.Context) {}
func HandleFeed(c *gin.Context) { func HandleFeed(c *gin.Context) {
http.ServeFile(c.Writer, c.Request, "static/feed.xml") http.ServeFile(c.Writer, c.Request, "static/feed.xml")
} }
@@ -207,7 +205,10 @@ func HandleSitemap(c *gin.Context) {
http.ServeFile(c.Writer, c.Request, "static/sitemap.xml") http.ServeFile(c.Writer, c.Request, "static/sitemap.xml")
} }
// 服务端获取评论 // 服务端推送谷歌统计
func HandleBeacon(c *gin.Context) {}
// 服务端获取评论详细
func HandleComments(c *gin.Context) { func HandleComments(c *gin.Context) {
// TODO comments // TODO comments
var ss = map[string]interface{}{ var ss = map[string]interface{}{

View File

@@ -42,7 +42,7 @@ func init() {
} else { } else {
logd.Fatal(err) logd.Fatal(err)
} }
// 测试,开启静态文件 // 开启静态文件
router.Static("/static", "./static") router.Static("/static", "./static")
router.Use(Filter()) router.Use(Filter())
router.NoRoute(HandleNotFound) router.NoRoute(HandleNotFound)