diff --git a/api.go b/api.go index a107aba..eb72157 100644 --- a/api.go +++ b/api.go @@ -46,6 +46,8 @@ func init() { APIs["trash-delete"] = apiTrashDelete // 恢复回收箱 APIs["trash-recover"] = apiTrashRecover + // 上传文件 + APIs["file-upload"] = apiFileUpload } func apiAccount(c *gin.Context) { @@ -389,6 +391,10 @@ func apiTrashRecover(c *gin.Context) { responseNotice(c, NOTICE_SUCCESS, "恢复成功", "") } +func apiFileUpload(c *gin.Context) { + +} + func responseNotice(c *gin.Context, typ, content, hl string) { if hl != "" { c.SetCookie("notice_highlight", hl, 86400, "/", "", true, false) diff --git a/back.go b/back.go index b171c5e..ff9352c 100644 --- a/back.go +++ b/back.go @@ -97,15 +97,18 @@ type T struct { func HandlePost(c *gin.Context) { h := GetBack() id, err := strconv.Atoi(c.Query("cid")) - if artc := QueryArticle(int32(id)); err == nil && id > 0 && artc != nil { - h["Title"] = "编辑文章 | " + Ei.BTitle - h["Edit"] = artc - } else { + if err == nil && id > 0 { + artc := QueryArticle(int32(id)) + if artc != nil { + h["Title"] = "编辑文章 | " + Ei.BTitle + h["Edit"] = artc + } + } + if h["Title"] == "" { h["Title"] = "撰写文章 | " + Ei.BTitle } h["Post"] = true h["Path"] = c.Request.URL.Path - h["Title"] = "撰写文章 | " + Ei.BTitle h["Domain"] = setting.Conf.Mode.Domain h["Series"] = Ei.Series var tags []T @@ -126,7 +129,7 @@ func HandleDraftDelete(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"error": "删除错误"}) return } - c.JSON(http.StatusOK, nil) + c.Redirect(http.StatusFound, "/admin/write-post") } // 文章管理==>Manage diff --git a/static/admin/Moxie.swf b/static/admin/Moxie.swf new file mode 100644 index 0000000..e477cf9 Binary files /dev/null and b/static/admin/Moxie.swf differ diff --git a/views/admin/post.html b/views/admin/post.html index 7980744..810fc25 100644 --- a/views/admin/post.html +++ b/views/admin/post.html @@ -1,13 +1,12 @@ {{define "admin-post"}}