@ -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*/)