From 532f130b745df0b19055d49325f7f0526552e275 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 Mar 2020 12:01:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/web/controller/BookshelfController.kt | 4 ++-- .../java/io/legado/app/web/controller/SourceController.kt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/web/controller/BookshelfController.kt b/app/src/main/java/io/legado/app/web/controller/BookshelfController.kt index f46195b1b..2d0003879 100644 --- a/app/src/main/java/io/legado/app/web/controller/BookshelfController.kt +++ b/app/src/main/java/io/legado/app/web/controller/BookshelfController.kt @@ -23,7 +23,7 @@ class BookshelfController { fun getChapterList(parameters: Map>): ReturnData { val bookUrl = parameters["url"]?.get(0) val returnData = ReturnData() - if (bookUrl == null) { + if (bookUrl.isNullOrEmpty()) { return returnData.setErrorMsg("参数url不能为空,请指定书籍地址") } val chapterList = App.db.bookChapterDao().getChapterList(bookUrl) @@ -34,7 +34,7 @@ class BookshelfController { val bookUrl = parameters["url"]?.get(0) val index = parameters["index"]?.get(0)?.toInt() val returnData = ReturnData() - if (bookUrl == null) { + if (bookUrl.isNullOrEmpty()) { return returnData.setErrorMsg("参数url不能为空,请指定书籍地址") } if (index == null) { diff --git a/app/src/main/java/io/legado/app/web/controller/SourceController.kt b/app/src/main/java/io/legado/app/web/controller/SourceController.kt index 90c774370..7eff59105 100644 --- a/app/src/main/java/io/legado/app/web/controller/SourceController.kt +++ b/app/src/main/java/io/legado/app/web/controller/SourceController.kt @@ -58,12 +58,12 @@ class SourceController { } fun getSource(parameters: Map>): ReturnData { - val strings = parameters["url"] + val url = parameters["url"]?.get(0) val returnData = ReturnData() - if (strings == null) { + if (url.isNullOrEmpty()) { return returnData.setErrorMsg("参数url不能为空,请指定书源地址") } - val bookSource = App.db.bookSourceDao().getBookSource(strings[0]) + val bookSource = App.db.bookSourceDao().getBookSource(url) ?: return returnData.setErrorMsg("未找到书源,请检查书源地址") return returnData.setData(bookSource) }