Skip to content

Let's use AI to Earn!

feat: 删除测试界面

牛文政6f66a8a93612
diff --git a/src/router/index.tsx b/src/router/index.tsx
index 8fba335f..0d8b68de 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -32,19 +32,13 @@ import Publish from '@/views/publish/page';
import VideoPage from '@/views/publish/children/videoPage/page';
import PubRecord from '@/views/publish/children/pubRecord/page';
import Drafts from '@/views/publish/children/drafts/page';
-import Shipinhao from '@/views/test/shipinhao';
-import Douyin from '@/views/test/douyin/index';
-import Douyin2 from '@/views/test/douyin2';
-import Xiaohongshu from '@/views/test/xiaohongshu';
import Statistics from '@/views/statistics';
-import Test from '@/views/test/index';
-import TestVideo from '@/views/test/video';
import Task from '@/views/task';
-import HotTopic from '@/views/trending/hotTopic';
-import CarTask from '@/views/task/carTask';
-import PopTask from '@/views/task/popTask';
-import VideoTask from '@/views/task/videoTask';
-import MineTask from '@/views/task/mineTask';
+// import HotTopic from '@/views/trending/hotTopic';
+// import CarTask from '@/views/task/carTask';
+// import PopTask from '@/views/task/popTask';
+// import VideoTask from '@/views/task/videoTask';
+// import MineTask from '@/views/task/mineTask';
import UserWalletAccount from '@/views/finance/userWalletAccount';
import Finance from '@/views/finance/index';
import UserWalletRecord from '@/views/finance/userWalletRecord';
@@ -139,19 +133,6 @@ export const router: CustomRouteObject[] = [
{ path: 'userWalletAccount', element: <UserWalletAccount /> },
],
},
- {
- path: '/ceshi',
- element: <Test />,
- meta: { name: '测试', icon: UserOutlined },
- children: [
- { path: 'video', element: <TestVideo /> },
- { path: 'douyin', element: <Douyin /> },
- { path: 'douyin2', element: <Douyin2 /> },
- { path: 'shipinhao', element: <Shipinhao /> },
- { path: 'xiaohongshu', element: <Xiaohongshu /> },
- { path: 'hotTopic', element: <HotTopic /> },
- ],
- },
],
},
{ path: '/login', element: <Login /> },
diff --git a/src/views/test/douyin/index.tsx b/src/views/test/douyin/index.tsx
deleted file mode 100644
index 3a7821b3..00000000
--- a/src/views/test/douyin/index.tsx
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-01-17 20:44:02
- * @LastEditTime: 2025-02-14 21:49:20
- * @LastEditors: nevin
- * @Description: 抖音-发布
- */
-
-import React, { useCallback, useState } from 'react';
-import { Button, Layout, message, Card, Avatar } from 'antd';
-import { AccountInfo } from '@/views/account/comment';
-import VideoChoose from '@/components/Choose/VideoChoose';
-import { useXiaohongshuStore } from '@/store/xiaohongshu';
-
-const { Sider, Content } = Layout;
-
-const contentStyle: React.CSSProperties = {
- padding: '1rem',
- backgroundColor: '#fff',
- height: '100%',
-};
-
-const siderStyle: React.CSSProperties = {
- padding: '1rem',
- backgroundColor: '#fff',
-};
-
-const layoutStyle = {
- borderRadius: 8,
- overflow: 'hidden',
- width: 'calc(100% - 2rem)',
- height: '100%',
- marginRight: '1rem',
-};
-
-// 修改类型定义
-interface LoginUserInfo {
- authorId: string;
- avatar: string;
- fansCount: number;
- nickname: string;
-}
-
-interface LoginInfo {
- cookie: string;
- userInfo: LoginUserInfo;
- localStorage: string;
-}
-
-interface MetricData {
- english_metric_name: string;
- metric_name: string;
- metric_value: number;
- trends: Array<{
- date_time: string;
- value: number;
- douyin_value?: number;
- xigua_value?: number;
- }>;
-}
-
-interface DashboardData {
- zhangfen: number;
- bofang: number;
- pinglun: number;
- dianzan: number;
- fenxiang: number;
- zhuye: number;
-}
-
-const Account: React.FC = () => {
- // 账户
- const [accountInfo, setAccountInfo] = useState<AccountInfo | null>(null);
- const { setLoginInfo, loginInfo } = useXiaohongshuStore();
- const [publishResult, setPublishResult] = useState<any>(null);
- const [filePath, setFilePath] = useState<string>('922.mp4');
- const [dashboardData, setDashboardData] = useState<DashboardData | null>(
- null,
- );
- const [dashboardList, setDashboardList] = useState<
- Array<{
- date: string;
- zhangfen: number;
- bofang: number;
- pinglun: number;
- dianzan: number;
- fenxiang: number;
- zhuye: number;
- }>
- >([]);
-
- // 修改选择视频的处理函数
- const handleChooseVideo = useCallback((e: any) => {
- console.log('选择的视频路径:', e.videoPath);
- setFilePath(e.videoPath);
- }, []);
-
- // 修改登录处理函数
- const handleLogin = async () => {
- console.log('Initiating login request');
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_Login',
- 'https://creator.douyin.com/',
- );
- console.log('Login response:', result);
-
- if (result.success && result.data) {
- console.log('result.data@@:', JSON.stringify(result.data.cookie));
- const loginData: LoginInfo = {
- cookie: result.data.cookie,
- userInfo: {
- authorId: result.data.userInfo.authorId,
- avatar: result.data.userInfo.avatar,
- fansCount: result.data.userInfo.fansCount,
- nickname: result.data.userInfo.nickname,
- },
- localStorage: result.data.localStorage,
- };
- localStorage.setItem('douyin_cookie', result.data.cookie);
- setLoginInfo(loginData);
- console.log('登录成功', JSON.stringify(result.data.localStorage));
- } else {
- console.error('登录失败:', result.error);
- message.error('登录失败: ' + result.error);
- }
- } catch (error) {
- console.error('登录请求错误:', error);
- message.error(
- '登录失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- // 获取存储的登录信息
- const handleGetLoginInfo = () => {
- console.log('Stored login info:', loginInfo);
- if (loginInfo) {
- message.success('Login info retrieved successfully');
- } else {
- // 设置测试数据
- const mockLoginInfo = {
- cookie: localStorage.getItem('douyin_cookie'),
- userInfo: {
- authorId: 'douyintitoktest',
- nickname: '测试账号',
- avatar:
- 'https://p11.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_ogzADiaL8CyEQAiewA1IF3nAATAmgifCMWCBih.jpeg?from=2956013662',
- fansCount: 99999,
- },
- localStorage: `{\"privateKey\":\"-----BEGIN PRIVATE KEY-----\\r\\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgMl5+u6ZAawUJX+vR\\r\\nOyJEurLiLYwSkaiPCFktwrPAJHShRANCAATHgdF1Fmi5f4UxdMdXE8NpOhtp2O67\\r\\nK17GiPnY1YSHjquAna2aMGfZ+r+njYcpmqtCYoE9VfD1FMEXSWxwcBlp\\r\\n-----END PRIVATE KEY-----\\r\\n\",\"webProtect\":\"{\\\"ticket\\\":\\\"hash.hOe4DGkdQa75ggG6hpdGGF3dct3uMX/Zmz+lpK5MxBE=\\\",\\\"ts_sign\\\":\\\"ts.2.26d61d8567ddb46b4145437cb5a49f996cfdadd4e2697a40d42d929a7beb84b7c4fbe87d2319cf05318624ceda14911ca406dedbebeddb2e30fce8d4fa02575d\\\",\\\"client_cert\\\":\\\"pub.BMeB0XUWaLl/hTF0x1cTw2k6G2nY7rsrXsaI+djVhIeOq4CdrZowZ9n6v6eNhymaq0JigT1V8PUUwRdJbHBwGWk=\\\"}\"}`,
- };
- setLoginInfo(mockLoginInfo);
- console.log('mockLoginInfo:', mockLoginInfo);
- message.success('Mock login info set successfully');
- }
- };
-
- const testQingqiu = async () => {
- const result = await window.ipcRenderer.invoke('ICP_DY_makePublishRequest');
- console.log('testQingqiu result:', result);
- };
-
- const handleGetDashboardFunc = async () => {
- const cookies = loginInfo?.cookie;
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_GetDashboardFunckApi',
- cookies,
- );
- console.log('handleGetDashboardFunc result:', JSON.stringify(result));
- if (result.success && Array.isArray(result.data)) {
- setDashboardList(result.data);
- }
- };
-
- const handleGetDashboardFunc1 = async () => {
- const cookies = loginInfo?.cookie;
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_GetDashboardFunckApi',
- cookies,
- '2025-02-10',
- '2025-02-19',
- );
- console.log('handleGetDashboardFunc1 result:', JSON.stringify(result));
- if (result.success && Array.isArray(result.data)) {
- setDashboardList(result.data);
- }
- };
-
- const handlePublishImage = async () => {
- console.log('Initiating handlePublishImage request');
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const token = loginInfo?.localStorage ? loginInfo?.localStorage : 'token';
- console.log('token:', token);
- const imagePath = [
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- ];
-
- const platformSetting = {
- // 标题
- title: '这是一条爱团团作品',
- // 话题(抖音,抖音机构号,视频号平台格式)
- topics: ['立夏', '二十四节气'],
- // 话题(小红书平台格式)
- // topicsDetail: [
- // {
- // topicId: '0',
- // topicName: '爱团团',
- // link: 'https://www.xiaohongshu.com/page/topics/5f116704e44f2900012f1d86?naviHidden=yes',
- // },
- // ],
- // 封面(填写远程地址即可)
-
- cover:
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- // 定时发布,秒级时间戳,若时间小于当前时间戳,则立即发布,不填也是立即发布
- timingTime: '1737703280',
- // POI信息_抖音格式
- // poiInfo: {
- // poiId: "6601136811005708292",
- // poiName: "河南省电子商务产业园",
- // },
- };
-
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_PublishImageWorkApi',
- cookies,
- token,
- imagePath,
- platformSetting,
- );
- console.log('Publish response:', result);
-
- if (result.success) {
- console.log('Publish successful:', result.data);
- message.success('发布成功');
- setPublishResult(result.data);
- } else {
- console.error('Publish failed:', result.error);
- message.error('发布失败: ' + result.error);
- }
- } catch (error) {
- console.error('Publish request error:', error);
- message.error(
- '发布失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- const handlePublishVideo = async () => {
- console.log('Initiating publish request');
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const token = loginInfo?.localStorage ? loginInfo?.localStorage : 'token';
-
- const platformSetting = {
- // 标题
- title: 'ai爱爱爱爱爱爱ai爱了吗爱团团',
- // 话题(抖音,抖音机构号,视频号平台格式)
- topics: ['爱团团', 'AI', '极品美女'],
-
- // 封面(填写远程地址即可)
-
- cover:
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- // 定时发布,秒级时间戳,若时间小于当前时间戳,则立即发布,不填也是立即发布
- timingTime: '1737703280',
- // POI信息_抖音格式
- // poiInfo: {
- // poiId: "6601136811005708292",
- // poiName: "河南省电子商务产业园",
- // },
- };
-
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_PublishVideoWorkApi',
- cookies,
- token,
- filePath, // 使用状态变量中的文件路径
- platformSetting,
- );
- console.log('Publish response:', result);
-
- if (result.success) {
- console.log('Publish successful:', result.data);
- message.success('发布成功');
- setPublishResult(result.data);
- } else {
- console.error('Publish failed:', result.error);
- message.error('发布失败: ' + result.error);
- }
- } catch (error) {
- console.error('Publish request error:', error);
- message.error(
- '发布失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- // 渲染数据卡片
- const renderMetricCard = (title: string, value: number, icon: string) => (
- <div className="bg-white rounded-lg p-4 shadow-sm">
- <div className="flex items-center justify-between mb-2">
- <div className="text-gray-600 text-sm">{title}</div>
- <span className="text-gray-400 text-lg">{icon}</span>
- </div>
- <div className="text-2xl font-semibold text-[#a66ae4]">
- {value.toLocaleString()}
- </div>
- </div>
- );
-
- // 添加渲染列表数据的方法
- const renderDashboardList = () => (
- <div className="space-y-4">
- {dashboardList.map((item, index) => (
- <Card key={index} className="shadow-sm">
- <div className="text-lg font-medium mb-4">{item.date}</div>
- <div className="grid grid-cols-2 lg:grid-cols-3 gap-4">
- {renderMetricCard('涨粉数', item.zhangfen, '👥')}
- {renderMetricCard('播放量', item.bofang, '▶️')}
- {renderMetricCard('评论数', item.pinglun, '💬')}
- {renderMetricCard('点赞数', item.dianzan, '❤️')}
- {renderMetricCard('分享数', item.fenxiang, '🔄')}
- {renderMetricCard('主页访问', item.zhuye, '🏠')}
- </div>
- </Card>
- ))}
- </div>
- );
-
- return (
- <div className="page-container">
- <div className="content-wrapper">
- <div className="h-[calc(100%-2rem)]">
- <Layout style={layoutStyle}>
- <Sider width="300" style={siderStyle}>
- <div className="flex flex-col space-y-4">
- {accountInfo && (
- <Card>
- <div className="flex flex-col items-center space-y-4">
- <Avatar
- size={64}
- src={accountInfo.avatar}
- alt={accountInfo.nickname}
- />
- <div className="text-center">
- <div className="text-lg font-bold">
- {accountInfo.nickname}
- </div>
- <div className="text-gray-500">
- 账号: {accountInfo.account}
- </div>
- <div className="text-gray-500">
- UID: {accountInfo.uid}
- </div>
- </div>
- </div>
- </Card>
- )}
-
- <VideoChoose onChoose={handleChooseVideo} />
-
- <Button onClick={handleLogin}>登录抖音</Button>
-
- <Button onClick={handleGetLoginInfo}>获取登录信息</Button>
-
- <Button onClick={handlePublishVideo}>发布抖音</Button>
-
- <Button onClick={handlePublishImage}>发布图文</Button>
-
- <Button onClick={handleGetDashboardFunc}>获取昨日数据</Button>
-
- <Button onClick={handleGetDashboardFunc1}>
- 获取指定日期数据
- </Button>
-
- <Button onClick={testQingqiu}>测试请求</Button>
-
- {publishResult && (
- <Card title="发布结果">
- <div className="flex flex-col space-y-2">
- <div>
- 发布时间:{' '}
- {new Date(
- publishResult.publishTime * 1000,
- ).toLocaleString()}
- </div>
- <div>作品ID: {publishResult.publishId}</div>
- <div>
- 分享链接:{' '}
- <a
- href={publishResult.shareLink}
- target="_blank"
- rel="noopener noreferrer"
- >
- {publishResult.shareLink}
- </a>
- </div>
- </div>
- </Card>
- )}
-
- {loginInfo && (
- <Card>
- <div className="flex flex-col items-center space-y-4">
- <Avatar
- size={64}
- src={loginInfo.userInfo?.avatar}
- alt={loginInfo.userInfo?.nickname}
- />
- <div className="text-center">
- <div className="text-lg font-bold">
- {loginInfo.userInfo?.nickname}
- </div>
- <div className="text-gray-500">
- ID: {loginInfo.userInfo?.authorId}
- </div>
- <div className="text-gray-500">
- 粉丝数: {loginInfo.userInfo?.fansCount}
- </div>
- </div>
- </div>
- </Card>
- )}
- </div>
- </Sider>
- <Content style={contentStyle}>
- <div className="flex flex-col h-full">
- {dashboardList.length > 0 && (
- <div
- className="mb-6"
- style={{ height: '100%', overflowY: 'auto' }}
- >
- <h2 className="text-lg font-medium mb-4">数据概览</h2>
- {renderDashboardList()}
- </div>
- )}
- </div>
- </Content>
- </Layout>
- </div>
- </div>
- </div>
- );
-};
-
-export default Account;
diff --git a/src/views/test/douyin2/index.tsx b/src/views/test/douyin2/index.tsx
deleted file mode 100644
index 17f117d0..00000000
--- a/src/views/test/douyin2/index.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-01-17 20:44:02
- * @LastEditTime: 2025-02-13 16:58:36
- * @LastEditors: nevin
- * @Description: 抖音-发布
- */
-
-import React, { useState } from 'react';
-import { Button, Layout } from 'antd';
-
-const { Sider, Content } = Layout;
-
-const Account: React.FC = () => {
- const [loginInfo, setLoginInfo] = useState<{
- cookie: string;
- token: string;
- }>({
- cookie: '',
- token: '',
- });
-
- const handleLogin = async () => {
- const result = await window.ipcRenderer.invoke('ICP_TEST_DOUYIN_LOGIN');
- console.log('-------- douyin login result: ', result.cookie, result.token);
-
- // 设置用户信息
- setLoginInfo({
- cookie: result.cookie,
- token: result.token,
- });
- };
-
- const handlePublishVideo = async () => {
- // const result = await window.ipcRenderer.invoke('ICP_TEST_DOUYIN_VIDEO_PUB');
- const result = await window.ipcRenderer.invoke(
- 'ICP_TEST_DOUYIN_VIDEO_PUB_2',
- loginInfo.cookie,
- loginInfo.token,
- );
- console.log('Login response:', result);
- };
-
- return (
- <div className="page-container">
- <div className="content-wrapper">
- <div className="h-[calc(100%-2rem)]">
- <Layout>
- <Sider width="300">
- <div className="flex flex-col space-y-4">
- <Button onClick={handleLogin}>登录</Button>
- <Button onClick={handlePublishVideo}>发布抖音</Button>
- </div>
- </Sider>
- <Content>
- <div className="flex flex-col h-full">
- <p>{loginInfo.token}</p>
- </div>
- </Content>
- </Layout>
- </div>
- </div>
- </div>
- );
-};
-
-export default Account;
diff --git a/src/views/test/index.tsx b/src/views/test/index.tsx
deleted file mode 100644
index 75ed5194..00000000
--- a/src/views/test/index.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-02-10 22:20:15
- * @LastEditTime: 2025-02-26 21:50:26
- * @LastEditors: nevin
- * @Description: 测试页面
- */
-import styles from './publish.module.scss';
-import { VideoCameraOutlined } from '@ant-design/icons';
-import { Segmented } from 'antd';
-import { Outlet, useNavigate } from 'react-router-dom';
-
-export default function Page() {
- const navigate = useNavigate();
-
- return (
- <div className={styles.publish}>
- <Segmented
- vertical
- size="large"
- options={[
- { label: '抖音2', value: 'douyin2', icon: <VideoCameraOutlined /> },
- { label: '抖音', value: 'douyin', icon: <VideoCameraOutlined /> },
- {
- label: '小红书',
- value: 'xiaohongshu',
- icon: <VideoCameraOutlined />,
- },
- {
- label: '视频号',
- value: 'shipinhao',
- icon: <VideoCameraOutlined />,
- },
- { label: '视频测试', value: 'video', icon: <VideoCameraOutlined /> },
- { label: '任务测试', value: 'video', icon: <VideoCameraOutlined /> },
- {
- label: '热门事件',
- value: 'hotTopic',
- icon: <VideoCameraOutlined />,
- },
- ]}
- onChange={(value) => {
- navigate(value);
- }}
- />
- <Outlet />
- </div>
- );
-}
diff --git a/src/views/test/kwai/index.tsx b/src/views/test/kwai/index.tsx
deleted file mode 100644
index f770fbc5..00000000
--- a/src/views/test/kwai/index.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-01-22 21:37:00
- * @LastEditTime: 2025-02-17 20:31:04
- * @LastEditors: nevin
- * @Description:
- */
-import styles from './kwai.module.scss';
-import WebView from '@/components/WebView';
-import React, { useRef, useState } from 'react';
-import { Button, message } from 'antd';
-import { AccountInfo } from '@/views/account/comment';
-
-import VideoChoose from '@/components/Choose/VideoChoose';
-import {
- icpCreatePubRecord,
- icpCreateVideoPubRecord,
- icpPubVideo,
-} from '@/icp/publish';
-import { AccountType } from '../../../../commont/AccountEnum';
-import {
- PubType,
- VisibleTypeEnum,
-} from '../../../../commont/publish/PublishEnum';
-
-export default function Kwai() {
- const [pubLoading, setPubLoading] = useState(false);
- const url = useRef('https://cp.kuaishou.com/article/publish/video?tabType=1');
- const [accountInfo, setAccountInfo] = useState<AccountInfo | null>(null);
- const videoPath = useRef('');
-
- return (
- <div className={styles.kwai}>
- <div className="kwai-options">
- <VideoChoose
- onChoose={(res) => {
- videoPath.current = res.videoPath;
- }}
- />
- <Button
- onClick={async () => {
- try {
- } catch (error) {
- message.error('获取账户信息失败');
- console.error(error);
- }
- console.log('获取');
- }}
- >
- 获取cookie
- </Button>
- <Button
- loading={pubLoading}
- onClick={async () => {
- if (!videoPath.current) {
- return message.warning('请选择视频');
- }
-
- setPubLoading(true);
-
- const finish = () => {
- setPubLoading(false);
- };
-
- const params = {
- coverPath: '/',
- videoPath: videoPath.current,
- desc: '#事故现场记录 #风sir',
- title: '/',
- };
- // 一级记录
- const recordRes = await icpCreatePubRecord({
- ...params,
- type: PubType.VIDEO,
- }).catch((err) => {
- message.error(err);
- finish();
- });
- if (!recordRes) return finish();
- // 二级视频记录添加
- await icpCreateVideoPubRecord({
- ...params,
- type: AccountType.KWAI,
- accountId: 3,
- pubRecordId: recordRes.id,
- publishTime: new Date(),
- visibleType: VisibleTypeEnum.Private,
- });
- // 发布core
- await icpPubVideo(recordRes.id).catch(() => finish());
- finish();
- }}
- >
- 发布
- </Button>
- </div>
- <div className="kwai-webview">
- <WebView url={url.current} />
- </div>
- </div>
- );
-}
diff --git a/src/views/test/kwai/kwai.module.scss b/src/views/test/kwai/kwai.module.scss
deleted file mode 100644
index ae6fab59..00000000
--- a/src/views/test/kwai/kwai.module.scss
+++ /dev/null
@@ -1,18 +0,0 @@
-.kwai {
- height: 100%;
- display: flex;
- :global {
- .kwai-options {
- display: flex;
- flex-direction: column;
- flex-shrink: 0;
- padding: 15px;
- button {
- margin-bottom: 10px;
- }
- }
- .kwai-webview {
- width: 100%;
- }
- }
-}
\ No newline at end of file
diff --git a/src/views/test/publish.module.scss b/src/views/test/publish.module.scss
deleted file mode 100644
index 2abb36ea..00000000
--- a/src/views/test/publish.module.scss
+++ /dev/null
@@ -1,16 +0,0 @@
-.publish {
- width: 100%;
- height: 100%;
- display: flex;
-
- :global {
- .ant-segmented {
- padding: 30px 10px;
-
- .ant-segmented-item {
- margin-bottom: 5px;
- padding: 3px 40px 3px 0;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/views/test/shipinhao/index.tsx b/src/views/test/shipinhao/index.tsx
deleted file mode 100644
index 49364b4a..00000000
--- a/src/views/test/shipinhao/index.tsx
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-01-17 20:44:02
- * @LastEditTime: 2025-02-07 21:47:26
- * @LastEditors: nevin
- * @Description: 视频号-发布
- */
-
-import React, { useCallback, useState } from 'react';
-import { Button, Layout, message, Card, Avatar } from 'antd';
-import { AccountInfo } from '@/views/account/comment';
-import VideoChoose from '@/components/Choose/VideoChoose';
-import { useXiaohongshuStore } from '@/store/xiaohongshu';
-
-const { Sider, Content } = Layout;
-
-const contentStyle: React.CSSProperties = {
- padding: '1rem',
- backgroundColor: '#fff',
- height: '100%',
-};
-
-const siderStyle: React.CSSProperties = {
- padding: '1rem',
- backgroundColor: '#fff',
-};
-
-const layoutStyle = {
- borderRadius: 8,
- overflow: 'hidden',
- width: 'calc(100% - 2rem)',
- height: '100%',
- marginRight: '1rem',
-};
-
-// 修改类型定义
-interface LoginUserInfo {
- authorId: string;
- avatar: string;
- fansCount: number;
- nickname: string;
-}
-
-interface LoginInfo {
- cookie: string;
- userInfo: LoginUserInfo;
-}
-
-interface DashboardData {
- zhangfen: number;
- bofang: number;
- pinglun: number;
- dianzan: number;
- fenxiang: number;
- zhuye: number;
-}
-
-const Account: React.FC = () => {
- // 账户
- const [accountInfo, setAccountInfo] = useState<AccountInfo | null>(null);
- const { setLoginInfo, loginInfo } = useXiaohongshuStore();
- const [publishResult, setPublishResult] = useState<any>(null);
- const [filePath, setFilePath] = useState<string>('922.mp4');
- const [dashboardData, setDashboardData] = useState<DashboardData | null>(
- null,
- );
- const [dashboardList, setDashboardList] = useState<
- Array<{
- date: string;
- zhangfen: number;
- bofang: number;
- pinglun: number;
- dianzan: number;
- fenxiang: number;
- zhuye: number;
- }>
- >([]);
-
- // 修改选择视频的处理函数
- const handleChooseVideo = useCallback((path: string) => {
- console.log('选择的视频路径:', path);
- setFilePath(path);
- }, []);
-
- // 修改登录处理函数
- const handleLogin = async () => {
- console.log('Initiating login request');
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_SPH_Login',
- 'https://channels.weixin.qq.com',
- );
- console.log('Login response:', JSON.stringify(result));
-
- if (result.success && result.data) {
- const loginData: LoginInfo = {
- cookie: result.data.cookie,
- userInfo: {
- authorId: result.data.userInfo.authorId,
- avatar: result.data.userInfo.avatar,
- fansCount: result.data.userInfo.fansCount,
- nickname: result.data.userInfo.nickname,
- },
- };
- setLoginInfo(loginData);
- message.success('登录成功');
- } else {
- console.error('登录失败:', result.error);
- message.error('登录失败: ' + result.error);
- }
- } catch (error) {
- console.error('登录请求错误:', error);
- message.error(
- '登录失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- // 获取存储的登录信息
- const handleGetLoginInfo = () => {
- console.log('Stored login info:', loginInfo);
- if (loginInfo) {
- message.success('Login info retrieved successfully');
- } else {
- // 设置测试数据
- const mockLoginInfo = {
- cookie: `[{"name":"sessionid","value":"BgAAZDbdl13U8HQhGdpbowuMSz0SXG4n5uege8Ml4JQabcIDmdOS6V1cCKpOf3lgbZq4LmzOdpxwEFP6ZPV3dLpCz6sVKlwwR8dNmJ1oyllW","domain":"channels.weixin.qq.com","hostOnly":true,"path":"/","secure":true,"httpOnly":false,"session":false,"expirationDate":1774502488.113307,"sameSite":"no_restriction"},{"name":"wxuin","value":"4108987180","domain":"channels.weixin.qq.com","hostOnly":true,"path":"/","secure":true,"httpOnly":false,"session":false,"expirationDate":1774502488.113377,"sameSite":"no_restriction"}]`,
- userInfo: {
- authorId: 'sphSeVW1LNN5QW9',
- nickname: '测试账号',
- avatar:
- 'https://wx.qlogo.cn/finderhead/Q3auHgzwzM6fV2MJdRWicvU5mqiaFyTVrKmHqdG6dFFwg91U7vmvPpmw/0',
- fansCount: 99999,
- },
- };
-
- setLoginInfo(mockLoginInfo);
- message.success('Mock login info set successfully');
- }
- };
-
- // 获取账户数据
- const handleGetDashboardFunc = async () => {
- const cookies = loginInfo?.cookie;
- const result = await window.ipcRenderer.invoke(
- 'ICP_SPH_GetDashboardFunckApi',
- cookies,
- );
- console.log('handleGetDashboardFunc result:', result);
- if (result.success && result.data) {
- setDashboardData(result.data);
- }
- };
-
- // 获取指定日期范围的数据
- const handleGetDashboardFunc1 = async () => {
- const cookies = loginInfo?.cookie;
- const result = await window.ipcRenderer.invoke(
- 'ICP_SPH_GetDashboardFunckApi',
- cookies,
- '2025-02-10',
- '2025-02-18',
- );
- console.log('handleGetDashboardFunc result:', result);
- if (result.success && Array.isArray(result.data)) {
- setDashboardList(result.data);
- }
- };
-
- const handlePublishImage = async () => {
- console.log('Initiating publish request');
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const token = 'token';
-
- const platformSetting = {
- // 标题
- title: 'ai爱爱爱爱爱爱ai爱了吗爱团团',
- // 话题(抖音,抖音机构号,视频号平台格式)
- topics: ['爱团团', 'AI', '极品美女'],
- // 话题(小红书平台格式)
- // topicsDetail: [
- // {
- // topicId: '0',
- // topicName: '爱团团',
- // link: 'https://www.xiaohongshu.com/page/topics/5f116704e44f2900012f1d86?naviHidden=yes',
- // },
- // ],
- // 封面(填写远程地址即可)
- cover:
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- // 定时发布,秒级时间戳,若时间小于当前时间戳,则立即发布,不填也是立即发布
- timingTime: '1737703280',
- // POI信息_抖音格式
- // poiInfo: {
- // poiId: "6601136811005708292",
- // poiName: "河南省电子商务产业园",
- // },
- };
-
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_SPH_PublishVideoWorkApi',
- cookies,
- token,
- filePath, // 使用状态变量中的文件路径
- platformSetting,
- );
- console.log('Publish response:', result);
-
- if (result.success) {
- console.log('Publish successful:', result.data);
- message.success('发布成功');
- setPublishResult(result.data);
- } else {
- console.error('Publish failed:', result.error);
- message.error('发布失败: ' + result.error);
- }
- } catch (error) {
- console.error('Publish request error:', error);
- message.error(
- '发布失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- // 渲染数据卡片
- const renderMetricCard = (title: string, value: number, icon: string) => (
- <div className="bg-white rounded-lg p-4 shadow-sm">
- <div className="flex items-center justify-between mb-2">
- <div className="text-gray-600 text-sm">{title}</div>
- <span className="text-gray-400 text-lg">{icon}</span>
- </div>
- <div className="text-2xl font-semibold text-[#a66ae4]">
- {value.toLocaleString()}
- </div>
- </div>
- );
-
- // 渲染列表数据
- const renderDashboardList = () => (
- <div className="space-y-4">
- {dashboardList.map((item, index) => (
- <Card key={index} className="shadow-sm">
- {/* <div className="text-lg font-medium mb-4">{item.date}</div> */}
- <div className="grid grid-cols-2 lg:grid-cols-3 gap-4">
- {renderMetricCard('涨粉数', item.zhangfen, '👥')}
- {renderMetricCard('播放量', item.bofang, '▶️')}
- {renderMetricCard('评论数', item.pinglun, '💬')}
- {renderMetricCard('点赞数', item.dianzan, '❤️')}
- {renderMetricCard('分享数', item.fenxiang, '🔄')}
- {renderMetricCard('主页访问', item.zhuye, '🏠')}
- </div>
- </Card>
- ))}
- </div>
- );
-
- return (
- <div className="page-container">
- <div className="content-wrapper">
- <div className="h-[calc(100%-2rem)]">
- <Layout style={layoutStyle}>
- <Sider width="300" style={siderStyle}>
- <div className="flex flex-col space-y-4">
- {accountInfo && (
- <Card>
- <div className="flex flex-col items-center space-y-4">
- <Avatar
- size={64}
- src={accountInfo.avatar}
- alt={accountInfo.nickname}
- />
- <div className="text-center">
- <div className="text-lg font-bold">
- {accountInfo.nickname}
- </div>
- <div className="text-gray-500">
- 账号: {accountInfo.account}
- </div>
- <div className="text-gray-500">
- UID: {accountInfo.uid}
- </div>
- </div>
- </div>
- </Card>
- )}
-
- <VideoChoose
- onChoose={(vf) => handleChooseVideo(vf.videoPath)}
- />
-
- <Button onClick={handleLogin}>登录视频号</Button>
-
- <Button onClick={handleGetLoginInfo}>获取登录信息</Button>
-
- <Button onClick={handleGetDashboardFunc}>获取昨日数据</Button>
-
- <Button onClick={handleGetDashboardFunc1}>
- 获取指定日期数据
- </Button>
-
- <Button onClick={handlePublishImage}>发布图文</Button>
-
- {publishResult && (
- <Card title="发布结果">
- <div className="flex flex-col space-y-2">
- <div>
- 发布时间:{' '}
- {new Date(
- publishResult.publishTime * 1000,
- ).toLocaleString()}
- </div>
- <div>作品ID: {publishResult.publishId}</div>
- <div>
- 分享链接:{' '}
- <a
- href={publishResult.shareLink}
- target="_blank"
- rel="noopener noreferrer"
- >
- {publishResult.shareLink}
- </a>
- </div>
- </div>
- </Card>
- )}
-
- {loginInfo && (
- <Card>
- <div className="flex flex-col items-center space-y-4">
- <Avatar
- size={64}
- src={loginInfo.userInfo?.avatar}
- alt={loginInfo.userInfo?.nickname}
- />
- <div className="text-center">
- <div className="text-lg font-bold">
- {loginInfo.userInfo?.nickname}
- </div>
- <div className="text-gray-500">
- ID: {loginInfo.userInfo?.authorId}
- </div>
- <div className="text-gray-500">
- 粉丝数: {loginInfo.userInfo?.fansCount}
- </div>
- </div>
- </div>
- </Card>
- )}
- </div>
- </Sider>
- <Content style={contentStyle}>
- <div className="flex flex-col h-full">
- {dashboardData && (
- <div className="mb-6">
- <h2 className="text-lg font-medium mb-4">昨日数据概览</h2>
- <div className="grid grid-cols-2 lg:grid-cols-3 gap-4">
- {renderMetricCard('涨粉数', dashboardData.zhangfen, '👥')}
- {renderMetricCard('播放量', dashboardData.bofang, '▶️')}
- {renderMetricCard('评论数', dashboardData.pinglun, '💬')}
- {renderMetricCard('点赞数', dashboardData.dianzan, '❤️')}
- {renderMetricCard('分享数', dashboardData.fenxiang, '🔄')}
- {renderMetricCard('主页访问', dashboardData.zhuye, '🏠')}
- </div>
- </div>
- )}
-
- {dashboardList.length > 0 && (
- <div
- className="mb-6"
- style={{ height: '100%', overflowY: 'auto' }}
- >
- <h2 className="text-lg font-medium mb-4">历史数据概览</h2>
- {renderDashboardList()}
- </div>
- )}
- </div>
- </Content>
- </Layout>
- </div>
- </div>
- </div>
- );
-};
-
-export default Account;
diff --git a/src/views/test/video/index.tsx b/src/views/test/video/index.tsx
deleted file mode 100644
index 3d137d6b..00000000
--- a/src/views/test/video/index.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-02-10 22:20:15
- * @LastEditTime: 2025-02-21 21:18:45
- * @LastEditors: nevin
- * @Description: 视频测试
- */
-import { operateApi } from '@/api/operate';
-import { Button } from 'antd';
-
-export default function Page() {
- async function getBanner() {
- const res = await operateApi.getBannerList();
- console.log('----banner ', res);
- }
-
- return (
- <div>
- <Button onClick={getBanner}>获取banner</Button>
- </div>
- );
-}
diff --git a/src/views/test/xiaohongshu/index.tsx b/src/views/test/xiaohongshu/index.tsx
deleted file mode 100644
index 90ceb05d..00000000
--- a/src/views/test/xiaohongshu/index.tsx
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-01-17 20:44:02
- * @LastEditTime: 2025-02-14 21:49:20
- * @LastEditors: nevin
- * @Description: 抖音-发布
- */
-
-import React, { useCallback, useState } from 'react';
-import { Button, Layout, message, Card, Avatar } from 'antd';
-import { AccountInfo } from '@/views/account/comment';
-import VideoChoose from '@/components/Choose/VideoChoose';
-import { useXiaohongshuStore } from '@/store/xiaohongshu';
-
-const { Sider, Content } = Layout;
-
-const contentStyle: React.CSSProperties = {
- padding: '1rem',
- backgroundColor: '#fff',
- height: '100%',
-};
-
-const siderStyle: React.CSSProperties = {
- padding: '1rem',
- backgroundColor: '#fff',
-};
-
-const layoutStyle = {
- borderRadius: 8,
- overflow: 'hidden',
- width: 'calc(100% - 2rem)',
- height: '100%',
- marginRight: '1rem',
-};
-
-// 修改类型定义
-interface LoginUserInfo {
- authorId: string;
- avatar: string;
- fansCount: number;
- nickname: string;
-}
-
-interface LoginInfo {
- cookie: string;
- userInfo: LoginUserInfo;
- localStorage: string;
-}
-
-interface MetricData {
- english_metric_name: string;
- metric_name: string;
- metric_value: number;
- trends: Array<{
- date_time: string;
- value: number;
- douyin_value?: number;
- xigua_value?: number;
- }>;
-}
-
-interface DashboardData {
- zhangfen: number;
- bofang: number;
- pinglun: number;
- dianzan: number;
- fenxiang: number;
- zhuye: number;
-}
-
-const Account: React.FC = () => {
- // 账户
- const [accountInfo, setAccountInfo] = useState<AccountInfo | null>(null);
- const { setLoginInfo, loginInfo } = useXiaohongshuStore();
- const [publishResult, setPublishResult] = useState<any>(null);
- const [filePath, setFilePath] = useState<string>('922.mp4');
- const [dashboardData, setDashboardData] = useState<DashboardData | null>(
- null,
- );
- const [dashboardList, setDashboardList] = useState<
- Array<{
- date: string;
- zhangfen: number;
- bofang: number;
- pinglun: number;
- dianzan: number;
- fenxiang: number;
- zhuye: number;
- }>
- >([]);
-
- // 修改选择视频的处理函数
- const handleChooseVideo = useCallback((e: any) => {
- console.log('选择的视频路径:', e.videoPath);
- setFilePath(e.videoPath);
- }, []);
-
- // 修改登录处理函数
- const handleLogin = async () => {
- console.log('Initiating login request');
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_XHS_Login',
- 'https://creator.douyin.com/',
- );
- console.log('Login response:', result);
-
- if (result.success && result.data) {
- console.log('result.data@@:', JSON.stringify(result.data.cookie));
- setLoginInfo(result.data);
- console.log('登录成功', JSON.stringify(result.data.localStorage));
- } else {
- console.error('登录失败:', result.error);
- message.error('登录失败: ' + result.error);
- }
- } catch (error) {
- console.error('登录请求错误:', error);
- message.error(
- '登录失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- // 获取存储的登录信息
- const handleGetLoginInfo = () => {
- console.log('Stored login info:', loginInfo);
- if (loginInfo) {
- message.success('Login info retrieved successfully');
- } else {
- // 设置测试数据
- const mockLoginInfo = {
- cookie: [
- {
- name: 'acw_tc',
- value:
- '0a0d09d017398662023601636e6b3678b5453e72c449955a71a88dce9aa8b8',
- domain: 'creator.xiaohongshu.com',
- hostOnly: true,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1739868001.880623,
- sameSite: 'unspecified',
- },
- {
- name: 'xsecappid',
- value: 'ugc',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: false,
- session: false,
- expirationDate: 1771402203,
- sameSite: 'unspecified',
- },
- {
- name: 'a1',
- value: '195181b64e1uk2zdwtecq2bg07ka2lc03dyrv1j6750000218505',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: false,
- session: false,
- expirationDate: 1771402203,
- sameSite: 'unspecified',
- },
- {
- name: 'webId',
- value: '448e8a71902ed4e5bd9221d673d5f64a',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: false,
- session: false,
- expirationDate: 1771402203,
- sameSite: 'unspecified',
- },
- {
- name: 'websectiga',
- value:
- '6169c1e84f393779a5f7de7303038f3b47a78e47be716e7bec57ccce17d45f99',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: false,
- session: false,
- expirationDate: 1740125404,
- sameSite: 'unspecified',
- },
- {
- name: 'sec_poison_id',
- value: '1b93d373-5581-4c3f-86a5-162894a5f930',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: false,
- session: false,
- expirationDate: 1739866809,
- sameSite: 'unspecified',
- },
- {
- name: 'gid',
- value:
- 'yj2yYyDWyqqfyj2yYyDK4fyVdy7TJufE9dSAvKWJDk8WTF280J1S8h888JyY2828Kj2yK0Ky',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: false,
- session: false,
- expirationDate: 1774426205.902804,
- sameSite: 'unspecified',
- },
- {
- name: 'customer-sso-sid',
- value: '68c5174726686778508354287f952ccbdf2fb1dc',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1740471057.305251,
- sameSite: 'unspecified',
- },
- {
- name: 'x-user-id-creator.xiaohongshu.com',
- value: '65755c46000000003d02be4d',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1774426258.305439,
- sameSite: 'unspecified',
- },
- {
- name: 'customerClientId',
- value: '534324456763569',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1774426258.305536,
- sameSite: 'unspecified',
- },
- {
- name: 'access-token-creator.xiaohongshu.com',
- value:
- 'customer.creator.AT-68c517472668677850667525pjzcjw0rje0xar0k',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1742458257.305611,
- sameSite: 'unspecified',
- },
- {
- name: 'galaxy_creator_session_id',
- value: 'aVIvKrLoRitPPJGXFIZH6oRpXH7IUAHpOG3c',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1742458258.305697,
- sameSite: 'unspecified',
- },
- {
- name: 'galaxy.creator.beaker.session.id',
- value: '1739866258632030794988',
- domain: '.xiaohongshu.com',
- hostOnly: false,
- path: '/',
- secure: false,
- httpOnly: true,
- session: false,
- expirationDate: 1742458258.305777,
- sameSite: 'unspecified',
- },
- ],
- userInfo: {
- authorId: '1234567890',
- nickname: '测试账号',
- avatar:
- 'https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo315md1gj6hc6g5ph48itjcgmo6a2sir8?imageView2/2/w/80/format/jpg',
- fansCount: 1000,
- },
- };
- setLoginInfo(mockLoginInfo);
- console.log('mockLoginInfo:', mockLoginInfo);
- message.success('Mock login info set successfully');
- }
- };
-
- const handleGetDashboardFunc = async () => {
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const result = await window.ipcRenderer.invoke(
- 'ICP_XHS_GetDashboardFunckApi',
- cookies,
- );
- console.log('handleGetDashboardFunc result:', JSON.stringify(result.data));
- if (result.success && Array.isArray(result.data)) {
- setDashboardList(result.data);
- }
- };
-
- const handleGetDashboardFunc1 = async () => {
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const result = await window.ipcRenderer.invoke(
- 'ICP_XHS_GetDashboardFunckApi',
- cookies,
- '2025-02-10',
- '2025-02-18',
- );
- console.log('handleGetDashboardFunc1 result:', JSON.stringify(result));
- if (result.success && Array.isArray(result.data)) {
- setDashboardList(result.data);
- }
- };
-
- const handlePublishImage = async () => {
- console.log('Initiating handlePublishImage request');
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const token = loginInfo?.localStorage ? loginInfo?.localStorage : 'token';
- console.log('token:', token);
- const imagePath = [
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- ];
-
- const platformSetting = {
- // 标题
- title: '这是一条爱团团作品',
- // 话题(抖音,抖音机构号,视频号平台格式)
- topics: ['立夏', '二十四节气'],
- // 话题(小红书平台格式)
- // topicsDetail: [
- // {
- // topicId: '0',
- // topicName: '爱团团',
- // link: 'https://www.xiaohongshu.com/page/topics/5f116704e44f2900012f1d86?naviHidden=yes',
- // },
- // ],
- // 封面(填写远程地址即可)
-
- cover:
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- // 定时发布,秒级时间戳,若时间小于当前时间戳,则立即发布,不填也是立即发布
- timingTime: '1737703280',
- // POI信息_抖音格式
- // poiInfo: {
- // poiId: "6601136811005708292",
- // poiName: "河南省电子商务产业园",
- // },
- };
-
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_PublishImageWorkApi',
- cookies,
- token,
- imagePath,
- platformSetting,
- );
- console.log('Publish response:', result);
-
- if (result.success) {
- console.log('Publish successful:', result.data);
- message.success('发布成功');
- setPublishResult(result.data);
- } else {
- console.error('Publish failed:', result.error);
- message.error('发布失败: ' + result.error);
- }
- } catch (error) {
- console.error('Publish request error:', error);
- message.error(
- '发布失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- const handlePublishVideo = async () => {
- console.log('Initiating publish request');
- console.log('Stored login info:', loginInfo);
- const cookies = loginInfo?.cookie;
- const token = loginInfo?.localStorage ? loginInfo?.localStorage : 'token';
-
- const platformSetting = {
- // 标题
- title: 'ai爱爱爱爱爱爱ai爱了吗爱团团',
- // 话题(抖音,抖音机构号,视频号平台格式)
- topics: ['爱团团', 'AI', '极品美女'],
-
- // 封面(填写远程地址即可)
-
- cover:
- 'https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6069415171/p792953.png',
- // 定时发布,秒级时间戳,若时间小于当前时间戳,则立即发布,不填也是立即发布
- timingTime: '1737703280',
- // POI信息_抖音格式
- // poiInfo: {
- // poiId: "6601136811005708292",
- // poiName: "河南省电子商务产业园",
- // },
- };
-
- try {
- const result = await window.ipcRenderer.invoke(
- 'ICP_DY_PublishVideoWorkApi',
- cookies,
- token,
- filePath, // 使用状态变量中的文件路径
- platformSetting,
- );
- console.log('Publish response:', result);
-
- if (result.success) {
- console.log('Publish successful:', result.data);
- message.success('发布成功');
- setPublishResult(result.data);
- } else {
- console.error('Publish failed:', result.error);
- message.error('发布失败: ' + result.error);
- }
- } catch (error) {
- console.error('Publish request error:', error);
- message.error(
- '发布失败: ' + (error instanceof Error ? error.message : String(error)),
- );
- }
- };
-
- // 渲染数据卡片
- const renderMetricCard = (title: string, value: number, icon: string) => (
- <div className="bg-white rounded-lg p-4 shadow-sm">
- <div className="flex items-center justify-between mb-2">
- <div className="text-gray-600 text-sm">{title}</div>
- <span className="text-gray-400 text-lg">{icon}</span>
- </div>
- <div className="text-2xl font-semibold text-[#a66ae4]">
- {value.toLocaleString()}
- </div>
- </div>
- );
-
- // 添加渲染列表数据的方法
- const renderDashboardList = () => (
- <div className="space-y-4">
- {dashboardList.map((item, index) => (
- <Card key={index} className="shadow-sm">
- <div className="text-lg font-medium mb-4">{item.date}</div>
- <div className="grid grid-cols-2 lg:grid-cols-3 gap-4">
- {renderMetricCard('涨粉数', item.zhangfen, '👥')}
- {renderMetricCard('播放量', item.bofang, '▶️')}
- {renderMetricCard('评论数', item.pinglun, '💬')}
- {renderMetricCard('点赞数', item.dianzan, '❤️')}
- {renderMetricCard('分享数', item.fenxiang, '🔄')}
- {renderMetricCard('主页访问', item.zhuye, '🏠')}
- </div>
- </Card>
- ))}
- </div>
- );
-
- return (
- <div className="page-container">
- <div className="content-wrapper">
- <div className="h-[calc(100%-2rem)]">
- <Layout style={layoutStyle}>
- <Sider width="300" style={siderStyle}>
- <div className="flex flex-col space-y-4">
- {accountInfo && (
- <Card>
- <div className="flex flex-col items-center space-y-4">
- <Avatar
- size={64}
- src={accountInfo.avatar}
- alt={accountInfo.nickname}
- />
- <div className="text-center">
- <div className="text-lg font-bold">
- {accountInfo.nickname}
- </div>
- <div className="text-gray-500">
- 账号: {accountInfo.account}
- </div>
- <div className="text-gray-500">
- UID: {accountInfo.uid}
- </div>
- </div>
- </div>
- </Card>
- )}
-
- <VideoChoose onChoose={handleChooseVideo} />
-
- <Button onClick={handleLogin}>登录小红书</Button>
-
- <Button onClick={handleGetLoginInfo}>获取登录信息</Button>
-
- <Button onClick={handlePublishVideo}>发布小红书</Button>
-
- <Button onClick={handlePublishImage}>发布图文</Button>
-
- <Button onClick={handleGetDashboardFunc}>获取昨日数据</Button>
-
- <Button onClick={handleGetDashboardFunc1}>
- 获取指定日期数据
- </Button>
-
- {publishResult && (
- <Card title="发布结果">
- <div className="flex flex-col space-y-2">
- <div>
- 发布时间:{' '}
- {new Date(
- publishResult.publishTime * 1000,
- ).toLocaleString()}
- </div>
- <div>作品ID: {publishResult.publishId}</div>
- <div>
- 分享链接:{' '}
- <a
- href={publishResult.shareLink}
- target="_blank"
- rel="noopener noreferrer"
- >
- {publishResult.shareLink}
- </a>
- </div>
- </div>
- </Card>
- )}
-
- {loginInfo && (
- <Card>
- <div className="flex flex-col items-center space-y-4">
- <Avatar
- size={64}
- src={loginInfo.userInfo?.avatar}
- alt={loginInfo.userInfo?.nickname}
- />
- <div className="text-center">
- <div className="text-lg font-bold">
- {loginInfo.userInfo?.nickname}
- </div>
- <div className="text-gray-500">
- ID: {loginInfo.userInfo?.authorId}
- </div>
- <div className="text-gray-500">
- 粉丝数: {loginInfo.userInfo?.fansCount}
- </div>
- </div>
- </div>
- </Card>
- )}
- </div>
- </Sider>
- <Content style={contentStyle}>
- <div className="flex flex-col h-full">
- {dashboardList.length > 0 && (
- <div
- className="mb-6"
- style={{ height: '100%', overflowY: 'auto' }}
- >
- <h2 className="text-lg font-medium mb-4">数据概览</h2>
- {renderDashboardList()}
- </div>
- )}
- </div>
- </Content>
- </Layout>
- </div>
- </div>
- </div>
- );
-};
-
-export default Account;