diff --git a/app/src/main/java/io/legado/app/data/dao/SourceCookieDao.kt b/app/src/main/java/io/legado/app/data/dao/SourceCookieDao.kt index 4c7a062c7..fcf4abf70 100644 --- a/app/src/main/java/io/legado/app/data/dao/SourceCookieDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/SourceCookieDao.kt @@ -6,7 +6,7 @@ import androidx.room.Query @Dao interface SourceCookieDao { - @Query("SELECT cookie FROM cookies Where exploreUrl = :exploreUrl") + @Query("SELECT cookie FROM cookies Where url = :url") fun getCookieByUrl(url: String): String? } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt index 4b16519fe..042abac42 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt @@ -9,24 +9,24 @@ import kotlinx.android.parcel.Parcelize @Parcelize @Entity( - tableName = "chapters", - primaryKeys = ["exploreUrl", "bookUrl"], - indices = [(Index(value = ["exploreUrl"], unique = true)), (Index(value = ["bookUrl", "index"], unique = true))], - foreignKeys = [(ForeignKey( - entity = Book::class, - parentColumns = ["descUrl"], - childColumns = ["bookUrl"], - onDelete = ForeignKey.CASCADE - ))] + tableName = "chapters", + primaryKeys = ["url", "bookUrl"], + indices = [(Index(value = ["bookUrl"], unique = true)), (Index(value = ["bookUrl", "index"], unique = true))], + foreignKeys = [(ForeignKey( + entity = Book::class, + parentColumns = ["descUrl"], + childColumns = ["bookUrl"], + onDelete = ForeignKey.CASCADE + ))] ) // 删除书籍时自动删除章节 data class BookChapter( - var url: String = "", // 章节地址 - var title: String = "", // 章节标题 - var bookUrl: String = "", // 书籍地址 - var index: Int = 0, // 章节序号 - var resourceUrl: String? = null, // 音频真实URL - var tag: String? = null, // - var start: Long? = null, // 章节起始位置 - var end: Long? = null // 章节终止位置 + var url: String = "", // 章节地址 + var title: String = "", // 章节标题 + var bookUrl: String = "", // 书籍地址 + var index: Int = 0, // 章节序号 + var resourceUrl: String? = null, // 音频真实URL + var tag: String? = null, // + var start: Long? = null, // 章节起始位置 + var end: Long? = null // 章节终止位置 ) : Parcelable diff --git a/app/src/main/java/io/legado/app/data/entities/SourceCookie.kt b/app/src/main/java/io/legado/app/data/entities/SourceCookie.kt index b770f16ae..62581a2f8 100644 --- a/app/src/main/java/io/legado/app/data/entities/SourceCookie.kt +++ b/app/src/main/java/io/legado/app/data/entities/SourceCookie.kt @@ -4,7 +4,7 @@ import androidx.room.Entity import androidx.room.Index import androidx.room.PrimaryKey -@Entity(tableName = "cookies", indices = [(Index(value = ["exploreUrl"], unique = true))]) +@Entity(tableName = "cookies", indices = [(Index(value = ["url"], unique = true))]) data class SourceCookie( @PrimaryKey var url: String = "",