✨ (search): 书目搜索带上作者参数
/store/search 的 author 不再写死为空。不传时仍是空串。
This commit is contained in:
1 parent
f4f8386a61
commit
a890c230ac
4 files changed
+16
-9
No files matched your search
@@ -1369,9 +1369,9 @@ do
|
||||
require("moonsource_weread.toc").clear()
|
||||
|
||||
-- 书名搜索:只留带 bookId 的书目。
|
||||
local keyword
|
||||
fake_client.searchAsync = function(_self, word, cb)
|
||||
keyword = word
|
||||
local keyword, got_author
|
||||
fake_client.searchAsync = function(_self, word, cb, author)
|
||||
keyword, got_author = word, author
|
||||
cb({ books = {
|
||||
{ type = 0, bookInfo = { bookId = 834464, title = "活着", author = "余华", publisher = "作家" } },
|
||||
{ type = 3, mpInfo = { title = "公众号" } },
|
||||
@@ -1379,8 +1379,9 @@ do
|
||||
return { cancel = function() end }
|
||||
end
|
||||
local found
|
||||
src:searchBooksAsync("活着", function(books) found = books end)
|
||||
src:searchBooksAsync("活着", function(books) found = books end, "余华")
|
||||
Assert.eq(keyword, "活着")
|
||||
Assert.eq(got_author, "余华")
|
||||
Assert.len(found, 1)
|
||||
Assert.eq(found[1].book_id, "834464")
|
||||
Assert.eq(found[1].author, "余华")
|
||||
|
||||
Reference in new issue
Block a user