diff --git a/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt b/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt index 85c8ef9c3..10bf63933 100644 --- a/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt @@ -22,8 +22,8 @@ interface RssArticleDao { @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(vararg rssArticle: RssArticle) - @Query("delete from rssArticles where origin = :origin and `order` < :order") - fun clearOld(origin: String, order: Long) + @Query("delete from rssArticles where origin = :origin and sort = :sort and `order` < :order") + fun clearOld(origin: String, sort: String, order: Long) @Update fun update(vararg rssArticle: RssArticle) diff --git a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt index 06a420991..cd90b6b1d 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt @@ -60,7 +60,7 @@ object RssParserByRule { ruleTitle, rulePubDate, ruleDescription, ruleImage, ruleLink )?.let { it.sort = sortName - it.origin = rssSource.sourceUrl + it.origin = sourceUrl articleList.add(it) } } diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt index edc9215c2..3bcfc00ab 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt @@ -39,7 +39,7 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application } App.db.rssArticleDao().insert(*list.toTypedArray()) if (!rssSource.ruleNextPage.isNullOrEmpty()) { - App.db.rssArticleDao().clearOld(rssSource.sourceUrl, order) + App.db.rssArticleDao().clearOld(rssSource.sourceUrl, sortName, order) loadFinally.postValue(true) } else { withContext(Dispatchers.Main) {