feat(monitor): 从超级编导按创建时间导入作品链接
超级编导的数据中心里已经有每条分发作品的抖音链接,不用再一条条粘。按 「分发活动创建时间」选一段区间 → 预览作品/博主/播放数据 → 一键建成作品 模式的监控任务,建完默认立刻采一轮,主页信息第一轮就补全。 - 活动列表不支持日期过滤(传了也被静默忽略),只能全量拉下来本地按 created_at 筛;边界按东八区算 —— 容器跑 UTC,按 localtime 会整体错开 8 小时。 - data_center 必须带 video_status=-1,不带默认 0,接口返回空列表。 - share_url 是双斜杠形态,建任务时只取裸作品 id;video_link 的 id 提取 也顺带认双斜杠了。 - 作品模式不拉创作者资料、没有账号快照,组头的主页链接一直出不来。 作品上新增 creator_id(author.sec_uid),优先快照、再用作品兜底。 - token 存设置页(secret),不进仓库。
This commit is contained in:
@@ -2,7 +2,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { toast } from 'sonner'
|
||||
import { monitorApi, settingsApi } from '@/lib/api'
|
||||
import { usePlatformStore } from '@/store/platformStore'
|
||||
import type { TaskCreatePayload } from '@/types/monitor'
|
||||
import type { SuperDirTaskPayload, TaskCreatePayload } from '@/types/monitor'
|
||||
|
||||
/**
|
||||
* The platform every monitor hook is scoped to.
|
||||
@@ -448,6 +448,36 @@ export function useResolveVideoLinks() {
|
||||
})
|
||||
}
|
||||
|
||||
// --- 超级编导导入 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 按创建时间区间查超级编导上的作品链接。
|
||||
*
|
||||
* 是 mutation 不是 query:点「查询」才发请求,日期还没选好、打开弹窗的那一刻不该
|
||||
* 就去翻一遍全部活动 —— 那个接口没有日期过滤,每次都挺贵。
|
||||
*/
|
||||
export function useSuperDirPreview() {
|
||||
return useMutation({
|
||||
mutationFn: async ({ start, end }: { start: string; end: string }) =>
|
||||
(await monitorApi.previewSuperDir(start, end)).data,
|
||||
onError: (error: Error) => toast.error(`查询失败:${error.message}`),
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreateSuperDirTask() {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: async (payload: SuperDirTaskPayload) =>
|
||||
(await monitorApi.createSuperDirTask(payload)).data,
|
||||
onSuccess: (result) => {
|
||||
toast.success(`已建监控任务,共 ${result.targets} 条作品`)
|
||||
queryClient.invalidateQueries({ queryKey: ['monitorTasks'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['monitorOverview'] })
|
||||
},
|
||||
onError: (error: Error) => toast.error(`建任务失败:${error.message}`),
|
||||
})
|
||||
}
|
||||
|
||||
// --- 博主备注 --------------------------------------------------------------
|
||||
|
||||
export function useSetCreatorAlias() {
|
||||
|
||||
Reference in New Issue
Block a user