|
|
@ -73,11 +73,7 @@ object BookController { |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
return if (toc.isEmpty()) { |
|
|
|
return returnData.setData(toc) |
|
|
|
returnData.setErrorMsg(appCtx.getString(R.string.error_load_toc)) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
returnData.setData(toc) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
val bookSource = appDb.bookSourceDao.getBookSource(book.origin) |
|
|
|
val bookSource = appDb.bookSourceDao.getBookSource(book.origin) |
|
|
|
?: return returnData.setErrorMsg("未找到对应书源,请换源") |
|
|
|
?: return returnData.setErrorMsg("未找到对应书源,请换源") |
|
|
@ -90,11 +86,7 @@ object BookController { |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
return if (toc.isEmpty()) { |
|
|
|
return returnData.setData(toc) |
|
|
|
returnData.setErrorMsg(appCtx.getString(R.string.error_load_toc)) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
returnData.setData(toc) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
|
return returnData.setErrorMsg(e.localizedMessage ?: "refresh toc error") |
|
|
|
return returnData.setErrorMsg(e.localizedMessage ?: "refresh toc error") |
|
|
|