feat(monitor): 组头上加一个跳到博主主页的按钮
`creator_hash` 是单向的,拼不出主页地址 —— 所以这个 id 必须在采集时单独存下来。 抖音的资料接口本来就返回 sec_uid,只是之前没落库。 * `monitor_creator_stat` 加 `creator_id` 列(老数据默认空,下一次采集补上); * 链接在 `adapters.creator_url()` 里拼,**空串是有意义的返回值**:平台不认识、 或者没拿到 id,就返回空,界面据此不画按钮 —— 画一个点开 404 的按钮比不画糟; * 没有作品的博主照样有链接:他恰恰是你想点进去看的那个人。 已知缺口:小红书那条路(爬虫子进程)根本不落创作者资料,所以那边没有链接。
This commit is contained in:
@@ -172,6 +172,8 @@ export function NotesTable({ taskId, onlyNew }: NotesTableProps) {
|
||||
key: string
|
||||
name: string
|
||||
alias: string
|
||||
/** 主页链接。空串就是不画那个按钮(见 MonitorCreator.creator_url)。 */
|
||||
url: string
|
||||
/** 服务端说的这条博主名下有多少作品 —— 列表被 `onlyNew` 滤过时和 `notes.length` 不等。 */
|
||||
totalNotes: number
|
||||
stats: MonitorCreator | null
|
||||
@@ -194,12 +196,14 @@ export function NotesTable({ taskId, onlyNew }: NotesTableProps) {
|
||||
existing.name ||= creator.creator_name
|
||||
// 备注按 (platform, creator_hash) 存,所以跨任务就是同一条,取到即可。
|
||||
existing.alias ||= creator.creator_alias
|
||||
existing.url ||= creator.creator_url
|
||||
continue
|
||||
}
|
||||
byCreator.set(key, {
|
||||
key,
|
||||
name: creator.creator_name || '',
|
||||
alias: creator.creator_alias || '',
|
||||
url: creator.creator_url || '',
|
||||
totalNotes: creator.note_count,
|
||||
stats: creator,
|
||||
notes: [],
|
||||
@@ -216,6 +220,7 @@ export function NotesTable({ taskId, onlyNew }: NotesTableProps) {
|
||||
key,
|
||||
name: note.creator_name || '',
|
||||
alias: note.creator_alias || '',
|
||||
url: '',
|
||||
totalNotes: 0,
|
||||
stats: null,
|
||||
notes: [],
|
||||
@@ -320,6 +325,20 @@ export function NotesTable({ taskId, onlyNew }: NotesTableProps) {
|
||||
{group.alias && group.name && (
|
||||
<span className="text-cyber-text-muted truncate">{group.name}</span>
|
||||
)}
|
||||
{/* 跳到他主页。链接是采集时从资料接口带回来的(哈希拼不出地址),
|
||||
拿不到就整块不画 —— 一个点开 404 的按钮比没有按钮糟。 */}
|
||||
{group.url && (
|
||||
<a
|
||||
href={group.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
title="打开博主主页"
|
||||
className="text-cyber-text-muted hover:text-cyber-neon-cyan flex-shrink-0"
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
</a>
|
||||
)}
|
||||
<span className="text-cyber-text-muted flex-shrink-0">
|
||||
{/* 被 onlyNew 滤过时,把「显示了几篇 / 一共几篇」都说出来,
|
||||
否则「1 篇」会让人以为这个号只发过一条。 */}
|
||||
|
||||
Reference in New Issue
Block a user