feat:1、实现文档自动保存

2、实现记住上次打开的文档,当文档编辑时会自动定位到上次打开的文档。
This commit is contained in:
lifei6671
2018-08-17 17:33:45 +08:00
parent cd61aa14db
commit bb7d1c1503
12 changed files with 245 additions and 123 deletions

View File

@@ -144,6 +144,7 @@ func (c *BookController) SaveBook() {
isDownload := strings.TrimSpace(c.GetString("is_download")) == "on"
enableShare := strings.TrimSpace(c.GetString("enable_share")) == "on"
isUseFirstDocument := strings.TrimSpace(c.GetString("is_use_first_document")) == "on"
autoSave := strings.TrimSpace(c.GetString("auto_save")) == "on"
if strings.Count(description, "") > 500 {
c.JsonResult(6004, "项目描述不能大于500字")
@@ -170,6 +171,7 @@ func (c *BookController) SaveBook() {
book.HistoryCount = historyCount
book.IsDownload = 0
if autoRelease {
book.AutoRelease = 1
} else {
@@ -190,6 +192,11 @@ func (c *BookController) SaveBook() {
} else {
book.IsUseFirstDocument = 0
}
if autoSave {
book.AutoSave = 1
}else{
book.AutoSave = 0
}
if err := book.Update(); err != nil {
c.JsonResult(6006, "保存失败")
}