diff --git a/config.yaml b/config.yaml index 8e1b289..cff649e 100644 --- a/config.yaml +++ b/config.yaml @@ -249,13 +249,13 @@ wechat: pay-list: - type: wxpay alias-name: wxpay-1 - app-id: 1 - mch-id: 1 + app-id: wx3d21df18d7f8f9fc + mch-id: 1646874753 v3-key: 1a3sd8561d5179Df152D4789aD38wG9s - cert-path: 1 - key-path: 1 - notify-url: 1 - serial-no: 1 + cert-path: /resource/cert/apiclient_cert.pem + key-path: /resource/cert/apiclient_key.pem + notify-url: http://lckt.hnlc5588.cn/app_order/notify + serial-no: 59A891FB403EC7A1CF2090DB9C8EC704BD43B101 - type: wxpay2 alias-name: wxpay-2 app-id: 2 diff --git a/router/app/enter.go b/router/app/enter.go index 95833ca..dcb1770 100644 --- a/router/app/enter.go +++ b/router/app/enter.go @@ -5,7 +5,9 @@ import api "git.echol.cn/loser/lckt/api/v1" type RouterGroup struct { UserRouter BannerRouter + OrderRouter } var userApi = api.ApiGroupApp.AppApiGroup.AppUserApi var bannerApi = api.ApiGroupApp.AppApiGroup.BannerApi +var orderApi = api.ApiGroupApp.AppApiGroup.OrderApi diff --git a/service/article/article.go b/service/article/article.go index 9b2aed0..23cbc00 100644 --- a/service/article/article.go +++ b/service/article/article.go @@ -75,13 +75,13 @@ func (s ArticleService) APPGetArticleList(pageInfo request.GetList) (list []vo.A return } -func (s ArticleService) APPGetArticle(id string, userId uint) (article vo.ArticleVo, err error) { +func (s ArticleService) APPGetArticle(id string, userId uint) (article *vo.ArticleVo, err error) { err = global.GVA_DB.Table("article").Where("id = ?", id).First(&article).Error if err != nil { global.GVA_LOG.Error("获取文章失败", zap.Error(err)) return } - article.IsBuy = 1 // 设置为已购买 + article.IsBuy = 1 global.GVA_DB.Table("app_user").Select("avatar").Where("id = ?", article.TeacherId).Scan(&article.TeacherAvatar) @@ -89,10 +89,10 @@ func (s ArticleService) APPGetArticle(id string, userId uint) (article vo.Articl if article.IsFree == 0 { // 如果不是免费文章,判断用户是否购买过 var count int64 - err = global.GVA_DB.Model(&app.Order{}).Where("article_id = ? AND user_id = ?", id, userId).Count(&count).Error + err = global.GVA_DB.Model(&app.Order{}).Where("article_id = ? AND user_id = ? AND status = 2", id, userId).Count(&count).Error if err != nil { global.GVA_LOG.Error("查询用户购买记录失败", zap.Error(err)) - return + return nil, err } if count == 0 { // 用户没有购买过,隐藏Content