1、实现自定义富文本编辑器

2、实现自动发布
This commit is contained in:
Minho
2018-01-19 20:10:54 +08:00
parent 5e19ec8550
commit b62de4ba5e
65 changed files with 21877 additions and 23 deletions

View File

@@ -129,6 +129,7 @@ func (c *BookController) SaveBook() {
comment_status := c.GetString("comment_status")
tag := strings.TrimSpace(c.GetString("label"))
editor := strings.TrimSpace(c.GetString("editor"))
auto_release := strings.TrimSpace(c.GetString("auto_release")) == "on"
if strings.Count(description,"") > 500 {
c.JsonResult(6004,"项目描述不能大于500字")
@@ -149,8 +150,14 @@ func (c *BookController) SaveBook() {
book.BookName = book_name
book.Description = description
book.CommentStatus = comment_status
book.Label = tag
book.Label = tag
book.Editor = editor
if auto_release {
book.AutoRelease = 1
}else{
book.AutoRelease = 0
}
if err := book.Update();err != nil {
c.JsonResult(6006,"保存失败")

View File

@@ -301,7 +301,7 @@ func (c *DocumentController) Edit() {
if bookResult.Editor == "markdown" {
c.TplName = "document/markdown_edit_template.tpl"
} else if bookResult.Editor == "html" {
c.TplName = "document/html_edit_template.tpl"
c.TplName = "document/new_html_edit_template.tpl"
} else {
c.TplName = "document/" + bookResult.Editor + "_edit_template.tpl"
}
@@ -739,6 +739,7 @@ func (c *DocumentController) Content() {
}
book_id := 0
auto_release := false
// 如果是超级管理员,则忽略权限
if c.Member.IsAdministrator() {
@@ -748,6 +749,7 @@ func (c *DocumentController) Content() {
}
book_id = book.BookId
auto_release = book.AutoRelease == 1
} else {
bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId)
@@ -757,6 +759,7 @@ func (c *DocumentController) Content() {
}
book_id = bookResult.BookId
auto_release = bookResult.AutoRelease
}
if doc_id <= 0 {
@@ -817,7 +820,7 @@ func (c *DocumentController) Content() {
beego.Error("DocumentHistory InsertOrUpdate => ", err)
}
}
if beego.AppConfig.DefaultBool("auto_release", false) {
if auto_release {
go func(identify string) {
models.NewDocument().ReleaseContent(book_id)