feat:完善项目信息

This commit is contained in:
henry
2021-12-24 15:28:46 +08:00
parent f654b0a4f0
commit b506378003
9 changed files with 241 additions and 15 deletions

View File

@ -37,7 +37,7 @@ type (
Ext string `json:"ext" form:"ext" binding:"required"` // 格式
Author string `json:"author" form:"author" binding:"required"` // 作者
PublishAt string `json:"publish_at" form:"publish_at" binding:"required"` // 出版日期
Keyword string `json:"keyword" form:"keyword"` // 关键词
Keywords []string `json:"keywords" form:"keywords"` // 关键词
Tags []string `json:"tags" form:"tags"` // 标签
Remark string `json:"remark" form:"remark"` // 备注
}
@ -248,7 +248,7 @@ func (a *Technology) PaperAdd(c *gin.Context) {
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.PaperParams{
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
Keywords: form.Keywords, Tags: form.Tags, Remark: form.Remark,
})
api.APIResponse(err)(c)
}
@ -265,7 +265,7 @@ func (a *Technology) PaperEdit(c *gin.Context) {
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.PaperParams{
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
Keywords: form.Keywords, Tags: form.Tags, Remark: form.Remark,
})
api.APIResponse(err)(c)
}

View File

@ -25,9 +25,9 @@ type (
Tags []string `json:"tags"`
}
PaperParams struct {
ID uint64
Title, Ext, Author, PublishAt, Keyword, Remark string
Tags []string
ID uint64
Title, Ext, Author, PublishAt, Remark string
Keywords, Tags []string
}
)
@ -77,7 +77,7 @@ func (c *Paper) Form(params *PaperParams) error {
mTechnologyPaper.Ext = params.Ext
mTechnologyPaper.Author = params.Author
mTechnologyPaper.PublishAt = utils.DateTimeToTime(params.PublishAt)
mTechnologyPaper.Keyword = params.Keyword
mTechnologyPaper.SetKeywordAttribute(params.Keywords)
mTechnologyPaper.SetTagAttribute(params.Tags)
mTechnologyPaper.Remark = params.Remark