fix 修复list报错

This commit is contained in:
timerzz 2024-08-26 17:51:14 +08:00
parent c2ccb721a7
commit 9b831ac7d7
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ func (a *articleApi) Find(query FindArticleQuery) (articles []v2.Article, err er
} }
func (a *articleApi) List(query PageListQuery) (articles []v2.Article, total int64, err error) { func (a *articleApi) List(query PageListQuery) (articles []v2.Article, total int64, err error) {
err = a.db.Scopes(query.Scoper.Scope).Count(&total).Error err = a.db.Scopes(query.Scoper.Scope).Model(&v2.Article{}).Count(&total).Error
if err != nil { if err != nil {
return return
} }

View File

@ -53,7 +53,7 @@ func (p *providerApi) Get(id uint) (provider v2.Provider, err error) {
} }
func (p *providerApi) List(query PageListQuery) (providers []v2.Provider, total int64, err error) { func (p *providerApi) List(query PageListQuery) (providers []v2.Provider, total int64, err error) {
err = p.db.Scopes(query.Scoper.Scope).Count(&total).Error err = p.db.Scopes(query.Scoper.Scope).Model(&v2.Provider{}).Count(&total).Error
if err != nil { if err != nil {
return return
} }