✨ (search): 书目搜索带上作者参数

/store/search 的 author 不再写死为空。不传时仍是空串。
This commit is contained in:
Garfield committed 2026-11-26 15:52:52 +08:00
1 parent f4f8386a61
commit a890c230ac
4 files changed
+16 -9

No files matched your search

@@ -72,11 +72,12 @@ end
--- 书城搜索(App ``GET /store/search``)。回包书在 ``data[]``,每条 ``bookInfo``;补成 ``books[]`` 交给 mapper。
---@param keyword string
---@param cb fun(data: table|nil, err: string|nil)
---@param author string|nil 作者过滤;旧调用不传,查询里仍是空串
---@return { cancel: fun() }|nil
function Client:searchAsync(keyword, cb)
function Client:searchAsync(keyword, cb, author)
return Eink.callAsync("GET", "/store/search", {
query = {
keyword = keyword, author = "", authorVids = "", categoryId = "",
keyword = keyword, author = type(author) == "string" and author or "", authorVids = "", categoryId = "",
count = 20, maxIdx = 0, type = 0, v = 2, outer = 0, fromBookId = "",
scope = 0, scene = 0, filterType = 0, filterField = "", queryUid = "", isQueryWord = 0,
},
@@ -1520,18 +1520,19 @@ function Source:paragraphReviewsEnabled()
return require("source.review_setting").enabled(self.id)
end
--- 按书名搜索微信读书书目(关联本地书看段评用)。
--- 按书名搜索微信读书书目(关联本地书看段评用)。author 写入 /store/search 的作者参数。
---@param keyword string
---@param cb fun(books: WechatSearchBook[]|nil, err: string|nil)
---@param author string|nil
---@return { cancel: fun() }|nil
function Source:searchBooksAsync(keyword, cb)
function Source:searchBooksAsync(keyword, cb, author)
return self._client:searchAsync(keyword, function(wire, err)
if not wire then
cb(nil, err)
return
end
cb(Mapper.searchBooks(wire))
end)
end, author)
end
--- 书城搜索:回包形状同 listStoreAsync。