pull/61/head^2
kunfei 5 years ago
parent 8f9768cd82
commit 977b4121c9
  1. 2
      app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt
  2. 3
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt
  3. 4
      app/src/main/java/io/legado/app/web/controller/SourceController.kt

@ -75,7 +75,7 @@ interface BookSourceDao {
fun update(vararg bookSource: BookSource)
@Delete
fun delete(vararg bookSource: BookSource)
fun delete(bookSource: BookSource)
@Query("delete from book_sources where bookSourceUrl = :key")
fun delete(key: String)

@ -91,7 +91,8 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
App.db.bookSourceDao().getBookSource(it)
}.let {
val json = GSON.toJson(it)
val file = FileHelp.getFile(Backup.exportPath + File.separator + "exportBookSource.json")
val file =
FileHelp.getFile(Backup.exportPath + File.separator + "exportBookSource.json")
file.writeText(json)
}
}.onSuccess {

@ -71,7 +71,9 @@ class SourceController {
fun deleteSources(postData: String?): ReturnData {
kotlin.runCatching {
GSON.fromJsonArray<BookSource>(postData)?.let {
App.db.bookSourceDao().delete(*it.toTypedArray())
it.forEach { source ->
App.db.bookSourceDao().delete(source)
}
}
}
return ReturnData().setData("已执行"/*okSources*/)

Loading…
Cancel
Save