优化
This commit is contained in:
@@ -40,4 +40,7 @@ interface BookChapterDao {
|
|||||||
@Query("delete from chapters where bookUrl = :bookUrl")
|
@Query("delete from chapters where bookUrl = :bookUrl")
|
||||||
fun delByBook(bookUrl: String)
|
fun delByBook(bookUrl: String)
|
||||||
|
|
||||||
|
@Query("update chapters set wordCount = :wordCount where bookUrl = :bookUrl and url = :url")
|
||||||
|
fun upWordCount(bookUrl: String, url: String, wordCount: String)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -185,8 +185,9 @@ object BookHelp {
|
|||||||
bookChapter.getFileName(),
|
bookChapter.getFileName(),
|
||||||
).writeText(content)
|
).writeText(content)
|
||||||
if (book.isOnLineTxt && AppConfig.tocCountWords) {
|
if (book.isOnLineTxt && AppConfig.tocCountWords) {
|
||||||
bookChapter.wordCount = StringUtils.wordCountFormat(content.length)
|
val wordCount = StringUtils.wordCountFormat(content.length)
|
||||||
appDb.bookChapterDao.update(bookChapter)
|
bookChapter.wordCount = wordCount
|
||||||
|
appDb.bookChapterDao.upWordCount(bookChapter.bookUrl, bookChapter.url, wordCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user