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 b6ad0ba40..6e71ae680 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 @@ -13,7 +13,7 @@ interface BookDao { @Query("SELECT * FROM books WHERE `group` = :group") fun observeByGroup(group: Int): DataSource.Factory - @Query("SELECT url FROM books WHERE `group` = :group") + @Query("SELECT descUrl FROM books WHERE `group` = :group") fun observeUrlsByGroup(group: Int): LiveData> } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/Chapter.kt b/app/src/main/java/io/legado/app/data/entities/Chapter.kt index b5ba5bf93..f69bb4ac0 100644 --- a/app/src/main/java/io/legado/app/data/entities/Chapter.kt +++ b/app/src/main/java/io/legado/app/data/entities/Chapter.kt @@ -2,6 +2,7 @@ package io.legado.app.data.entities import android.os.Parcelable import androidx.room.Entity +import androidx.room.ForeignKey import androidx.room.Index import androidx.room.PrimaryKey import kotlinx.android.parcel.Parcelize @@ -9,9 +10,8 @@ import kotlinx.android.parcel.Parcelize @Parcelize @Entity(tableName = "chapters", - indices = [(Index(value = ["url"]))]) + indices = [(Index(value = ["feedId", "feedLink"], unique = true))]) data class Chapter(@PrimaryKey - var url: String = "", var name: String = "", var bookUrl: String = "", var index: Int = 0, diff --git a/app/src/main/java/io/legado/app/data/entities/Source.kt b/app/src/main/java/io/legado/app/data/entities/Source.kt index feecd7295..5bac00ac0 100644 --- a/app/src/main/java/io/legado/app/data/entities/Source.kt +++ b/app/src/main/java/io/legado/app/data/entities/Source.kt @@ -1,2 +1,29 @@ package io.legado.app.data.entities +import android.os.Parcelable +import androidx.room.Entity +import androidx.room.Index +import androidx.room.PrimaryKey +import kotlinx.android.parcel.Parcelize + +@Parcelize +@Entity(tableName = "sources", + indices = [(Index(value = ["id"]))]) +data class Source(@PrimaryKey + var id: Int = 0, // 编号 + var host: String = "", // 地址,包括 http/https + var name: String = "", // 名称 + var type: Int = 0, // 类型,0 文本,1 音频 + var group: String? = null, // 分组 + var header: String? = null, // header + var loginUrl: String? = null, // 登录地址 + var isEnabled: Boolean = true, // 是否启用 + var lastUpdateTime: Long = 0, // 最后更新时间,用于排序 + var serialNumber: Int = 0, // 手动排序编号 + var weight: Int = 0, // 智能排序的权重 + var exploreRule: String? = null, // 发现规则 + var searchRule: String? = null, // 搜索规则 + var bookInfoRule: String? = null, // 书籍信息页规则 + var tocRule: String? = null, // 目录页规则 + var contentRule: String? = null // 正文页规则 + ) : Parcelable \ No newline at end of file