|
|
@ -26,7 +26,6 @@ import kotlinx.coroutines.runBlocking |
|
|
|
import splitties.init.appCtx |
|
|
|
import splitties.init.appCtx |
|
|
|
import java.io.File |
|
|
|
import java.io.File |
|
|
|
import java.io.FileOutputStream |
|
|
|
import java.io.FileOutputStream |
|
|
|
import java.net.URLDecoder |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object BookController { |
|
|
|
object BookController { |
|
|
|
|
|
|
|
|
|
|
@ -57,7 +56,7 @@ object BookController { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun getCover(parameters: Map<String, List<String>>): ReturnData { |
|
|
|
fun getCover(parameters: Map<String, List<String>>): ReturnData { |
|
|
|
val returnData = ReturnData() |
|
|
|
val returnData = ReturnData() |
|
|
|
val coverPath = URLDecoder.decode(parameters["path"]?.firstOrNull(), "UTF-8") |
|
|
|
val coverPath = parameters["path"]?.firstOrNull() |
|
|
|
val ftBitmap = ImageLoader.loadBitmap(appCtx, coverPath).submit() |
|
|
|
val ftBitmap = ImageLoader.loadBitmap(appCtx, coverPath).submit() |
|
|
|
return try { |
|
|
|
return try { |
|
|
|
returnData.setData(ftBitmap.get()) |
|
|
|
returnData.setData(ftBitmap.get()) |
|
|
@ -73,9 +72,10 @@ object BookController { |
|
|
|
val returnData = ReturnData() |
|
|
|
val returnData = ReturnData() |
|
|
|
val bookUrl = parameters["url"]?.firstOrNull() |
|
|
|
val bookUrl = parameters["url"]?.firstOrNull() |
|
|
|
?: return returnData.setErrorMsg("bookUrl为空") |
|
|
|
?: return returnData.setErrorMsg("bookUrl为空") |
|
|
|
val book = appDb.bookDao.getBook(URLDecoder.decode(bookUrl, "UTF-8")) |
|
|
|
val book = appDb.bookDao.getBook(bookUrl) |
|
|
|
?: return returnData.setErrorMsg("bookUrl不对") |
|
|
|
?: return returnData.setErrorMsg("bookUrl不对:${bookUrl}") |
|
|
|
val src = URLDecoder.decode(parameters["path"]?.firstOrNull(), "UTF-8") |
|
|
|
val src = parameters["path"]?.firstOrNull() |
|
|
|
|
|
|
|
?: return returnData.setErrorMsg("图片链接为空") |
|
|
|
val vFile = BookHelp.getImage(book, src) |
|
|
|
val vFile = BookHelp.getImage(book, src) |
|
|
|
if (!vFile.exists()) { |
|
|
|
if (!vFile.exists()) { |
|
|
|
val bookSource = appDb.bookSourceDao.getBookSource(book.origin) |
|
|
|
val bookSource = appDb.bookSourceDao.getBookSource(book.origin) |
|
|
@ -84,7 +84,7 @@ object BookController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return returnData.setData( |
|
|
|
return returnData.setData( |
|
|
|
BitmapUtils.decodeBitmap(vFile.absolutePath) |
|
|
|
BitmapUtils.decodeBitmap(vFile.absolutePath, 640, 640) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|