...
|
...
|
@@ -218,6 +218,27 @@ func (repository *ArticleCommentRepository) IncreaseCountUserLove(ctx context.Co |
|
|
|
|
|
}
|
|
|
|
|
|
// 点赞数量变动
|
|
|
func (repository *ArticleCommentRepository) IncreaseCountReply(ctx context.Context, conn transaction.Conn, incr int, dm *domain.ArticleComment) error {
|
|
|
var (
|
|
|
err error
|
|
|
m *models.ArticleComment
|
|
|
tx = conn.DB()
|
|
|
)
|
|
|
if m, err = repository.DomainModelToModel(dm); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
queryFunc := func() (interface{}, error) {
|
|
|
tx = tx.Model(m).Update("count_reply", gorm.Expr("count_reply+?", incr))
|
|
|
return nil, tx.Error
|
|
|
}
|
|
|
if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
return nil
|
|
|
|
|
|
}
|
|
|
|
|
|
func NewArticleCommentRepository(cache *cache.CachedRepository) domain.ArticleCommentRepository {
|
|
|
return &ArticleCommentRepository{CachedRepository: cache}
|
|
|
} |
...
|
...
|
|