新增了返回video_author字段。
This commit is contained in:
@@ -142,6 +142,11 @@ func (r *Article) PutArticle(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.VoteNum < 0 {
|
||||
responses.FailWithMessage("票数需大于0", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取订单数据
|
||||
articleDao := dao.ArticleDao{}
|
||||
article, err := articleDao.GetArticleById(articleId)
|
||||
@@ -176,6 +181,11 @@ func (r *Article) PutArticle(c *gin.Context) {
|
||||
articleData["article_content"] = req.ArticleContent
|
||||
}
|
||||
|
||||
// 票数
|
||||
if article.VoteNum != req.VoteNum {
|
||||
articleData["vote_num"] = req.VoteNum
|
||||
}
|
||||
|
||||
// 修改
|
||||
if len(articleData) > 0 {
|
||||
err = articleDao.EditArticleById(tx, articleId, articleData)
|
||||
@@ -259,6 +269,11 @@ func (r *Article) AddArticle(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.VoteNum < 0 {
|
||||
responses.FailWithMessage("票数需大于0", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
@@ -272,7 +287,7 @@ func (r *Article) AddArticle(c *gin.Context) {
|
||||
article := &model.Article{
|
||||
ArticleTitle: req.ArticleTitle,
|
||||
ArticleStatus: req.ArticleStatus,
|
||||
VoteNum: 0,
|
||||
VoteNum: req.VoteNum,
|
||||
ArticleContent: req.ArticleContent,
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,11 @@ func (r *Video) PutVideo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.VoteNum < 0 {
|
||||
responses.FailWithMessage("票数需大于0", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取订单数据
|
||||
videoDao := dao.VideoDao{}
|
||||
video, err := videoDao.GetVideoById(videoId)
|
||||
@@ -269,6 +274,11 @@ func (r *Video) AddVideo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.VoteNum < 0 {
|
||||
responses.FailWithMessage("票数需大于0", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user