From 9b0c6497387b71f5eff3cf0d2634fdff0ffc558d Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Tue, 20 Nov 2018 20:55:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=AF=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E9=9B=86?= =?UTF-8?q?=E5=92=8C=E9=A1=B9=E7=9B=AE=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/BookController.go | 2 +- controllers/ManagerController.go | 10 ++++-- views/manager/edit_book.tpl | 53 ++++++++++++++++++++++---------- 3 files changed, 45 insertions(+), 20 deletions(-) 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 @@ + +