Skip to content

Let's use AI to Earn!

feat: The platform's interactive functions have been fully realized (#386)

Gao15934a35581b
diff --git a/project/web/next-sitemap.config.js b/project/web/next-sitemap.config.js
index bd907323..498ac834 100644
--- a/project/web/next-sitemap.config.js
+++ b/project/web/next-sitemap.config.js
@@ -91,10 +91,10 @@ module.exports = {
// 关键:把子站 sitemap 挂到索引
additionalSitemaps: [
- 'https://blog.aitoearn.ai/sitemap.xml',
+ // 'https://blog.aitoearn.ai/sitemap.xml',
'https://docs.aitoearn.ai/sitemap.xml',
- 'https://hotinfo.aitoearn.ai/sitemap.xml',
- 'https://rank.aitoearn.ai/sitemap.xml',
+ // 'https://hotinfo.aitoearn.ai/sitemap.xml',
+ // 'https://rank.aitoearn.ai/sitemap.xml',
],
// 让 robots.txt 也列出
@@ -106,10 +106,10 @@ module.exports = {
},
],
additionalSitemaps: [
- 'https://blog.aitoearn.ai/sitemap.xml',
+ // 'https://blog.aitoearn.ai/sitemap.xml',
'https://docs.aitoearn.ai/sitemap.xml',
- 'https://hotinfo.aitoearn.ai/sitemap.xml',
- 'https://rank.aitoearn.ai/sitemap.xml',
+ // 'https://hotinfo.aitoearn.ai/sitemap.xml',
+ // 'https://rank.aitoearn.ai/sitemap.xml',
],
},
}
diff --git a/project/web/src/app/[lng]/plats-test/page.tsx b/project/web/src/app/[lng]/plats-test/page.tsx
new file mode 100644
index 00000000..0374c799
--- /dev/null
+++ b/project/web/src/app/[lng]/plats-test/page.tsx
@@ -0,0 +1,402 @@
+'use client'
+
+/**
+ * 平台交互功能测试页面
+ * 用于测试小红书、抖音的点赞、评论、收藏功能
+ */
+
+import { useState } from 'react'
+import { PlatType } from '@/app/config/platConfig'
+import { platformManager } from '@/store/plugin/plats'
+import type { BaseResult, CommentResult, DirectMessageResult } from '@/store/plugin/plats'
+import styles from './plats-test.module.scss'
+
+type ActionType = 'like' | 'unlike' | 'comment' | 'favorite' | 'unfavorite' | 'directMessage'
+
+interface TestLog {
+ id: number
+ time: string
+ platform: string
+ action: ActionType
+ workId: string
+ success: boolean
+ message?: string
+ data?: any
+}
+
+export default function PlatsTestPage() {
+ // 表单状态
+ const [platform, setPlatform] = useState<PlatType.Xhs | PlatType.Douyin>(PlatType.Xhs)
+ const [workId, setWorkId] = useState('')
+ const [commentContent, setCommentContent] = useState('')
+ const [replyToCommentId, setReplyToCommentId] = useState('')
+ // 私信相关状态
+ const [dmContent, setDmContent] = useState('')
+ const [dmAuthorUrl, setDmAuthorUrl] = useState('')
+
+ // 加载状态
+ const [loading, setLoading] = useState<ActionType | null>(null)
+
+ // 测试日志
+ const [logs, setLogs] = useState<TestLog[]>([])
+
+ /**
+ * 添加日志
+ */
+ const addLog = (
+ action: ActionType,
+ result: BaseResult | CommentResult | DirectMessageResult,
+ extraData?: any,
+ ) => {
+ const log: TestLog = {
+ id: Date.now(),
+ time: new Date().toLocaleTimeString(),
+ platform: platform === PlatType.Xhs ? '小红书' : '抖音',
+ action,
+ workId,
+ success: result.success,
+ message: result.message,
+ data: { ...result.rawData, ...extraData },
+ }
+ setLogs(prev => [log, ...prev])
+ }
+
+ /**
+ * 点赞
+ */
+ const handleLike = async (isLike: boolean) => {
+ if (!workId) {
+ alert('请输入作品ID')
+ return
+ }
+
+ const action = isLike ? 'like' : 'unlike'
+ setLoading(action)
+
+ try {
+ const result = await platformManager.likeWork(platform, workId, isLike)
+ addLog(action, result)
+ }
+ catch (error: any) {
+ addLog(action, { success: false, message: error.message })
+ }
+ finally {
+ setLoading(null)
+ }
+ }
+
+ /**
+ * 评论
+ */
+ const handleComment = async () => {
+ if (!workId) {
+ alert('请输入作品ID')
+ return
+ }
+ if (!commentContent) {
+ alert('请输入评论内容')
+ return
+ }
+
+ setLoading('comment')
+
+ try {
+ const result = await platformManager.commentWork(platform, {
+ workId,
+ content: commentContent,
+ replyToCommentId: replyToCommentId || undefined,
+ })
+ addLog('comment', result, { commentId: result.commentId })
+ }
+ catch (error: any) {
+ addLog('comment', { success: false, message: error.message })
+ }
+ finally {
+ setLoading(null)
+ }
+ }
+
+ /**
+ * 收藏
+ */
+ const handleFavorite = async (isFavorite: boolean) => {
+ if (!workId) {
+ alert('请输入作品ID')
+ return
+ }
+
+ const action = isFavorite ? 'favorite' : 'unfavorite'
+ setLoading(action)
+
+ try {
+ const result = await platformManager.favoriteWork(platform, workId, isFavorite)
+ addLog(action, result)
+ }
+ catch (error: any) {
+ addLog(action, { success: false, message: error.message })
+ }
+ finally {
+ setLoading(null)
+ }
+ }
+
+ /**
+ * 清空日志
+ */
+ const clearLogs = () => {
+ setLogs([])
+ }
+
+ /**
+ * 私信
+ */
+ const handleDirectMessage = async () => {
+ if (!dmContent) {
+ alert('请输入私信内容')
+ return
+ }
+
+ if (!workId && !dmAuthorUrl) {
+ alert('请输入作品ID或作者链接')
+ return
+ }
+
+ // 只有抖音支持私信
+ if (platform !== PlatType.Douyin) {
+ alert('小红书不支持私信功能')
+ return
+ }
+
+ setLoading('directMessage')
+
+ try {
+ const result = await platformManager.sendDirectMessage(platform, {
+ workId: workId || undefined,
+ authorUrl: dmAuthorUrl || undefined,
+ content: dmContent,
+ })
+ addLog('directMessage', result, { authorUrl: dmAuthorUrl })
+ }
+ catch (error: any) {
+ addLog('directMessage', { success: false, message: error.message })
+ }
+ finally {
+ setLoading(null)
+ }
+ }
+
+ /**
+ * 获取操作名称
+ */
+ const getActionName = (action: ActionType): string => {
+ const names: Record<ActionType, string> = {
+ like: '点赞',
+ unlike: '取消点赞',
+ comment: '评论',
+ favorite: '收藏',
+ unfavorite: '取消收藏',
+ directMessage: '私信',
+ }
+ return names[action]
+ }
+
+ return (
+ <div className={styles.container}>
+ <h1 className={styles.title}>🧪 平台交互测试</h1>
+ <p className={styles.subtitle}>测试小红书、抖音的点赞、评论、收藏功能</p>
+
+ {/* 配置区域 */}
+ <div className={styles.card}>
+ <h2 className={styles.cardTitle}>配置</h2>
+
+ <div className={styles.formGroup}>
+ <label>选择平台</label>
+ <div className={styles.radioGroup}>
+ <label className={styles.radio}>
+ <input
+ type="radio"
+ checked={platform === PlatType.Xhs}
+ onChange={() => setPlatform(PlatType.Xhs)}
+ />
+ <span className={styles.radioXhs}>小红书</span>
+ </label>
+ <label className={styles.radio}>
+ <input
+ type="radio"
+ checked={platform === PlatType.Douyin}
+ onChange={() => setPlatform(PlatType.Douyin)}
+ />
+ <span className={styles.radioDouyin}>抖音</span>
+ </label>
+ </div>
+ </div>
+
+ <div className={styles.formGroup}>
+ <label>作品ID *</label>
+ <input
+ type="text"
+ value={workId}
+ onChange={e => setWorkId(e.target.value)}
+ placeholder={platform === PlatType.Xhs ? '小红书笔记ID,如: 6911bfd10000000004021dd6' : '抖音视频ID,如: 7123456789012345678'}
+ className={styles.input}
+ />
+ </div>
+ </div>
+
+ {/* 操作区域 */}
+ <div className={styles.card}>
+ <h2 className={styles.cardTitle}>操作</h2>
+
+ {/* 点赞 */}
+ <div className={styles.actionRow}>
+ <span className={styles.actionLabel}>点赞</span>
+ <div className={styles.actionButtons}>
+ <button
+ onClick={() => handleLike(true)}
+ disabled={loading !== null}
+ className={`${styles.btn} ${styles.btnPrimary}`}
+ >
+ {loading === 'like' ? '处理中...' : '👍 点赞'}
+ </button>
+ <button
+ onClick={() => handleLike(false)}
+ disabled={loading !== null}
+ className={`${styles.btn} ${styles.btnSecondary}`}
+ >
+ {loading === 'unlike' ? '处理中...' : '👎 取消点赞'}
+ </button>
+ </div>
+ </div>
+
+ {/* 收藏 */}
+ <div className={styles.actionRow}>
+ <span className={styles.actionLabel}>收藏</span>
+ <div className={styles.actionButtons}>
+ <button
+ onClick={() => handleFavorite(true)}
+ disabled={loading !== null}
+ className={`${styles.btn} ${styles.btnPrimary}`}
+ >
+ {loading === 'favorite' ? '处理中...' : '⭐ 收藏'}
+ </button>
+ <button
+ onClick={() => handleFavorite(false)}
+ disabled={loading !== null}
+ className={`${styles.btn} ${styles.btnSecondary}`}
+ >
+ {loading === 'unfavorite' ? '处理中...' : '✖ 取消收藏'}
+ </button>
+ </div>
+ </div>
+
+ {/* 评论 */}
+ <div className={styles.commentSection}>
+ <span className={styles.actionLabel}>评论</span>
+ <div className={styles.commentInputs}>
+ <textarea
+ value={commentContent}
+ onChange={e => setCommentContent(e.target.value)}
+ placeholder="输入评论内容..."
+ className={styles.textarea}
+ rows={3}
+ />
+ <input
+ type="text"
+ value={replyToCommentId}
+ onChange={e => setReplyToCommentId(e.target.value)}
+ placeholder="回复评论ID(可选,用于二级评论)"
+ className={styles.input}
+ />
+ <button
+ onClick={handleComment}
+ disabled={loading !== null}
+ className={`${styles.btn} ${styles.btnPrimary} ${styles.btnFull}`}
+ >
+ {loading === 'comment' ? '处理中...' : '💬 发送评论'}
+ </button>
+ </div>
+ </div>
+
+ {/* 私信(仅抖音支持) */}
+ {platform === PlatType.Douyin && (
+ <div className={styles.commentSection}>
+ <span className={styles.actionLabel}>私信</span>
+ <div className={styles.commentInputs}>
+ <textarea
+ value={dmContent}
+ onChange={e => setDmContent(e.target.value)}
+ placeholder="输入私信内容..."
+ className={styles.textarea}
+ rows={3}
+ />
+ <input
+ type="text"
+ value={dmAuthorUrl}
+ onChange={e => setDmAuthorUrl(e.target.value)}
+ placeholder="作者链接(可选,如果填写了作品ID则可不填)"
+ className={styles.input}
+ />
+ <p className={styles.hint}>
+ 提示:可以通过作品ID或作者链接发送私信。如果两者都填写,优先使用作品ID。
+ </p>
+ <button
+ onClick={handleDirectMessage}
+ disabled={loading !== null}
+ className={`${styles.btn} ${styles.btnPrimary} ${styles.btnFull}`}
+ >
+ {loading === 'directMessage' ? '处理中...' : '✉️ 发送私信'}
+ </button>
+ </div>
+ </div>
+ )}
+ </div>
+
+ {/* 日志区域 */}
+ <div className={styles.card}>
+ <div className={styles.logHeader}>
+ <h2 className={styles.cardTitle}>测试日志</h2>
+ <button onClick={clearLogs} className={`${styles.btn} ${styles.btnSmall}`}>
+ 清空
+ </button>
+ </div>
+
+ {logs.length === 0
+ ? (
+ <div className={styles.emptyLog}>暂无日志,执行操作后将显示结果</div>
+ )
+ : (
+ <div className={styles.logList}>
+ {logs.map(log => (
+ <div
+ key={log.id}
+ className={`${styles.logItem} ${log.success ? styles.logSuccess : styles.logError}`}
+ >
+ <div className={styles.logMeta}>
+ <span className={styles.logTime}>{log.time}</span>
+ <span className={styles.logPlatform}>{log.platform}</span>
+ <span className={styles.logAction}>{getActionName(log.action)}</span>
+ <span className={log.success ? styles.logStatusSuccess : styles.logStatusError}>
+ {log.success ? '✓ 成功' : '✗ 失败'}
+ </span>
+ </div>
+ <div className={styles.logWorkId}>
+ 作品ID:
+ {' '}
+ {log.workId}
+ </div>
+ {log.message && <div className={styles.logMessage}>{log.message}</div>}
+ {log.data && (
+ <details className={styles.logDetails}>
+ <summary>查看原始数据</summary>
+ <pre>{JSON.stringify(log.data, null, 2)}</pre>
+ </details>
+ )}
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ )
+}
+
diff --git a/project/web/src/app/[lng]/plats-test/plats-test.module.scss b/project/web/src/app/[lng]/plats-test/plats-test.module.scss
new file mode 100644
index 00000000..70650c21
--- /dev/null
+++ b/project/web/src/app/[lng]/plats-test/plats-test.module.scss
@@ -0,0 +1,400 @@
+/**
+ * 平台交互测试页面样式
+ */
+
+.container {
+ max-width: 800px;
+ margin: 0 auto;
+ padding: 40px 20px;
+ background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
+}
+
+.title {
+ font-size: 32px;
+ font-weight: 700;
+ color: #fff;
+ text-align: center;
+ margin: 0 0 8px;
+ letter-spacing: 1px;
+}
+
+.subtitle {
+ font-size: 14px;
+ color: #8892b0;
+ text-align: center;
+ margin: 0 0 32px;
+}
+
+.card {
+ background: rgba(255, 255, 255, 0.03);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 16px;
+ padding: 24px;
+ margin-bottom: 24px;
+ backdrop-filter: blur(10px);
+}
+
+.cardTitle {
+ font-size: 18px;
+ font-weight: 600;
+ color: #e6f1ff;
+ margin: 0 0 20px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
+}
+
+// 表单
+.formGroup {
+ margin-bottom: 20px;
+
+ label {
+ display: block;
+ font-size: 13px;
+ font-weight: 500;
+ color: #a8b2d1;
+ margin-bottom: 8px;
+ }
+}
+
+.radioGroup {
+ display: flex;
+ gap: 20px;
+}
+
+.radio {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ cursor: pointer;
+
+ input {
+ width: 18px;
+ height: 18px;
+ accent-color: #64ffda;
+ }
+
+ span {
+ font-size: 14px;
+ font-weight: 500;
+ }
+}
+
+.radioXhs {
+ color: #ff2442;
+}
+
+.radioDouyin {
+ color: #00f2ea;
+}
+
+.input {
+ width: 100%;
+ padding: 12px 16px;
+ font-size: 14px;
+ color: #e6f1ff;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ outline: none;
+ transition: all 0.2s ease;
+ box-sizing: border-box;
+
+ &::placeholder {
+ color: #5a6a8a;
+ }
+
+ &:focus {
+ border-color: #64ffda;
+ box-shadow: 0 0 0 3px rgba(100, 255, 218, 0.1);
+ }
+}
+
+.textarea {
+ @extend .input;
+ resize: vertical;
+ min-height: 80px;
+ font-family: inherit;
+}
+
+// 操作区
+.actionRow {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ padding: 16px 0;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
+
+ &:last-of-type {
+ border-bottom: none;
+ }
+}
+
+.actionLabel {
+ font-size: 14px;
+ font-weight: 500;
+ color: #a8b2d1;
+ min-width: 60px;
+}
+
+.actionButtons {
+ display: flex;
+ gap: 12px;
+}
+
+.commentSection {
+ padding-top: 16px;
+}
+
+.commentInputs {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ margin-top: 12px;
+}
+
+.hint {
+ font-size: 12px;
+ color: #5a6a8a;
+ margin: 0;
+ padding: 0 4px;
+}
+
+// 示例区域
+.exampleSection {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 12px 0;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
+
+ &:last-child {
+ border-bottom: none;
+ }
+}
+
+.exampleLabel {
+ font-size: 13px;
+ font-weight: 500;
+ color: #8892b0;
+}
+
+.exampleTags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+}
+
+.exampleTag {
+ padding: 6px 12px;
+ font-size: 12px;
+ color: #64ffda;
+ background: rgba(100, 255, 218, 0.08);
+ border: 1px solid rgba(100, 255, 218, 0.2);
+ border-radius: 16px;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ max-width: 200px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ &:hover {
+ background: rgba(100, 255, 218, 0.15);
+ border-color: rgba(100, 255, 218, 0.4);
+ transform: translateY(-1px);
+ }
+
+ &:active {
+ transform: translateY(0);
+ }
+}
+
+// 按钮
+.btn {
+ padding: 10px 20px;
+ font-size: 14px;
+ font-weight: 500;
+ border: none;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: all 0.2s ease;
+
+ &:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+}
+
+.btnPrimary {
+ background: linear-gradient(135deg, #64ffda 0%, #48d1cc 100%);
+ color: #0a192f;
+
+ &:hover:not(:disabled) {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 20px rgba(100, 255, 218, 0.3);
+ }
+}
+
+.btnSecondary {
+ background: rgba(255, 255, 255, 0.08);
+ color: #a8b2d1;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+
+ &:hover:not(:disabled) {
+ background: rgba(255, 255, 255, 0.12);
+ border-color: rgba(255, 255, 255, 0.2);
+ }
+}
+
+.btnSmall {
+ padding: 6px 12px;
+ font-size: 12px;
+ background: rgba(255, 255, 255, 0.05);
+ color: #8892b0;
+
+ &:hover {
+ background: rgba(255, 255, 255, 0.1);
+ }
+}
+
+.btnFull {
+ width: 100%;
+}
+
+// 日志
+.logHeader {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ .cardTitle {
+ margin-bottom: 0;
+ padding-bottom: 0;
+ border-bottom: none;
+ }
+}
+
+.emptyLog {
+ text-align: center;
+ color: #5a6a8a;
+ font-size: 14px;
+ padding: 40px 0;
+}
+
+.logList {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ margin-top: 16px;
+ max-height: 400px;
+ overflow-y: auto;
+
+ &::-webkit-scrollbar {
+ width: 6px;
+ }
+
+ &::-webkit-scrollbar-track {
+ background: rgba(255, 255, 255, 0.02);
+ border-radius: 3px;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 3px;
+ }
+}
+
+.logItem {
+ padding: 16px;
+ border-radius: 10px;
+ border-left: 3px solid;
+}
+
+.logSuccess {
+ background: rgba(100, 255, 218, 0.05);
+ border-left-color: #64ffda;
+}
+
+.logError {
+ background: rgba(255, 107, 129, 0.05);
+ border-left-color: #ff6b81;
+}
+
+.logMeta {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px;
+ margin-bottom: 8px;
+}
+
+.logTime {
+ font-size: 12px;
+ color: #5a6a8a;
+ font-family: 'JetBrains Mono', monospace;
+}
+
+.logPlatform {
+ font-size: 12px;
+ font-weight: 600;
+ color: #64ffda;
+ background: rgba(100, 255, 218, 0.1);
+ padding: 2px 8px;
+ border-radius: 4px;
+}
+
+.logAction {
+ font-size: 12px;
+ font-weight: 500;
+ color: #a8b2d1;
+}
+
+.logStatusSuccess {
+ font-size: 12px;
+ font-weight: 600;
+ color: #64ffda;
+}
+
+.logStatusError {
+ font-size: 12px;
+ font-weight: 600;
+ color: #ff6b81;
+}
+
+.logWorkId {
+ font-size: 12px;
+ color: #8892b0;
+ font-family: 'JetBrains Mono', monospace;
+}
+
+.logMessage {
+ font-size: 13px;
+ color: #a8b2d1;
+ margin-top: 8px;
+}
+
+.logDetails {
+ margin-top: 12px;
+
+ summary {
+ font-size: 12px;
+ color: #64ffda;
+ cursor: pointer;
+ outline: none;
+
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+
+ pre {
+ margin: 8px 0 0;
+ padding: 12px;
+ background: rgba(0, 0, 0, 0.3);
+ border-radius: 6px;
+ font-size: 11px;
+ color: #8892b0;
+ overflow-x: auto;
+ font-family: 'JetBrains Mono', monospace;
+ }
+}
+
diff --git a/project/web/src/app/[lng]/websit/data-deletion/page.tsx b/project/web/src/app/[lng]/websit/data-deletion/page.tsx
index bc9f1d76..82af61f0 100644
--- a/project/web/src/app/[lng]/websit/data-deletion/page.tsx
+++ b/project/web/src/app/[lng]/websit/data-deletion/page.tsx
@@ -17,7 +17,7 @@ function Header() {
<a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
<a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
<a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a>
+ {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
</nav>
<button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
</div>
diff --git a/project/web/src/app/[lng]/websit/data-protection-agreement/page.tsx b/project/web/src/app/[lng]/websit/data-protection-agreement/page.tsx
index 171b6a7e..ef6ee985 100644
--- a/project/web/src/app/[lng]/websit/data-protection-agreement/page.tsx
+++ b/project/web/src/app/[lng]/websit/data-protection-agreement/page.tsx
@@ -17,7 +17,7 @@ function Header() {
<a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
<a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
<a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a>
+ {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
</nav>
<button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
</div>
diff --git a/project/web/src/app/[lng]/websit/privacy-policy/page.tsx b/project/web/src/app/[lng]/websit/privacy-policy/page.tsx
index 9fe8bf50..cf8bfeea 100644
--- a/project/web/src/app/[lng]/websit/privacy-policy/page.tsx
+++ b/project/web/src/app/[lng]/websit/privacy-policy/page.tsx
@@ -17,7 +17,7 @@ function Header() {
<a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
<a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
<a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a>
+ {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
</nav>
<button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
</div>
diff --git a/project/web/src/app/[lng]/websit/terms-of-service/page.tsx b/project/web/src/app/[lng]/websit/terms-of-service/page.tsx
index 5ce3dfa8..c2885bba 100644
--- a/project/web/src/app/[lng]/websit/terms-of-service/page.tsx
+++ b/project/web/src/app/[lng]/websit/terms-of-service/page.tsx
@@ -17,7 +17,7 @@ function Header() {
<a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
<a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
<a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a>
+ {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
</nav>
<button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
</div>
diff --git a/project/web/src/app/i18n/locales/en/route.json b/project/web/src/app/i18n/locales/en/route.json
index 8d5745ef..9c9c2977 100644
--- a/project/web/src/app/i18n/locales/en/route.json
+++ b/project/web/src/app/i18n/locales/en/route.json
@@ -9,6 +9,7 @@
"interactive": "Engage",
"engagement": "Engagement",
"dataStatistics": "Data",
+ "interactiveNew": "Engage New",
"dataMonitoring": "Data Monitoring",
"navigation": "Navigation",
"aiRank": "AI Rank"
diff --git a/project/web/src/app/i18n/locales/zh-CN/route.json b/project/web/src/app/i18n/locales/zh-CN/route.json
index a0ac6127..6788bba2 100644
--- a/project/web/src/app/i18n/locales/zh-CN/route.json
+++ b/project/web/src/app/i18n/locales/zh-CN/route.json
@@ -10,6 +10,7 @@
"interactive": "作品互动",
"engagement": "互动数据",
"dataStatistics": "数据统计",
+ "interactiveNew": "作品互动 new",
"dataMonitoring": "数据监控",
"navigation": "导航",
"aiRank": "AI热榜"
diff --git a/project/web/src/app/layout/routerData.ts b/project/web/src/app/layout/routerData.ts
index b6929f87..ea107ac2 100644
--- a/project/web/src/app/layout/routerData.ts
+++ b/project/web/src/app/layout/routerData.ts
@@ -19,11 +19,6 @@ export interface IRouterDataItem {
}
export const routerData: IRouterDataItem[] = [
- // {
- // name: "首页",
- // translationKey: "home",
- // path: "/",
- // },
{
name: '发布',
translationKey: 'accounts',
@@ -35,9 +30,9 @@ export const routerData: IRouterDataItem[] = [
path: '/interactive',
},
// {
- // name: "热门内容",
- // translationKey: "hotContent",
- // path: "/hotContent",
+ // name: '作品互动',
+ // translationKey: 'interactiveNew',
+ // path: '/interactiveNew',
// },
{
name: 'AI工具',
@@ -118,10 +113,10 @@ export const homeHeaderRouterData = {
href: 'https://docs.aitoearn.ai/',
title: directTrans('home', 'header.nav.docs'),
},
- {
- href: 'https://blog.aitoearn.ai/',
- title: directTrans('home', 'header.nav.blog'),
- },
+ // {
+ // href: 'https://blog.aitoearn.ai/',
+ // title: directTrans('home', 'header.nav.blog'),
+ // },
{
href: downloadHref,
title: directTrans('home', 'header.nav.download'),
diff --git a/project/web/src/store/plugin/CHANGELOG.md b/project/web/src/store/plugin/docs/CHANGELOG.md
similarity index 100%
rename from project/web/src/store/plugin/CHANGELOG.md
rename to project/web/src/store/plugin/docs/CHANGELOG.md
diff --git a/project/web/src/store/plugin/QUICK_START.md b/project/web/src/store/plugin/docs/QUICK_START.md
similarity index 100%
rename from project/web/src/store/plugin/QUICK_START.md
rename to project/web/src/store/plugin/docs/QUICK_START.md
diff --git a/project/web/src/store/plugin/README.md b/project/web/src/store/plugin/docs/README.md
similarity index 100%
rename from project/web/src/store/plugin/README.md
rename to project/web/src/store/plugin/docs/README.md
diff --git a/project/web/src/store/plugin/index.ts b/project/web/src/store/plugin/index.ts
index b1e98e06..fb44cdf0 100644
--- a/project/web/src/store/plugin/index.ts
+++ b/project/web/src/store/plugin/index.ts
@@ -71,3 +71,15 @@ export {
validateFileType,
withRetry,
} from './utils'
+
+// Platform Interaction (平台交互模块 - 点赞、评论、收藏等)
+export { platformManager, xhsInteraction, douyinInteraction } from './plats'
+export type {
+ BaseResult,
+ CommentParams,
+ CommentResult,
+ FavoriteResult,
+ IPlatformInteraction,
+ LikeResult,
+ SupportedPlatformType,
+} from './plats'
\ No newline at end of file
diff --git a/project/web/src/store/plugin/plats/README.md b/project/web/src/store/plugin/plats/README.md
new file mode 100644
index 00000000..cd427621
--- /dev/null
+++ b/project/web/src/store/plugin/plats/README.md
@@ -0,0 +1,167 @@
+# 平台交互模块 (plats)
+
+平台交互模块提供统一的接口来实现各平台的点赞、评论、收藏等交互功能。
+
+## 架构设计
+
+```
+flowchart TB
+ subgraph WebApp[Web 应用]
+ Manager[platformManager]
+ DouyinPlat[douyin/index.ts]
+ XhsPlat[xhs/index.ts]
+ end
+
+ subgraph Plugin[浏览器插件]
+ HomeInject[homeInject]
+ Background[background.ts]
+ Services[Platform Services]
+ end
+
+ Manager --> DouyinPlat
+ Manager --> XhsPlat
+ DouyinPlat --> HomeInject
+ XhsPlat --> HomeInject
+ HomeInject --> Background
+ Background --> Services
+```
+
+## 核心设计原则
+
+1. **统一接口**:所有平台实现 `IPlatformInteraction` 接口,对外隐藏实现细节
+2. **策略模式**:每个平台可自由选择 API 或自动化方案
+3. **幂等操作**:操作前检测当前状态,避免重复操作
+4. **易于扩展**:添加新平台只需实现接口并注册
+
+## 目录结构
+
+```
+plats/
+├── types.ts # 统一类型定义
+├── manager.ts # 平台管理器
+├── index.ts # 模块导出
+├── README.md # 本文档
+├── douyin/ # 抖音平台
+│ └── index.ts
+└── xhs/ # 小红书平台
+ └── index.ts
+```
+
+## 接口定义
+
+```typescript
+interface IPlatformInteraction {
+ readonly platformType: PlatType
+
+ likeWork(workId: string, isLike: boolean): Promise<LikeResult>
+ commentWork(params: CommentParams): Promise<CommentResult>
+ favoriteWork(workId: string, isFavorite: boolean): Promise<FavoriteResult>
+}
+```
+
+## 平台实现策略
+
+| 平台 | 点赞 | 评论 | 收藏 |
+|------|------|------|------|
+| 抖音 | 自动化 | API | 自动化 |
+| 小红书 | API | API | API |
+
+### 策略选择依据
+
+- **API 方案**:性能好、速度快,但可能受到风控限制
+- **自动化方案**:模拟真实用户操作,风控较低,但速度稍慢
+
+## 使用方式
+
+### 方式一:通过管理器调用(推荐)
+
+```typescript
+import { platformManager } from '@/store/plugin/plats'
+import { PlatType } from '@/app/config/platConfig'
+
+// 点赞
+await platformManager.likeWork(PlatType.Douyin, workId, true)
+
+// 评论
+await platformManager.commentWork(PlatType.Xhs, { workId, content: '评论内容' })
+
+// 收藏
+await platformManager.favoriteWork(PlatType.Douyin, workId, true)
+```
+
+### 方式二:直接使用平台实例
+
+```typescript
+import { douyinInteraction, xhsInteraction } from '@/store/plugin/plats'
+
+await douyinInteraction.likeWork(workId, true)
+await xhsInteraction.commentWork({ workId, content: '评论内容' })
+```
+
+## 扩展新平台
+
+### 步骤 1:创建平台目录和实现
+
+```typescript
+// plats/kuaishou/index.ts
+import { PlatType } from '@/app/config/platConfig'
+import type { IPlatformInteraction, ... } from '../types'
+
+class KuaishouPlatformInteraction implements IPlatformInteraction {
+ readonly platformType = PlatType.KWAI
+
+ async likeWork(workId: string, isLike: boolean): Promise<LikeResult> {
+ // 实现点赞逻辑
+ }
+
+ async commentWork(params: CommentParams): Promise<CommentResult> {
+ // 实现评论逻辑
+ }
+
+ async favoriteWork(workId: string, isFavorite: boolean): Promise<FavoriteResult> {
+ // 实现收藏逻辑
+ }
+}
+
+export const kuaishouInteraction = new KuaishouPlatformInteraction()
+```
+
+### 步骤 2:更新类型定义
+
+```typescript
+// plats/types.ts
+export type SupportedPlatformType = PlatType.Xhs | PlatType.Douyin | PlatType.KWAI
+```
+
+### 步骤 3:注册到管理器
+
+```typescript
+// plats/manager.ts
+import { kuaishouInteraction } from './kuaishou'
+
+constructor() {
+ this.platforms = new Map()
+ this.platforms.set(PlatType.Xhs, xhsInteraction)
+ this.platforms.set(PlatType.Douyin, douyinInteraction)
+ this.platforms.set(PlatType.KWAI, kuaishouInteraction) // 新增
+}
+```
+
+### 步骤 4:导出
+
+```typescript
+// plats/index.ts
+export { kuaishouInteraction } from './kuaishou'
+```
+
+## 插件端实现
+
+如果需要使用自动化方案,还需要在插件端实现对应的服务:
+
+1. 创建 `XxxInteractionService.ts`
+2. 更新 `homeInject/types.ts` 添加消息类型
+3. 更新 `homeInject/constants.ts` 添加 Action
+4. 更新 `homeInject/WebAPI.ts` 暴露方法
+5. 更新 `content_script_home.tsx` 转发消息
+6. 更新 `background.ts` 和 `HomeInjectBackgroundHandler.ts` 处理消息
+
diff --git a/project/web/src/store/plugin/plats/douyin/index.ts b/project/web/src/store/plugin/plats/douyin/index.ts
new file mode 100644
index 00000000..a43f7979
--- /dev/null
+++ b/project/web/src/store/plugin/plats/douyin/index.ts
@@ -0,0 +1,151 @@
+/**
+ * 抖音平台交互实现
+ *
+ * 实现策略:
+ * - 点赞、收藏、评论:统一使用自动化方案(避免 API 风控)
+ * - 评论:不支持二级评论
+ */
+
+import { PlatType } from '@/app/config/platConfig'
+import type {
+ CommentParams,
+ CommentResult,
+ DirectMessageParams,
+ DirectMessageResult,
+ FavoriteResult,
+ IPlatformInteraction,
+ LikeResult,
+} from '../types'
+
+/**
+ * 抖音平台交互类
+ */
+class DouyinPlatformInteraction implements IPlatformInteraction {
+ readonly platformType = PlatType.Douyin
+
+ /**
+ * 检查插件是否可用
+ */
+ private checkPlugin(): void {
+ if (!window.AIToEarnPlugin) {
+ throw new Error('插件未安装或未就绪')
+ }
+ }
+
+ /**
+ * 点赞/取消点赞作品(自动化方案)
+ * 使用自动化方案避免 API 风控
+ * @param workId 作品ID
+ * @param isLike true=点赞,false=取消点赞
+ */
+ async likeWork(workId: string, isLike: boolean): Promise<LikeResult> {
+ this.checkPlugin()
+
+ const response = await window.AIToEarnPlugin!.douyinInteraction({
+ action: 'like',
+ workId,
+ targetState: isLike,
+ })
+
+ return {
+ success: response.success,
+ message: response.message || response.error,
+ rawData: response,
+ }
+ }
+
+ /**
+ * 评论作品(自动化方案)
+ * 使用自动化方案避免 API 风控
+ * 注意:不支持二级评论
+ * @param params 评论参数
+ */
+ async commentWork(params: CommentParams): Promise<CommentResult> {
+ this.checkPlugin()
+
+ // 不支持二级评论
+ if (params.replyToCommentId) {
+ return {
+ success: false,
+ message: '抖音评论暂不支持二级评论',
+ }
+ }
+
+ const response = await window.AIToEarnPlugin!.douyinInteraction({
+ action: 'comment',
+ workId: params.workId,
+ targetState: true,
+ content: params.content,
+ })
+
+ return {
+ success: response.success,
+ message: response.message || response.error,
+ rawData: response,
+ }
+ }
+
+ /**
+ * 收藏/取消收藏作品(自动化方案)
+ * 使用自动化方案避免 API 风控
+ * @param workId 作品ID
+ * @param isFavorite true=收藏,false=取消收藏
+ */
+ async favoriteWork(workId: string, isFavorite: boolean): Promise<FavoriteResult> {
+ this.checkPlugin()
+
+ const response = await window.AIToEarnPlugin!.douyinInteraction({
+ action: 'favorite',
+ workId,
+ targetState: isFavorite,
+ })
+
+ return {
+ success: response.success,
+ message: response.message || response.error,
+ rawData: response,
+ }
+ }
+
+ /**
+ * 发送私信(自动化方案)
+ * 根据作品ID或作者链接发送私信
+ * 注意:小红书不支持私信
+ * @param params 私信参数
+ */
+ async sendDirectMessage(params: DirectMessageParams): Promise<DirectMessageResult> {
+ this.checkPlugin()
+
+ // 验证参数
+ if (!params.workId && !params.authorUrl) {
+ return {
+ success: false,
+ message: '必须提供作品ID或作者链接',
+ }
+ }
+
+ if (!params.content) {
+ return {
+ success: false,
+ message: '私信内容不能为空',
+ }
+ }
+
+ const response = await window.AIToEarnPlugin!.douyinDirectMessage({
+ workId: params.workId,
+ authorUrl: params.authorUrl,
+ content: params.content,
+ })
+
+ return {
+ success: response.success,
+ message: response.message || response.error,
+ rawData: response,
+ }
+ }
+}
+
+/**
+ * 抖音平台交互实例
+ */
+export const douyinInteraction = new DouyinPlatformInteraction()
diff --git a/project/web/src/store/plugin/plats/index.ts b/project/web/src/store/plugin/plats/index.ts
new file mode 100644
index 00000000..64dcdd6a
--- /dev/null
+++ b/project/web/src/store/plugin/plats/index.ts
@@ -0,0 +1,49 @@
+/**
+ * 平台交互模块
+ *
+ * 目录结构:
+ * plats/
+ * ├── types.ts # 统一类型定义
+ * ├── manager.ts # 统一管理器
+ * ├── xhs/ # 小红书
+ * │ └── index.ts
+ * ├── douyin/ # 抖音
+ * │ └── index.ts
+ * └── index.ts
+ *
+ * 使用方式:
+ *
+ * 1. 通过管理器调用(推荐):
+ * import { platformManager } from '@/store/plugin/plats'
+ * await platformManager.likeWork(PlatType.Xhs, workId, true)
+ *
+ * 2. 直接使用平台实例:
+ * import { xhsInteraction } from '@/store/plugin/plats'
+ * await xhsInteraction.likeWork(workId, true)
+ *
+ * 扩展新平台:
+ * 1. 创建 plats/[platform]/index.ts,实现 IPlatformInteraction 接口
+ * 2. 在 manager.ts 中 register 新平台
+ * 3. 在 types.ts 中添加到 SupportedPlatformType
+ * 4. 在此文件中导出
+ */
+
+// 类型导出
+export type {
+ BaseResult,
+ CommentParams,
+ CommentResult,
+ DirectMessageParams,
+ DirectMessageResult,
+ FavoriteResult,
+ IPlatformInteraction,
+ LikeResult,
+ SupportedPlatformType,
+} from './types'
+
+// 管理器
+export { platformManager } from './manager'
+
+// 平台实例
+export { xhsInteraction } from './xhs'
+export { douyinInteraction } from './douyin'
diff --git a/project/web/src/store/plugin/plats/manager.ts b/project/web/src/store/plugin/plats/manager.ts
new file mode 100644
index 00000000..5c0ab109
--- /dev/null
+++ b/project/web/src/store/plugin/plats/manager.ts
@@ -0,0 +1,125 @@
+/**
+ * 平台交互管理器
+ * 统一管理所有平台的交互操作
+ */
+
+import { PlatType } from '@/app/config/platConfig'
+import type {
+ CommentParams,
+ CommentResult,
+ DirectMessageParams,
+ DirectMessageResult,
+ FavoriteResult,
+ IPlatformInteraction,
+ LikeResult,
+ SupportedPlatformType,
+} from './types'
+import { xhsInteraction } from './xhs'
+import { douyinInteraction } from './douyin'
+
+/**
+ * 平台交互管理器
+ */
+class PlatformInteractionManager {
+ private platforms = new Map<SupportedPlatformType, IPlatformInteraction>()
+
+ constructor() {
+ this.register(xhsInteraction)
+ this.register(douyinInteraction)
+ }
+
+ /**
+ * 注册平台
+ */
+ register(platform: IPlatformInteraction): void {
+ this.platforms.set(platform.platformType as SupportedPlatformType, platform)
+ }
+
+ /**
+ * 获取平台实例
+ */
+ get(platform: SupportedPlatformType): IPlatformInteraction {
+ const instance = this.platforms.get(platform)
+ if (!instance) {
+ throw new Error(`不支持的平台: ${platform}`)
+ }
+ return instance
+ }
+
+ /**
+ * 检查是否支持该平台
+ */
+ isSupported(platform: PlatType): platform is SupportedPlatformType {
+ return this.platforms.has(platform as SupportedPlatformType)
+ }
+
+ /**
+ * 获取所有支持的平台
+ */
+ getSupportedPlatforms(): SupportedPlatformType[] {
+ return Array.from(this.platforms.keys())
+ }
+
+ /**
+ * 点赞/取消点赞
+ */
+ likeWork(
+ platform: SupportedPlatformType,
+ workId: string,
+ isLike: boolean,
+ ): Promise<LikeResult> {
+ return this.get(platform).likeWork(workId, isLike)
+ }
+
+ /**
+ * 评论作品
+ */
+ commentWork(
+ platform: SupportedPlatformType,
+ params: CommentParams,
+ ): Promise<CommentResult> {
+ return this.get(platform).commentWork(params)
+ }
+
+ /**
+ * 收藏/取消收藏
+ */
+ favoriteWork(
+ platform: SupportedPlatformType,
+ workId: string,
+ isFavorite: boolean,
+ ): Promise<FavoriteResult> {
+ return this.get(platform).favoriteWork(workId, isFavorite)
+ }
+
+ /**
+ * 检查平台是否支持私信功能
+ */
+ supportsDirectMessage(platform: SupportedPlatformType): boolean {
+ const instance = this.get(platform)
+ return typeof instance.sendDirectMessage === 'function'
+ }
+
+ /**
+ * 发送私信
+ * 注意:只有抖音支持私信,小红书不支持
+ */
+ async sendDirectMessage(
+ platform: SupportedPlatformType,
+ params: DirectMessageParams,
+ ): Promise<DirectMessageResult> {
+ const instance = this.get(platform)
+ if (!instance.sendDirectMessage) {
+ return {
+ success: false,
+ message: `${platform} 平台不支持私信功能`,
+ }
+ }
+ return instance.sendDirectMessage(params)
+ }
+}
+
+/**
+ * 管理器实例
+ */
+export const platformManager = new PlatformInteractionManager()
diff --git a/project/web/src/store/plugin/plats/types.ts b/project/web/src/store/plugin/plats/types.ts
new file mode 100644
index 00000000..b1264c0c
--- /dev/null
+++ b/project/web/src/store/plugin/plats/types.ts
@@ -0,0 +1,120 @@
+/**
+ * 平台交互统一类型定义
+ */
+
+import { PlatType } from '@/app/config/platConfig'
+
+// ============================================================================
+// 通用参数类型
+// ============================================================================
+
+/**
+ * 评论参数
+ */
+export interface CommentParams {
+ /** 作品ID */
+ workId: string
+ /** 评论内容 */
+ content: string
+ /** 回复的评论ID(可选,二级评论时使用) */
+ replyToCommentId?: string
+}
+
+// ============================================================================
+// 通用结果类型
+// ============================================================================
+
+/**
+ * 基础结果
+ */
+export interface BaseResult {
+ /** 是否成功 */
+ success: boolean
+ /** 错误/提示信息 */
+ message?: string
+ /** 原始响应数据 */
+ rawData?: any
+}
+
+/**
+ * 点赞结果
+ */
+export interface LikeResult extends BaseResult {}
+
+/**
+ * 评论结果
+ */
+export interface CommentResult extends BaseResult {
+ /** 评论ID */
+ commentId?: string
+}
+
+/**
+ * 收藏结果
+ */
+export interface FavoriteResult extends BaseResult {}
+
+/**
+ * 私信参数
+ */
+export interface DirectMessageParams {
+ /** 作品ID(二选一) */
+ workId?: string
+ /** 作者链接(二选一) */
+ authorUrl?: string
+ /** 私信内容 */
+ content: string
+}
+
+/**
+ * 私信结果
+ */
+export interface DirectMessageResult extends BaseResult {}
+
+// ============================================================================
+// 平台接口定义
+// ============================================================================
+
+/**
+ * 平台交互接口
+ * 所有平台都需要实现此接口
+ */
+export interface IPlatformInteraction {
+ /** 平台类型 */
+ readonly platformType: PlatType
+
+ /**
+ * 点赞/取消点赞作品
+ * @param workId 作品ID
+ * @param isLike true 点赞,false 取消点赞
+ */
+ likeWork(workId: string, isLike: boolean): Promise<LikeResult>
+
+ /**
+ * 评论作品
+ * @param params 评论参数
+ */
+ commentWork(params: CommentParams): Promise<CommentResult>
+
+ /**
+ * 收藏/取消收藏作品
+ * @param workId 作品ID
+ * @param isFavorite true 收藏,false 取消收藏
+ */
+ favoriteWork(workId: string, isFavorite: boolean): Promise<FavoriteResult>
+
+ /**
+ * 发送私信(可选方法,不是所有平台都支持)
+ * @param params 私信参数
+ */
+ sendDirectMessage?(params: DirectMessageParams): Promise<DirectMessageResult>
+}
+
+// ============================================================================
+// 支持的平台类型
+// ============================================================================
+
+/**
+ * 支持交互功能的平台类型
+ */
+export type SupportedPlatformType = PlatType.Xhs | PlatType.Douyin
diff --git a/project/web/src/store/plugin/plats/xhs/index.ts b/project/web/src/store/plugin/plats/xhs/index.ts
new file mode 100644
index 00000000..3953257a
--- /dev/null
+++ b/project/web/src/store/plugin/plats/xhs/index.ts
@@ -0,0 +1,137 @@
+/**
+ * 小红书平台交互实现
+ */
+
+import { PlatType } from '@/app/config/platConfig'
+import type {
+ CommentParams,
+ CommentResult,
+ FavoriteResult,
+ IPlatformInteraction,
+ LikeResult,
+} from '../types'
+
+/**
+ * 小红书平台交互类
+ */
+class XhsPlatformInteraction implements IPlatformInteraction {
+ readonly platformType = PlatType.Xhs
+
+ /**
+ * 检查插件是否可用
+ */
+ private checkPlugin(): void {
+ if (!window.AIToEarnPlugin) {
+ throw new Error('插件未安装或未就绪')
+ }
+ }
+
+ /**
+ * 点赞/取消点赞作品
+ */
+ async likeWork(workId: string, isLike: boolean): Promise<LikeResult> {
+ this.checkPlugin()
+
+ const path = isLike
+ ? '/api/sns/web/v1/note/like'
+ : '/api/sns/web/v1/note/dislike'
+
+ const response = await window.AIToEarnPlugin!.xhsRequest<{
+ success: boolean
+ code: number
+ msg?: string
+ }>({
+ path,
+ method: 'POST',
+ data: { note_oid: workId },
+ })
+
+ return {
+ success: response.success,
+ message: response.msg,
+ rawData: response,
+ }
+ }
+
+ /**
+ * 评论作品
+ */
+ async commentWork(params: CommentParams): Promise<CommentResult> {
+ this.checkPlugin()
+
+ const data: {
+ note_id: string
+ content: string
+ at_users: Array<{ user_id: string, nickname: string }>
+ target_comment_id?: string
+ } = {
+ note_id: params.workId,
+ content: params.content,
+ at_users: [],
+ }
+
+ if (params.replyToCommentId) {
+ data.target_comment_id = params.replyToCommentId
+ }
+
+ const response = await window.AIToEarnPlugin!.xhsRequest<{
+ success: boolean
+ code: number
+ msg?: string
+ data?: {
+ comment: {
+ id: string
+ [key: string]: any
+ }
+ }
+ }>({
+ path: '/api/sns/web/v1/comment/post',
+ method: 'POST',
+ data,
+ })
+
+ return {
+ success: response.success,
+ commentId: response.data?.comment?.id,
+ message: response.msg,
+ rawData: response,
+ }
+ }
+
+ /**
+ * 收藏/取消收藏作品
+ */
+ async favoriteWork(workId: string, isFavorite: boolean): Promise<FavoriteResult> {
+ this.checkPlugin()
+
+ const path = isFavorite
+ ? '/api/sns/web/v1/note/collect'
+ : '/api/sns/web/v1/note/uncollect'
+
+ const data = isFavorite
+ ? { note_id: workId }
+ : { note_ids: workId }
+
+ const response = await window.AIToEarnPlugin!.xhsRequest<{
+ success: boolean
+ code: number
+ msg?: string
+ }>({
+ path,
+ method: 'POST',
+ data,
+ })
+
+ return {
+ success: response.success,
+ message: response.msg,
+ rawData: response,
+ }
+ }
+}
+
+/**
+ * 小红书平台交互实例
+ */
+export const xhsInteraction = new XhsPlatformInteraction()
+
diff --git a/project/web/src/store/plugin/store.ts b/project/web/src/store/plugin/store.ts
index a16d5083..9a722e09 100644
--- a/project/web/src/store/plugin/store.ts
+++ b/project/web/src/store/plugin/store.ts
@@ -132,6 +132,7 @@ export const usePluginStore = create(
/** 检查插件是否安装 */
checkPlugin() {
const isAvailable = typeof window !== 'undefined' && !!window.AIToEarnPlugin
+
if (!isAvailable) {
set({ status: Status.NOT_INSTALLED })
return false
diff --git a/project/web/src/store/plugin/types/baseTypes.ts b/project/web/src/store/plugin/types/baseTypes.ts
index 34817d20..01c247ff 100644
--- a/project/web/src/store/plugin/types/baseTypes.ts
+++ b/project/web/src/store/plugin/types/baseTypes.ts
@@ -86,6 +86,63 @@ export interface PermissionCheckResult {
permissions?: string[]
}
+/**
+ * HTTP 请求方法类型
+ */
+export type HttpMethod = 'GET' | 'POST' | 'DELETE'
+
+/**
+ * 平台通用请求参数
+ */
+export interface PlatformRequestParams {
+ /** API 路径 */
+ path: string
+ /** HTTP 方法,默认 POST */
+ method?: HttpMethod
+ /** 请求数据 */
+ data?: any
+ /** 额外请求头 */
+ headers?: Record<string, string>
+}
+
+/**
+ * 抖音交互操作参数
+ */
+export interface DouyinInteractionParams {
+ /** 操作类型:点赞、收藏、评论 */
+ action: 'like' | 'favorite' | 'comment'
+ /** 作品ID */
+ workId: string
+ /** 目标状态:true=执行操作,false=取消操作 */
+ targetState: boolean
+ /** 评论内容(action 为 comment 时必填) */
+ content?: string
+}
+
+/**
+ * 抖音私信参数
+ */
+export interface DouyinDirectMessageParams {
+ /** 作品ID(二选一) */
+ workId?: string
+ /** 作者链接(二选一) */
+ authorUrl?: string
+ /** 私信内容 */
+ content: string
+}
+
+/**
+ * 抖音交互操作结果
+ */
+export interface DouyinInteractionResult {
+ /** 是否成功 */
+ success: boolean
+ /** 提示信息 */
+ message?: string
+ /** 错误信息 */
+ error?: string
+}
+
/**
* 插件 API 接口定义
*/
@@ -113,6 +170,38 @@ export interface AIToEarnPluginAPI {
params: PublishParams,
onProgress?: ProgressCallback,
) => Promise<PublishResult>
+
+ /**
+ * 小红书通用请求
+ * 自动处理签名,返回原始响应
+ * @param params 请求参数
+ * @returns Promise<响应数据>
+ */
+ xhsRequest: <T = any>(params: PlatformRequestParams) => Promise<T>
+
+ /**
+ * 抖音通用请求
+ * 返回原始响应
+ * @param params 请求参数
+ * @returns Promise<响应数据>
+ */
+ douyinRequest: <T = any>(params: PlatformRequestParams) => Promise<T>
+
+ /**
+ * 抖音交互操作(自动化方案)
+ * 支持点赞、收藏、评论
+ * @param params 交互参数
+ * @returns Promise<交互结果>
+ */
+ douyinInteraction: (params: DouyinInteractionParams) => Promise<DouyinInteractionResult>
+
+ /**
+ * 抖音私信(自动化方案)
+ * 根据作品ID或作者链接发送私信
+ * @param params 私信参数
+ * @returns Promise<私信结果>
+ */
+ douyinDirectMessage: (params: DouyinDirectMessageParams) => Promise<DouyinInteractionResult>
}
/**