diff --git a/controllers/BookController.go b/controllers/BookController.go index 83911dee..2a05c8ed 100644 --- a/controllers/BookController.go +++ b/controllers/BookController.go @@ -173,7 +173,7 @@ func (c *BookController) SaveBook() { book.Editor = editor book.HistoryCount = historyCount book.IsDownload = 0 - book.BookPassword = c.GetString("bPassword") + book.BookPassword = strings.TrimSpace(c.GetString("bPassword")) book.ItemId = itemId if autoRelease { diff --git a/controllers/ManagerController.go b/controllers/ManagerController.go index a9d2a3d7..77d7e8a1 100644 --- a/controllers/ManagerController.go +++ b/controllers/ManagerController.go @@ -340,6 +340,7 @@ func (c *ManagerController) EditBook() { autoRelease := strings.TrimSpace(c.GetString("auto_release")) == "on" publisher := strings.TrimSpace(c.GetString("publisher")) historyCount, _ := c.GetInt("history_count", 0) + itemId,_ := c.GetInt("itemId") if strings.Count(description, "") > 500 { c.JsonResult(6004, "项目描述不能大于500字") @@ -353,6 +354,9 @@ func (c *ManagerController) EditBook() { c.JsonResult(6005, "最多允许添加10个标签") } } + if !models.NewItemsets().Exist(itemId) { + c.JsonResult(6006,"项目集不存在") + } book.Publisher = publisher book.HistoryCount = historyCount book.BookName = bookName @@ -360,6 +364,8 @@ func (c *ManagerController) EditBook() { book.CommentStatus = commentStatus book.Label = tag book.OrderIndex = orderIndex + book.ItemId = itemId + book.BookPassword = strings.TrimSpace(c.GetString("bPassword")) if autoRelease { book.AutoRelease = 1 @@ -1124,8 +1130,8 @@ func (c *ManagerController) Itemsets() { func (c *ManagerController) ItemsetsEdit() { c.Prepare() itemId, _ := c.GetInt("itemId") - itemName := c.GetString("itemName") - itemKey := c.GetString("itemKey") + itemName := strings.TrimSpace(c.GetString("itemName")) + itemKey := strings.TrimSpace(c.GetString("itemKey")) if itemName == "" || itemKey == "" { c.JsonResult(5001, "参数错误") } diff --git a/views/manager/edit_book.tpl b/views/manager/edit_book.tpl index df1845d5..29d144c4 100644 --- a/views/manager/edit_book.tpl +++ b/views/manager/edit_book.tpl @@ -14,6 +14,7 @@ + @@ -47,6 +48,12 @@ +
+ + +
@@ -73,23 +80,6 @@

最多允许添加10个标签,多个标签请用“;”分割

- {{/*{*
*} - {**} - {*
*} - {**} - {**} - {**} - {**} - {*
*} - {*
*} */}} {{if eq .Model.PrivatelyOwned 1}}
@@ -103,6 +93,11 @@
+
+ + +

没有访问权限访问项目时需要提供的密码

+
{{end}}
@@ -250,6 +245,8 @@ + +