v1.0
只读模式 group, 分享 评论更多问题 博客标签总是存在一个
This commit is contained in:
1 parent
7e458bb433
commit
6987a38820
1453 files changed
+114558
-91533
No files matched your search
@@ -824,7 +824,7 @@ func (c Blog) LikePost(noteId string, callback string) revel.Result {
|
||||
re.Ok, re.Item = blogService.LikeBlog(noteId, userId)
|
||||
return c.RenderJsonP(callback, re)
|
||||
}
|
||||
func (c Blog) GetComments(noteId string) revel.Result {
|
||||
func (c Blog) GetComments(noteId string, callback string) revel.Result {
|
||||
// 评论
|
||||
userId := c.GetUserId()
|
||||
page := c.GetPage()
|
||||
@@ -836,6 +836,10 @@ func (c Blog) GetComments(noteId string) revel.Result {
|
||||
result["comments"] = comments
|
||||
result["commentUserInfo"] = commentUserInfo
|
||||
re.Item = result
|
||||
|
||||
if callback != "" {
|
||||
return c.RenderJsonP(callback, result)
|
||||
}
|
||||
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
@@ -49,10 +49,11 @@ func (c Note) Index(noteId string) revel.Result {
|
||||
hasRightNoteId := false
|
||||
if IsObjectId(noteId) {
|
||||
note := noteService.GetNoteById(noteId)
|
||||
var noteOwner = note.UserId.Hex()
|
||||
noteContent = noteService.GetNoteContent(noteId, noteOwner)
|
||||
|
||||
if note.NoteId != "" {
|
||||
var noteOwner = note.UserId.Hex()
|
||||
noteContent = noteService.GetNoteContent(noteId, noteOwner)
|
||||
|
||||
hasRightNoteId = true
|
||||
c.RenderArgs["curNoteId"] = noteId
|
||||
c.RenderArgs["curNotebookId"] = note.NotebookId.Hex()
|
||||
|
||||
@@ -335,8 +335,12 @@ func (c ApiNote) AddNote(noteOrContent info.ApiNote) revel.Result {
|
||||
Abstract: noteOrContent.Abstract}
|
||||
|
||||
// 通过内容得到Desc, abstract
|
||||
note.Desc = SubStringHTMLToRaw(noteContent.Content, 50)
|
||||
noteContent.Abstract = SubStringHTML(noteContent.Content, 200, "")
|
||||
if noteOrContent.Abstract == "" {
|
||||
note.Desc = SubStringHTMLToRaw(noteContent.Content, 200)
|
||||
noteContent.Abstract = SubStringHTML(noteContent.Content, 200, "")
|
||||
} else {
|
||||
note.Desc = SubStringHTMLToRaw(noteContent.Abstract, 200)
|
||||
}
|
||||
|
||||
note = noteService.AddNoteAndContentApi(note, noteContent, myUserId)
|
||||
|
||||
@@ -352,7 +356,7 @@ func (c ApiNote) AddNote(noteOrContent info.ApiNote) revel.Result {
|
||||
noteOrContent.UpdatedTime = note.UpdatedTime
|
||||
noteOrContent.UserId = c.getUserId()
|
||||
noteOrContent.IsMarkdown = note.IsMarkdown
|
||||
// 删除一些不要返回的
|
||||
// 删除一些不要返回的, 删除Desc?
|
||||
noteOrContent.Content = ""
|
||||
noteOrContent.Abstract = ""
|
||||
// apiNote := info.NoteToApiNote(note, noteOrContent.Files)
|
||||
@@ -494,8 +498,12 @@ func (c ApiNote) UpdateNote(noteOrContent info.ApiNote) revel.Result {
|
||||
}
|
||||
|
||||
if c.Has("Content") {
|
||||
// 通过内容得到Desc, abstract
|
||||
noteUpdate["Desc"] = SubStringHTMLToRaw(noteOrContent.Content, 50)
|
||||
// 通过内容得到Desc, 如果有Abstract, 则用Abstract生成Desc
|
||||
if noteOrContent.Abstract == "" {
|
||||
noteUpdate["Desc"] = SubStringHTMLToRaw(noteOrContent.Content, 200)
|
||||
} else {
|
||||
noteUpdate["Desc"] = SubStringHTMLToRaw(noteOrContent.Abstract, 200)
|
||||
}
|
||||
}
|
||||
|
||||
afterNoteUsn := 0
|
||||
@@ -570,4 +578,4 @@ func (c ApiNote) GetHistories(noteId string) revel.Result {
|
||||
}
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
*/
|
||||
*/
|
||||
@@ -460,7 +460,7 @@ func (c MemberBlog) ImportTheme() revel.Result {
|
||||
var ext string
|
||||
_, ext = SplitFilename(filename)
|
||||
if ext != ".zip" {
|
||||
re.Msg = "请上传zip文件"
|
||||
re.Msg = "Please upload zip file"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ func (c MemberBlog) ImportTheme() revel.Result {
|
||||
|
||||
// > 10M?
|
||||
if len(data) > 10*1024*1024 {
|
||||
re.Msg = "文件大于10M"
|
||||
re.Msg = "File is big than 10M"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user