fix v13
This commit is contained in:
@@ -621,7 +621,12 @@ func (db *users) GetShowInHome(ctx context.Context, page, pageSize int, sort str
|
||||
var users []*User
|
||||
var count int64
|
||||
|
||||
if err := db.WithContext(ctx).Model(&User{}).Where("show_in_home = ?", true).Count(&count).Error; err != nil {
|
||||
// 计数必须与下面的列表用同一套过滤,否则总数包含被处置箱主、实际行数更少,
|
||||
// 首页会出现「最后一页空白」。
|
||||
if err := db.WithContext(ctx).Model(&User{}).
|
||||
Where("show_in_home = ?", true).
|
||||
Where("id NOT IN (?)", activeRestrictionsSubQuery(db.WithContext(ctx))).
|
||||
Count(&count).Error; err != nil {
|
||||
return nil, 0, errors.Wrap(err, "count show in home users")
|
||||
}
|
||||
|
||||
@@ -798,6 +803,8 @@ func (db *users) GetHotTags(ctx context.Context, limit int) ([]string, error) {
|
||||
if err := db.WithContext(ctx).
|
||||
Model(&User{}).
|
||||
Where("show_in_home = ? AND tags IS NOT NULL AND tags != ''", true).
|
||||
// 被处置箱主的标签不应再被推荐(热门标签是个显眼的曝光位)。
|
||||
Where("id NOT IN (?)", activeRestrictionsSubQuery(db.WithContext(ctx))).
|
||||
Pluck("tags", &tagsList).Error; err != nil {
|
||||
return nil, errors.Wrap(err, "get user tags for hot tags")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user