🎨 修改文章获取接口
This commit is contained in:
parent
28055e99c9
commit
cb7bce5cef
@ -36,11 +36,14 @@ func (a ArticleService) GetArticleById(id, userId string) (article *common.Artic
|
||||
err = global.GVA_DB.Where("id = ?", id).First(&article).Error
|
||||
err = global.GVA_DB.Table("articles").Where("id = ?", id).Update("reading_num", gorm.Expr("reading_num + ?", 1)).Error
|
||||
|
||||
if userId != "" {
|
||||
// 判断是否收藏
|
||||
var favorite app.Favorite
|
||||
err = global.GVA_DB.Where("wz_id = ? AND user_id = ?", id, userId).First(&favorite).Error
|
||||
global.GVA_DB.Where("wz_id = ? AND user_id = ?", id, userId).First(&favorite)
|
||||
if favorite.ID != 0 {
|
||||
article.IsFavorite = 1
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user