This commit is contained in:
truewhile
2026-10-03 14:21:07 +08:00
parent 60cfad47e5
commit b8b02cb3a7
5 changed files with 210 additions and 28 deletions
+7 -2
View File
@@ -317,11 +317,16 @@ export const readerAPI = {
api.put<{ groups: BookGroup[] | null }>('/reader/book-groups', { groups }).then((r) => r.data.groups ?? []),
/**
* 更新目录(对应 legado 书架的「更新目录」):重抓书架里全部网络书籍的目录,
* 覆盖章节缓存并刷新「最近更新」时间。返回本次刷新的汇总。
* 覆盖章节缓存并刷新「最近更新」时间。返回本次刷新的汇总:
* updated 有新章节 / unchanged 抓成功但没新章节 / failed 抓取或写入失败。
*/
refreshBooksToc: () =>
api
.post<{ total: number; updated: number; failed: number }>('/reader/shelf/refresh-toc', {}, longOpts)
.post<{ total: number; updated: number; unchanged: number; failed: number }>(
'/reader/shelf/refresh-toc',
{},
longOpts,
)
.then((r) => r.data),
/**
* 换源:把书架里的书切到另一个书源。
+5 -1
View File
@@ -250,7 +250,11 @@ export function ReaderHomeContent({ embedded = false }: { embedded?: boolean })
if (res.total === 0) {
toast.success('没有需要更新的网络书籍', { id: toastId })
} else if (res.failed > 0) {
toast(`更新完成:${res.updated} 本有新章节,${res.failed} 本失败`, { id: toastId, icon: '⚠️' })
// 只有抓取/写入真的失败才告警;「抓到但没有新章节」属正常结果,另算一档
const parts = [`${res.updated} 本有新章节`]
if (res.unchanged > 0) parts.push(`${res.unchanged} 本已是最新`)
parts.push(`${res.failed} 本失败,可在日志中查看书源报错`)
toast(`更新完成:${parts.join(',')}`, { id: toastId, icon: '⚠️' })
} else {
toast.success(res.updated > 0 ? `更新完成,${res.updated} 本有新章节` : '已是最新目录', { id: toastId })
}