update i18n(template)

This commit is contained in:
shiqstone
2021-04-21 13:37:47 +08:00
parent a92739d4a0
commit 883fcec5b2

View File

@@ -5,6 +5,7 @@ import (
"strings"
"github.com/astaxie/beego/orm"
"github.com/beego/i18n"
"github.com/mindoc-org/mindoc/conf"
"github.com/mindoc-org/mindoc/models"
)
@@ -14,13 +15,13 @@ type TemplateController struct {
BookId int
}
func (c *TemplateController) isPermission() (error) {
func (c *TemplateController) isPermission() error {
c.Prepare()
bookIdentify := c.GetString("identify", "")
if bookIdentify == "" {
return errors.New("参数错误")
return errors.New(i18n.Tr(c.Lang, "message.param_error"))
}
if !c.Member.IsAdministrator() {
@@ -44,6 +45,7 @@ func (c *TemplateController) isPermission() (error) {
}
return nil
}
//获取指定模板信息
func (c *TemplateController) Get() {
if err := c.isPermission(); err != nil {
@@ -100,9 +102,8 @@ func (c *TemplateController) Add() {
}
template := models.NewTemplate()
if templateId > 0 {
t,err := template.Find(templateId);
t, err := template.Find(templateId)
if err != nil {
c.JsonResult(500, "模板不存在")
}
@@ -111,7 +112,6 @@ func (c *TemplateController) Add() {
template.ModifyAt = c.Member.MemberId
}
template.TemplateId = templateId
template.BookId = c.BookId
template.TemplateContent = content