Skip to content

Let's use AI to Earn!

hudongshujubaocuo

bulaienaofutuojiesenzhangefcb4364205b
diff --git a/src/api/engagement.ts b/src/api/engagement.ts
new file mode 100644
index 00000000..d0a8f2b4
--- /dev/null
+++ b/src/api/engagement.ts
@@ -0,0 +1,8 @@
+import http from '@/utils/request';
+import { EngagementPostsParams, EngagementPostsResponse } from './types/engagement';
+
+export async function apiGetEngagementPosts(params: EngagementPostsParams) {
+ return http.post<EngagementPostsResponse>('api/channel/engagement/posts', params);
+}
+
+
diff --git a/src/api/types/engagement.ts b/src/api/types/engagement.ts
new file mode 100644
index 00000000..d88d3f99
--- /dev/null
+++ b/src/api/types/engagement.ts
@@ -0,0 +1,48 @@
+export type EngagementPlatform =
+ | 'bilibili'
+ | 'douyin'
+ | 'facebook'
+ | 'wxGzh'
+ | 'instagram'
+ | 'KWAI'
+ | 'pinterest'
+ | 'threads'
+ | 'tiktok'
+ | 'twitter'
+ | 'xhs'
+ | 'youtube';
+
+export type EngagementMediaType = 'video' | 'image' | 'article';
+
+export interface EngagementPostsParams {
+ platform: EngagementPlatform;
+ uid: string;
+ page: number;
+ pageSize: number;
+}
+
+export interface EngagementPostItem {
+ postId: string;
+ platform: EngagementPlatform;
+ title: string;
+ content: string;
+ thumbnail: string;
+ mediaType: EngagementMediaType;
+ permaLink: string;
+ publishTime: number; // ms timestamp
+ viewCount: number;
+ commentCount: number;
+ likeCount: number;
+ shareCount: number;
+ clickCount: number;
+ impressionCount: number;
+ favoriteCount: number;
+}
+
+export interface EngagementPostsResponse {
+ total: number;
+ posts: EngagementPostItem[];
+ hasMore: boolean;
+}
+
+
diff --git a/src/app/[lng]/engagement/page.tsx b/src/app/[lng]/engagement/page.tsx
new file mode 100644
index 00000000..bdbaca11
--- /dev/null
+++ b/src/app/[lng]/engagement/page.tsx
@@ -0,0 +1,97 @@
+"use client";
+
+import { useEffect, useMemo, useState } from "react";
+import { Card, Table, Select, Input, DatePicker, Space, Button, Tag } from "antd";
+import { useParams, useRouter } from "next/navigation";
+import { useTransClient } from "@/app/i18n/client";
+import { apiGetEngagementPosts } from "@/api/engagement";
+import { EngagementPlatform, EngagementPostItem } from "@/api/types/engagement";
+
+const { Option } = Select;
+
+export default function EngagementPage() {
+ const { t } = useTransClient('engagement');
+ const { lng } = useParams();
+
+ const [platform, setPlatform] = useState<EngagementPlatform>('bilibili');
+ const [uid, setUid] = useState<string>('');
+ const [posts, setPosts] = useState<EngagementPostItem[]>([]);
+ const [total, setTotal] = useState<number>(0);
+ const [hasMore, setHasMore] = useState<boolean>(false);
+ const [loading, setLoading] = useState<boolean>(false);
+ const [page, setPage] = useState<number>(1);
+ const [pageSize, setPageSize] = useState<number>(20);
+
+ async function fetchPosts(p: number = page, s: number = pageSize) {
+ if (!uid) return;
+ setLoading(true);
+ try {
+ const res = await apiGetEngagementPosts({ platform, uid, page: p, pageSize: s });
+ if (res?.data) {
+ setPosts(res.data.posts || []);
+ setTotal(res.data.total || 0);
+ setHasMore(!!res.data.hasMore);
+ }
+ } finally {
+ setLoading(false);
+ }
+ }
+
+ useEffect(() => {
+ // 初次加载不自动拉取,等待用户输入 uid 后点击查询
+ }, []);
+
+ const columns = useMemo(() => [
+ { title: t('columns.postId' as any), dataIndex: 'postId', key: 'postId', width: 180, ellipsis: true },
+ { title: t('columns.platform' as any), dataIndex: 'platform', key: 'platform', width: 100, render: (v: string) => <Tag>{v}</Tag> },
+ { title: t('columns.title' as any), dataIndex: 'title', key: 'title', width: 240, ellipsis: true },
+ { title: t('columns.mediaType' as any), dataIndex: 'mediaType', key: 'mediaType', width: 100, render: (v: string) => <Tag color={v==='video'?'blue':v==='image'?'green':'purple'}>{v}</Tag> },
+ { title: t('columns.publishTime' as any), dataIndex: 'publishTime', key: 'publishTime', width: 180, render: (ts: number) => new Date(ts).toLocaleString() },
+ { title: t('columns.viewCount' as any), dataIndex: 'viewCount', key: 'viewCount', width: 120 },
+ { title: t('columns.likeCount' as any), dataIndex: 'likeCount', key: 'likeCount', width: 120 },
+ { title: t('columns.commentCount' as any), dataIndex: 'commentCount', key: 'commentCount', width: 120 },
+ { title: t('columns.shareCount' as any), dataIndex: 'shareCount', key: 'shareCount', width: 120 },
+ { title: t('columns.clickCount' as any), dataIndex: 'clickCount', key: 'clickCount', width: 120 },
+ { title: t('columns.impressionCount' as any), dataIndex: 'impressionCount', key: 'impressionCount', width: 140 },
+ { title: t('columns.favoriteCount' as any), dataIndex: 'favoriteCount', key: 'favoriteCount', width: 120 },
+ { title: t('columns.permaLink' as any), dataIndex: 'permaLink', key: 'permaLink', width: 200, render: (url: string) => url ? <a href={url} target="_blank">{t('columns.open' as any)}</a> : '-' },
+ ], [t]);
+
+ return (
+ <div style={{ padding: 16 }}>
+ <Card
+ title={t('title' as any)}
+ extra={
+ <Space wrap>
+ <Select value={platform} onChange={setPlatform} style={{ width: 140 }}>
+ {['bilibili','douyin','facebook','wxGzh','instagram','KWAI','pinterest','threads','tiktok','twitter','xhs','youtube'].map(p => (
+ <Option key={p} value={p}>{p}</Option>
+ ))}
+ </Select>
+ <Input value={uid} placeholder={t('placeholders.uid' as any)} onChange={(e) => setUid(e.target.value)} style={{ width: 220 }} />
+ <Button type="primary" onClick={() => { setPage(1); fetchPosts(1, pageSize); }}>{t('actions.search' as any)}</Button>
+ <Button onClick={() => { setUid(''); setPosts([]); setTotal(0); }}>{t('actions.reset' as any)}</Button>
+ </Space>
+ }
+ >
+ <Table
+ rowKey={(r) => `${r.platform}-${r.postId}`}
+ columns={columns as any}
+ dataSource={posts}
+ loading={loading}
+ pagination={{
+ current: page,
+ pageSize,
+ total,
+ showSizeChanger: true,
+ onChange: (p, s) => { setPage(p); setPageSize(s || 20); fetchPosts(p, s || 20); },
+ showTotal: (t) => t ? `${t}` : '0'
+ }}
+ scroll={{ x: 1400 }}
+ />
+ </Card>
+ </div>
+ );
+}
+
+
diff --git a/src/app/i18n/locales/en/engagement.json b/src/app/i18n/locales/en/engagement.json
new file mode 100644
index 00000000..8f5cb98e
--- /dev/null
+++ b/src/app/i18n/locales/en/engagement.json
@@ -0,0 +1,28 @@
+{
+ "title": "Engagement",
+ "columns": {
+ "postId": "Post ID",
+ "platform": "Platform",
+ "title": "Title",
+ "mediaType": "Media Type",
+ "publishTime": "Publish Time",
+ "viewCount": "Views",
+ "likeCount": "Likes",
+ "commentCount": "Comments",
+ "shareCount": "Shares",
+ "clickCount": "Clicks",
+ "impressionCount": "Impressions",
+ "favoriteCount": "Favorites",
+ "permaLink": "Link",
+ "open": "Open"
+ },
+ "placeholders": {
+ "uid": "Enter account UID"
+ },
+ "actions": {
+ "search": "Search",
+ "reset": "Reset"
+ }
+}
+
+
diff --git a/src/app/i18n/locales/en/route.json b/src/app/i18n/locales/en/route.json
index c8602deb..5b7bd101 100644
--- a/src/app/i18n/locales/en/route.json
+++ b/src/app/i18n/locales/en/route.json
@@ -5,6 +5,8 @@
"hotContent": "Hot Content",
"hotContentNew": "Hot Content New",
"aiTools": "AI Tools",
- "navigation": "Navigation",
- "dataStatistics": "Data Statistics"
+ "tasks": "Tasks",
+ "engagement": "Engagement",
+ "dataStatistics": "Data Statistics",
+ "navigation": "Navigation"
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/zh-CN/engagement.json b/src/app/i18n/locales/zh-CN/engagement.json
new file mode 100644
index 00000000..5c31e430
--- /dev/null
+++ b/src/app/i18n/locales/zh-CN/engagement.json
@@ -0,0 +1,28 @@
+{
+ "title": "互动数据",
+ "columns": {
+ "postId": "帖子ID",
+ "platform": "平台",
+ "title": "标题",
+ "mediaType": "媒体类型",
+ "publishTime": "发布时间",
+ "viewCount": "浏览数",
+ "likeCount": "点赞数",
+ "commentCount": "评论数",
+ "shareCount": "分享数",
+ "clickCount": "点击数",
+ "impressionCount": "曝光数",
+ "favoriteCount": "收藏数",
+ "permaLink": "外链",
+ "open": "打开"
+ },
+ "placeholders": {
+ "uid": "请输入账户UID"
+ },
+ "actions": {
+ "search": "查询",
+ "reset": "重置"
+ }
+}
+
+
diff --git a/src/app/i18n/locales/zh-CN/route.json b/src/app/i18n/locales/zh-CN/route.json
index 89f61ade..8ce9128b 100644
--- a/src/app/i18n/locales/zh-CN/route.json
+++ b/src/app/i18n/locales/zh-CN/route.json
@@ -5,6 +5,8 @@
"hotContent": "热门内容",
"hotContentNew": "热门内容新",
"aiTools": "AI工具",
- "navigation": "导航",
- "dataStatistics": "数据统计"
+ "tasks": "任务中心",
+ "engagement": "互动数据",
+ "dataStatistics": "数据统计",
+ "navigation": "导航"
}
\ No newline at end of file
diff --git a/src/app/layout/routerData.ts b/src/app/layout/routerData.ts
index 81b953e4..62349da7 100644
--- a/src/app/layout/routerData.ts
+++ b/src/app/layout/routerData.ts
@@ -42,6 +42,11 @@ export const routerData: IRouterDataItem[] = [
translationKey: "tasks",
path: "/tasks",
},
+ {
+ name: "互动数据",
+ translationKey: "engagement",
+ path: "/engagement",
+ },
{
name: "数据统计",
translationKey: "dataStatistics",