作者 yangfu

未读标识

... ... @@ -214,7 +214,7 @@ func (repository *ArticleRepository) FindAuthorsLatestFirstArticle(ctx context.C
tx = tx.Model(&ms).Select("max(id) id", "max(author_id) author_id", "max(created_at) created_at").
Where("company_id=?", companyId).
Where("author_id in (?)", authors).
Where("target_user=0 or who_read @>'[?]'", whoRead).
Where("target_user=0 or who_read @>? ", fmt.Sprintf("[%d]", whoRead)).
Where("show = 1").
Group("author_id").
Order("id desc")
... ... @@ -254,7 +254,7 @@ func (repository *ArticleRepository) FindAuthorsLatestFirstUnreadArticle(ctx con
tx = tx.Model(&ms).Select("max(id) id", "max(author_id) author_id", "max(created_at) created_at").
Where("company_id=?", companyId).
Where("author_id in (?)", authors).
Where("target_user=0 or who_read @>'[?]'", whoRead).
Where("target_user=0 or who_read @>? ", fmt.Sprintf("[%d]", whoRead)).
Where("show = 1").
Where("id not in (select article_id from user_read_article where user_id = ?)", whoRead).
Group("author_id").
... ...