fmt all go file

This commit is contained in:
lealife
2015-11-13 17:58:41 +08:00
parent cba69444a8
commit 7809d00787
100 changed files with 3375 additions and 3331 deletions

View File

@ -57,9 +57,9 @@ func (c Blog) render(templateName string, themePath string) revel.Result {
isPreview = true
themePath = themePath2.(string)
c.setPreviewUrl()
// 因为common的themeInfo是从UserBlog.ThemeId来取的, 所以这里要fugai下
c.RenderArgs["themeInfo"] = c.RenderArgs["themeInfoPreview"];
c.RenderArgs["themeInfo"] = c.RenderArgs["themeInfoPreview"]
}
return blog.RenderTemplate(templateName, c.RenderArgs, revel.BasePath+"/"+themePath, isPreview)
}
@ -119,9 +119,9 @@ func (c Blog) setPreviewUrl() {
indexUrl = blogUrl + "/" + userIdOrEmail
cateUrl = blogUrl + "/cate/" + userIdOrEmail // /notebookId
postUrl = blogUrl + "/post/" + userIdOrEmail // /xxxxx
postUrl = blogUrl + "/post/" + userIdOrEmail // /xxxxx
searchUrl = blogUrl + "/search/" + userIdOrEmail // blog.leanote.com/search/userId
singleUrl = blogUrl + "/single/" + userIdOrEmail // blog.leanote.com/single/singleId
singleUrl = blogUrl + "/single/" + userIdOrEmail // blog.leanote.com/single/singleId
archiveUrl = blogUrl + "/archives/" + userIdOrEmail // blog.leanote.com/archive/userId
tagsUrl = blogUrl + "/tags/" + userIdOrEmail // blog.leanote.com/archive/userId
@ -220,7 +220,7 @@ func (c Blog) getCates(userBlog info.UserBlog) {
}
}
}
// 之后添加没有排序的
for _, n := range notebooks {
id := n.NotebookId.Hex()
@ -234,19 +234,19 @@ func (c Blog) getCates(userBlog info.UserBlog) {
i++
}
}
// LogJ(">>")
// LogJ(cates)
// LogJ(">>")
// LogJ(cates)
// 建立层级
hasParent := map[string]bool{} // 有父的cate
for _, cate := range cates {
parentCateId := cate.ParentCateId
if parentCateId != "" {
if parentCate, ok := cateMap[parentCateId]; ok {
// Log("________")
// LogJ(parentCate)
// LogJ(cate)
// Log("________")
// LogJ(parentCate)
// LogJ(cate)
if parentCate.Children == nil {
parentCate.Children = []*info.Cate{cate}
} else {
@ -256,7 +256,7 @@ func (c Blog) getCates(userBlog info.UserBlog) {
}
}
}
// 得到没有父的cate, 作为第一级cate
catesTree := []*info.Cate{}
for _, cate := range cates {
@ -264,7 +264,7 @@ func (c Blog) getCates(userBlog info.UserBlog) {
catesTree = append(catesTree, cate)
}
}
c.RenderArgs["cates"] = cates
c.RenderArgs["catesTree"] = catesTree
}
@ -348,10 +348,10 @@ func (c Blog) blogCommon(userId string, userBlog info.UserBlog, userInfo info.Us
// 得到主题信息
themeInfo := themeService.GetThemeInfo(userBlog.ThemeId.Hex(), userBlog.Style)
c.RenderArgs["themeInfo"] = themeInfo
// Log(">>")
// Log(userBlog.Style)
// Log(userBlog.ThemeId.Hex())
// Log(">>")
// Log(userBlog.Style)
// Log(userBlog.ThemeId.Hex())
return true, userBlog
}
@ -507,6 +507,7 @@ func (c Blog) Archives(userIdOrEmail string, cateId string, year, month int) (re
// 进入某个用户的博客
var blogPageSize = 5
var searchBlogPageSize = 30
// 分类 /cate/xxxxxxxx?notebookId=1212
func (c Blog) Cate(userIdOrEmail string, notebookId string) (re revel.Result) {
// 自定义域名
@ -833,7 +834,7 @@ func (c Blog) GetComments(noteId string, callback string) revel.Result {
result["comments"] = comments
result["commentUserInfo"] = commentUserInfo
re.Item = result
if callback != "" {
return c.RenderJsonP(callback, result)
}