diff --git a/app/src/main/java/io/legado/app/data/dao/BookDao.kt b/app/src/main/java/io/legado/app/data/dao/BookDao.kt index 5ba798703..69fa4a5f9 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookDao.kt @@ -69,9 +69,19 @@ interface BookDao { @Query("update books set `group` = :newGroupId where `group` = :oldGroupId") fun upGroup(oldGroupId: Int, newGroupId: Int) - @get:Query("select bookUrl, durChapterIndex, durChapterPos from books") + @get:Query("select bookUrl, durChapterIndex, durChapterPos, durChapterTime from books") val allBookProgress: List - @Query("update books set durChapterIndex = :durChapterIndex, durChapterPos = :durChapterPos where bookUrl = :bookUrl") - fun upBookProgress(bookUrl: String, durChapterIndex: Int, durChapterPos: Int) + @Query( + """ + update books set durChapterIndex = :durChapterIndex, durChapterPos = :durChapterPos + where bookUrl = :bookUrl and durChapterTime < :durChapterTime + """ + ) + fun upBookProgress( + bookUrl: String, + durChapterIndex: Int, + durChapterPos: Int, + durChapterTime: Int + ) } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/BookProgress.kt b/app/src/main/java/io/legado/app/data/entities/BookProgress.kt index ed2d8abdd..df9c80464 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookProgress.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookProgress.kt @@ -3,5 +3,6 @@ package io.legado.app.data.entities data class BookProgress( val bookUrl: String, val durChapterIndex: Int, - var durChapterPos: Int + var durChapterPos: Int, + var durChapterTime: Int ) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt b/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt index 76ff8cb1f..b01a11f0e 100644 --- a/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt +++ b/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt @@ -32,7 +32,8 @@ object SyncBookProgress { App.db.bookDao().upBookProgress( it.bookUrl, it.durChapterIndex, - it.durChapterPos + it.durChapterPos, + it.durChapterTime ) } }