🎨 优化文章和支付回调,新增返回分享用接口

This commit is contained in:
2025-10-08 16:41:50 +08:00
parent f0ea189553
commit d593476c51
9 changed files with 94 additions and 83 deletions

View File

@@ -125,6 +125,19 @@ func (s ArticleService) APPGetArticle(id string, userId int) (article *vo.Articl
global.GVA_DB.Table("app_user").Select("avatar").Where("id = ?", article.TeacherId).Scan(&article.TeacherAvatar)
// 判断用户是否为SVIP
if userId != 0 {
var userInfo user.User
err = global.GVA_DB.Model(&user.User{}).Where("id = ?", userId).First(&userInfo).Error
if err != nil {
global.GVA_LOG.Error("查询用户信息失败", zap.Error(err))
return nil, err
}
if userInfo.IsVip == 1 && userInfo.UserLabel == 3 {
return article, nil
}
}
// 判断是否免费
if article.IsFree == 0 {
// 如果不是免费文章,判断用户是否购买过