Skip to content

Let's use AI to Earn!

1. google登录之后,不要跳首页,直接跳转web应用 2. 账号管理这块,空间下面增加一个add channels的按键 3. 底部增加一个Add space的按键 右侧叫 Add channel 4.小红书是全球平台,不局限于中国ip

daoyian7f1610295387
diff --git a/@types/resources.d.ts b/@types/resources.d.ts
index 7a4ba3a0..bd3007bf 100644
--- a/@types/resources.d.ts
+++ b/@types/resources.d.ts
@@ -10,7 +10,7 @@ interface Resources {
"newWork": "新建作品",
"allPlatforms": "所有平台",
"accountManager": "账号管理器",
- "addAccount": "添加账号",
+ "addAccount": "添加频道",
"mcpManager": "MCP 管理器",
"online": "在线",
"offline": "离线",
@@ -54,6 +54,17 @@ interface Resources {
"loading": "获取IP信息中...",
"error": "IP信息获取失败",
"tooltip": "ASN: {{asn}}\n组织: {{org}}"
+ },
+ "createSpace": {
+ "title": "新建空间",
+ "button": "新建空间",
+ "name": "空间名",
+ "namePlaceholder": "请输入空间名称",
+ "cancel": "取消",
+ "save": "保存",
+ "success": "新建空间成功",
+ "failed": "新建空间失败",
+ "nameRequired": "请输入空间名称"
}
},
"cgmaterial": {
diff --git a/src/api/vip.ts b/src/api/vip.ts
index 3d8bbbb5..a686645b 100644
--- a/src/api/vip.ts
+++ b/src/api/vip.ts
@@ -11,15 +11,17 @@ export enum PaymentType {
MONTH = 'month', // 月度订阅
YEAR = 'year', // 年度订阅
ONCE_MONTH = 'onceMonth', // 一次性月度
- ONCE_YEAR = 'onceYear' // 一次性年度
+ ONCE_YEAR = 'onceYear', // 一次性年度
+ POINTS = 'points' // 积分购买
}
// 创建支付订单参数接口
export interface CreatePaymentOrderParams {
- success_url: string;
+ success_url?: string;
mode: string;
payment: PaymentType;
flagTrialPeriodDays?: number; // 订阅模式下是否给七天免费试用时长, 0 - 不给, 1-给
+ quantity?: number; // 购买数量,用于积分购买
metadata: {
userId: string;
};
diff --git a/src/app/[lng]/README.md b/src/app/[lng]/README.md
deleted file mode 100644
index 6d4872b4..00000000
--- a/src/app/[lng]/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-## Key Features
-
-🚀 **AiToEarn is a full-stack AI-powered content growth & monetization platform.**
-From creative ideas, to multi-channel publishing, to analytics & monetization — AiToEarn helps you truly **Create · Publish · Engage · Monetize.**
-
-
-### 1. Content Publishing — One-Click Multi-Platform
-
-* **Distribute Everywhere**: Publish to the widest range of global platforms (Douyin, Kwai, WeChat, Bilibili, Rednote, Facebook, Instagram, TikTok, LinkedIn, Threads, Bluesky, YouTube Shorts, Pinterest, Google Business, Mastodon, X).
-* **(Coming soon) Smart Import**: Import historical content for fast re-editing & redistribution.
-
- * Example: Sync your Xiaohongshu posts to YouTube in one click.
-* **Calendar Scheduler**: Plan & coordinate content like a calendar across all platforms.
-<div style="display: flex; justify-content: space-around;">
- <img src="src/assets/images/app-screenshot/1. content publish/calendar.jpeg" width="30%">
- <img src="src/assets/images/app-screenshot/1. content publish/support_channels.jpeg" width="30%">
-</div>
-
-### 2. Content Hotspot — Viral Inspiration Engine
-
-* **Case Library**: Explore how others create posts with 10,000+ likes.
-* **Trend Radar**: Discover the latest viral trends instantly, reduce creator anxiety.
-<div style="display: flex; justify-content: space-around;">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot.jpg" width="22%">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot2.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot3.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot4.jpeg" width="22%">
-</div>
-
-### 3. Content Search — Brand & Market Insights
-
-* **Brand Monitoring**: Track conversations about your brand in real-time.
-* **Content Discovery**: Search for posts, topics, and communities for targeted engagement.
-
-<div style="display:flex; justify-content:space-between; align-items:center;">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch.gif" width="22%">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch1.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch2.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch4.jpeg" width="22%">
-</div>
-
-
-### 4. Comments Search — Precision User Mining
-
-* **Smart Comment Search**: Detect high-conversion signals like “link please” or “how to buy.”
-* **Conversion Booster**: Reply instantly, drive higher engagement & sales.
- <div style="display:flex; justify-content:space-between; align-items:center;">
- <img src="src/assets/images/app-screenshot/4. comments search/commentsearch.gif" width="30%">
- <img src="src/assets/images/app-screenshot/4. comments search/commentfilter.jpeg" width="30%">
-</div>
-
-### 5. Content Engagement — Growth Engine
-
-* **Unified Dashboard**: Manage all interactions in one place.
-* **Proactive Engagement**: Join trending conversations, connect with potential customers.
-* Turn **passive operations** into **active traffic growth.**
-
- <div style="display:flex; justify-content:space-between; align-items:center;">
- <img src="src/assets/images/app-screenshot/5. content engagement/commentfilter2.jpeg" width="30%">
-</div>
-
-### 6. (Coming Soon) Content Analytics — Full-Funnel Data
-
-* **Cross-Platform Comparison**: One platform may block traffic, but others won’t.
-* **End-to-End Monitoring**: Track performance and build your path to 1M+ followers.
-
-<img src="./presentation/data_center.png" alt="post" width="500"/>
-
-### 7. (Coming Soon) AI Content Creation — End-to-End Assistant
-
-* **AI Copywriting**: Auto-generate titles, captions & descriptions.
-* **AI Commenting**: Engage proactively, attract traffic.
-* **Image & Card Generator**: Speed up content workflows.
-* **Supported AI Video Models**: Seedance, Kling, Hailuo, Veo, Medjourney, Sora, Pika, Runway.
-* **Supported AI Image Models**: GPT, Flux.
-* **Next**: Tag generator, smart DMs, video editing, AI avatars, translation for global distribution.
-
-
-### 8. (Coming Soon) Content Marketplace — Trade & Monetize
-
-* **Creators**: Sell your content directly, find buyers fast.
-* **Brands**: Purchase ready-made, high-quality content.
-* **AI-Powered Growth**:
- **Let’s use AI to earn. Let’s earn money together!**
-
-
-💡 In short:
-Aitoearn = Buffer + Hootsuite + AI-powered Creativity & Monetization Engine.
- It’s not just about “managing content”—it’s about helping you create, amplify, and monetize your content, completing the cycle from traffic to revenue.
\ No newline at end of file
diff --git a/src/app/[lng]/README_CN.md b/src/app/[lng]/README_CN.md
deleted file mode 100644
index 74ef6da1..00000000
--- a/src/app/[lng]/README_CN.md
+++ /dev/null
@@ -1,94 +0,0 @@
-
-## 核心功能
-
-🚀Aitoearn 不只是一个内容管理工具,它是一整套 **AI 驱动的全链路内容增长与变现平台**。
-从创意灵感到多平台分发,再到数据分析和商业化,Aitoearn 让你的内容真正做到:
-**Create · Publish · Engage · Monetize**
-
-
-### 1. Content Publishing — 一键发布 · 多平台触达
-
-* **多平台分发**:支持全球最多主流社交平台(Douyin, Kwai, Wechat, Bilibili, Rednote, Facebook, Instagram, TikTok, LinkedIn, Threads, Bluesky, YouTube Shorts, Pinterest, Google Business, Mastodon, X)。
-* **(即将上线)智能导入**:直接导入历史内容,快速编辑、二次分发。
-
- * 例如:小红书创作者可一键同步到 YouTube,让更多用户看到。
-* **日历编排**:像操作日历一样规划内容,实现多平台协同发布。
-<div style="display: flex; justify-content: space-around;">
- <img src="src/assets/images/app-screenshot/1. content publish/calendar.jpeg" width="30%">
- <img src="src/assets/images/app-screenshot/1. content publish/support_channels.jpeg" width="30%">
-</div>
-
-
-
-### 2. Content Hotspot — 爆款灵感引擎
-
-* **爆款案例库**:随时查看他人如何打造 10,000+ 点赞的内容。
-* **趋势捕捉**:快速发现流行趋势,降低创作焦虑。
-<div style="display: flex; justify-content: space-around;">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot.jpg" width="22%">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot2.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot3.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/2. content hotspot/hotspot4.jpeg" width="22%">
-</div>
-
-
-
-### 3. Content Search — 品牌与市场洞察
-
-* **品牌监控**:实时追踪品牌相关讨论,第一时间响应。
-* **内容搜索**:找到目标帖子和话题,高效互动,精准拓展市场。
-<div style="display:flex; justify-content:space-between; align-items:center;">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch.gif" width="22%">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch1.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch2.jpeg" width="22%">
- <img src="src/assets/images/app-screenshot/3.%20content%20search/contentsearch4.jpeg" width="22%">
-</div>
-
-
-### 4. Comments Search — 精准用户挖掘
-
-* 用户真实需求往往藏在 **评论区**。
-* **智能评论搜索**:快速发现“求链接”“怎么购买”等高转化信号。
-* **精准转化**:主动回复,提升流量变现效率。
- <div style="display:flex; justify-content:space-between; align-items:center;">
- <img src="src/assets/images/app-screenshot/4. comments search/commentsearch.gif" width="30%">
- <img src="src/assets/images/app-screenshot/4. comments search/commentfilter.jpeg" width="30%">
-</div>
-
-
-### 5. Content Engagement — 互动与增长引擎
-
-* **统一后台**:集中管理所有内容,互动零遗漏。
-* **主动运营**:参与热门话题,与潜在用户双向互动。
-* 把 **“被动内容运营”** 变成 **“主动流量经营”**。
- <div style="display:flex; justify-content:space-between; align-items:center;">
- <img src="src/assets/images/app-screenshot/5. content engagement/commentfilter2.jpeg" width="30%">
-</div>
-
-
-### 6. (即将上线)Content Analytics — 全景化数据视图
-
-* **多平台对比**:一个平台不给流量,不代表所有平台不给。
-* **全链路监控**:追踪内容表现,助力打造下一个百万博主。
-<img src="./presentation/data_center.png" alt="post" width="500"/>
-
-### 7. (即将上线)AI Content Creation — 全流程 AI 助手
-
-* **AI 文案生成**:自动生成标题、描述,高效产出。
-* **AI 评论生成**:主动出击,获取流量。
-* **图文卡片生成**,全流程加速创作。
-* **支持主流 AI 视频模型**:Seedance, Kling, Hailuo, Veo, Medjourney, Sora, Pika, Runway。
-* **支持主流 AI 图片模型**:GPT, Flux。
-* **即将上线功能**:标签生成器、自动私信管理、智能剪辑、数字人生成、视频翻译 —— 助力多语言全球化内容分发。
-
-
-
-### 8. (即将上线)Content Marketplace — 内容交易与变现
-
-* **创作者变现**:在平台直接出售内容,让优质作品快速找到买家。
-* **品牌采购**:企业可直接购买现成内容,节省时间与成本。
-* **AI 赋能**:让创作变成收益 ——
- **Let’s use AI to earn. Let’s earn money together!**
-
-💡 简而言之:Aitoearn = Buffer + Hootsuite + AI 创意与变现引擎。
- 它不仅仅是“管理内容”,而是帮你 创造内容、放大内容、卖出内容,真正实现 从流量到收益的闭环。
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
index 70d39220..36d93671 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
@@ -170,7 +170,6 @@
.ant-collapse {
overflow: auto;
- height: 100%;
border: none;
background: transparent;
.ant-collapse-content-box {
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
index 2524d4aa..51da708c 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
@@ -8,7 +8,7 @@ import {
useState,
} from "react";
import styles from "./AccountSidebar.module.scss";
-import { Avatar, Button, Collapse, Popover, Skeleton, Tooltip } from "antd";
+import { Avatar, Button, Collapse, Popover, Skeleton, Tooltip, Modal, Input, message, Select } from "antd";
// import { accountLogin, acpAccountLoginCheck } from "@/icp/account";
import {
CheckCircleOutlined,
@@ -25,7 +25,9 @@ import { AccountStatus } from "@/app/config/accountConfig";
import { SocialAccount } from "@/api/types/account.type";
import { getOssUrl } from "@/utils/oss";
import { useTransClient } from "@/app/i18n/client";
-import { getIpLocation, IpLocationInfo, formatLocationInfo } from "@/utils/ipLocation";
+import { getIpLocation, IpLocationInfo, formatLocationInfo, extractCountry } from "@/utils/ipLocation";
+import { createAccountGroupApi, updateAccountApi } from "@/api/account";
+import AddAccountModal from "../AddAccountModal";
export interface IAccountSidebarRef {}
@@ -139,12 +141,14 @@ const AccountSidebar = memo(
const {
accountList: fullAccountList,
getAccountList,
+ getAccountGroup,
accountGroupList,
accountLoading,
} = useAccountStore(
useShallow((state) => ({
accountList: state.accountList,
getAccountList: state.getAccountList,
+ getAccountGroup: state.getAccountGroup,
accountGroupList: state.accountGroupList,
accountLoading: state.accountLoading,
})),
@@ -158,6 +162,28 @@ const AccountSidebar = memo(
const [ipLocationInfo, setIpLocationInfo] = useState<IpLocationInfo | null>(null);
const [ipLocationLoading, setIpLocationLoading] = useState(false);
+ // 新建空间状态
+ const [openCreateGroup, setOpenCreateGroup] = useState(false);
+ const [groupName, setGroupName] = useState("");
+ const [createGroupLoading, setCreateGroupLoading] = useState(false);
+
+ // 新建空间相关函数
+ const createGroupCancel = () => {
+ setOpenCreateGroup(false);
+ setGroupName("");
+ };
+
+ // 添加账号相关状态
+ const [isAddAccountOpen, setIsAddAccountOpen] = useState(false);
+ const [targetGroupIdForModal, setTargetGroupIdForModal] = useState<string | undefined>(undefined);
+ const [chooseGroupOpen, setChooseGroupOpen] = useState(false);
+ const [chosenGroupId, setChosenGroupId] = useState<string | undefined>(undefined);
+ const preAccountIds = useRef<Set<string>>(new Set());
+ const pendingGroupIdRef = useRef<string | null>(null);
+ const isAssigningRef = useRef(false);
+ const snapshotReadyRef = useRef(false);
+ const allUser = useRef("-1");
+
// 在组件内部过滤账号列表,而不是在 useAccountStore 中过滤
const accountList = useMemo(() => {
return fullAccountList.filter(
@@ -187,6 +213,62 @@ const AccountSidebar = memo(
fetchIpLocation();
}, []);
+ // 添加账号流程
+ const openAddAccountFlow = async () => {
+ if (accountGroupList.length === 0) {
+ message.error("请先创建空间");
+ return;
+ }
+
+ // 如果有多个空间,让用户选择
+ if (accountGroupList.length > 1) {
+ setChosenGroupId(accountGroupList[0]?.id);
+ setChooseGroupOpen(true);
+ } else {
+ // 只有一个空间,直接使用
+ const currentGroupId = accountGroupList[0]?.id;
+ pendingGroupIdRef.current = currentGroupId;
+ setTargetGroupIdForModal(currentGroupId);
+ if ((useAccountStore.getState().accountList || []).length === 0) {
+ await getAccountList();
+ }
+ preAccountIds.current = new Set(
+ (useAccountStore.getState().accountList || []).map((v) => v.id),
+ );
+ snapshotReadyRef.current = true;
+ setIsAddAccountOpen(true);
+ }
+ };
+
+ // 监听账号列表变化,自动分配新账号到当前空间
+ useEffect(() => {
+ const maybeAssign = async () => {
+ if (!pendingGroupIdRef.current) return;
+ if (isAssigningRef.current) return;
+ if (!snapshotReadyRef.current) return;
+ const currList = fullAccountList || [];
+ const newAccounts = currList.filter((a) => !preAccountIds.current.has(a.id));
+ if (newAccounts.length === 0) return;
+ isAssigningRef.current = true;
+ try {
+ const targetGroupId = pendingGroupIdRef.current!;
+ for (const acc of newAccounts) {
+ try {
+ await updateAccountApi({ id: acc.id, groupId: targetGroupId });
+ } catch {}
+ }
+ await getAccountList();
+ message.success(t("accountAddedToSpace"));
+ } finally {
+ pendingGroupIdRef.current = null;
+ preAccountIds.current = new Set();
+ isAssigningRef.current = false;
+ snapshotReadyRef.current = false;
+ }
+ };
+ maybeAssign();
+ }, [fullAccountList]);
+
return (
<>
<UserManageModal
@@ -199,6 +281,121 @@ const AccountSidebar = memo(
open={mcpManagerModalOpen}
onClose={setMcpManagerModalOpen}
/>
+
+ <AddAccountModal
+ open={isAddAccountOpen}
+ onClose={async () => {
+ setIsAddAccountOpen(false);
+ setTargetGroupIdForModal(undefined);
+ }}
+ onAddSuccess={async (acc) => {
+ try {
+ if (pendingGroupIdRef.current) {
+ await updateAccountApi({ id: acc.id, groupId: pendingGroupIdRef.current });
+ message.success(t("accountAddedToSpace"));
+ }
+ } finally {
+ pendingGroupIdRef.current = null;
+ await getAccountList();
+ }
+ }}
+ targetGroupId={targetGroupIdForModal}
+ />
+
+ {/* 选择空间Modal */}
+ <Modal
+ open={chooseGroupOpen}
+ title={t("chooseSpace")}
+ onCancel={() => setChooseGroupOpen(false)}
+ onOk={async () => {
+ if (!chosenGroupId) return message.warning(t("pleaseChooseSpace"));
+ pendingGroupIdRef.current = chosenGroupId;
+ setTargetGroupIdForModal(chosenGroupId);
+ if ((useAccountStore.getState().accountList || []).length === 0) {
+ await getAccountList();
+ }
+ preAccountIds.current = new Set(
+ (useAccountStore.getState().accountList || []).map((v) => v.id),
+ );
+ snapshotReadyRef.current = true;
+ setChooseGroupOpen(false);
+ setIsAddAccountOpen(true);
+ }}
+ width={420}
+ >
+ <Select
+ style={{ width: "100%" }}
+ placeholder={t("pleaseChooseSpace")}
+ value={chosenGroupId}
+ onChange={setChosenGroupId}
+ options={accountGroupList.map((g) => ({ value: g.id, label: g.name }))}
+ />
+ </Modal>
+
+ {/* 新建空间Modal */}
+ <Modal
+ open={openCreateGroup}
+ title={t("createSpace.title")}
+ onCancel={createGroupCancel}
+ footer={
+ <>
+ <Button onClick={createGroupCancel}>{t("createSpace.cancel")}</Button>
+ <Button
+ type="primary"
+ onClick={async () => {
+ if (!groupName.trim()) {
+ message.error(t("createSpace.nameRequired"));
+ return;
+ }
+ setCreateGroupLoading(true);
+ try {
+ await createAccountGroupApi({
+ name: groupName.trim(),
+ });
+ await getAccountGroup();
+ message.success(t("createSpace.success"));
+ createGroupCancel();
+ } catch (error) {
+ message.error(t("createSpace.failed"));
+ } finally {
+ setCreateGroupLoading(false);
+ }
+ }}
+ loading={createGroupLoading}
+ >
+ {t("createSpace.save")}
+ </Button>
+ </>
+ }
+ >
+ <div className={styles.createGroup}>
+ <label>{t("createSpace.name")}</label>
+ <Input
+ value={groupName}
+ placeholder={t("createSpace.namePlaceholder")}
+ onChange={(e) => setGroupName(e.target.value)}
+ onPressEnter={async () => {
+ if (!groupName.trim()) {
+ message.error(t("createSpace.nameRequired"));
+ return;
+ }
+ setCreateGroupLoading(true);
+ try {
+ await createAccountGroupApi({
+ name: groupName.trim(),
+ });
+ await getAccountGroup();
+ message.success(t("createSpace.success"));
+ createGroupCancel();
+ } catch (error) {
+ message.error(t("createSpace.failed"));
+ } finally {
+ setCreateGroupLoading(false);
+ }
+ }}
+ />
+ </div>
+ </Modal>
{/*TODO 在线状态检测 */}
{/*<PubAccountDetModule*/}
{/* title="账号检测"*/}
@@ -252,7 +449,7 @@ const AccountSidebar = memo(
const isDefaultGroup = v.isDefault;
const showIpInfo = isDefaultGroup && ipLocationInfo;
- return {
+ return {
key: v.id,
label: (
<>
@@ -288,13 +485,15 @@ const AccountSidebar = memo(
<div className="accountSidebar-ipInfo">
<Tooltip title={`IP: ${v.ip}\n位置: ${v.location}`}>
<span className="accountSidebar-ipText">
- {v.ip} | {v.location}
+ {extractCountry(v.location)} | {v.ip}
</span>
</Tooltip>
</div>
)
)}
</div>
+
+
</>
),
children: (
@@ -359,6 +558,7 @@ const AccountSidebar = memo(
</li>
);
})}
+
</ul>
),
};
@@ -366,6 +566,32 @@ const AccountSidebar = memo(
/>
)}
+ {/* 添加账号按钮 */}
+ <div style={{ padding: "10px", height: "100%", paddingTop: "20px" }}>
+ <Button
+ type="default"
+ icon={<PlusOutlined />}
+ onClick={openAddAccountFlow}
+ style={{ width: "100%" }}
+ >
+ {t("addAccount")}
+ </Button>
+ </div>
+
+ {/* 新建空间按钮 */}
+ <div style={{ padding: "10px", borderTop: "1px solid var(--grayColor3)" }}>
+ <Button
+ type="primary"
+ icon={<PlusOutlined />}
+ onClick={() => {
+ setOpenCreateGroup(true);
+ }}
+ style={{ width: "100%" }}
+ >
+ {t("createSpace.button")}
+ </Button>
+ </div>
+
{/*<div className="accountSidebar-footer">*/}
{/* <Button*/}
{/* type="link"*/}
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
index e9489f07..92508574 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
@@ -39,7 +39,7 @@ import AvatarPlat from "@/components/AvatarPlat";
import { deleteAccountsApi, updateAccountApi } from "@/api/account";
import { useTransClient } from "@/app/i18n/client";
import AddAccountModal from "../AddAccountModal";
-import { getIpLocation, IpLocationInfo, formatLocationInfo } from "@/utils/ipLocation";
+import { getIpLocation, IpLocationInfo, formatLocationInfo, extractCountry } from "@/utils/ipLocation";
export interface IUserManageModalRef {
setActiveGroup: (groupId: string) => void;
@@ -194,7 +194,7 @@ const SpaceInfoCard = ({
cursor: 'help',
fontWeight: '500'
}}>
- {currentSpace.ip} | {currentSpace.location}
+ {extractCountry(currentSpace.location)} | {currentSpace.ip}
</span>
</Tooltip>
</div>
@@ -410,7 +410,7 @@ const UserManageModal = memo(
};
useImperativeHandle(ref, () => imperativeHandle);
- const openAddAccountFlow = async () => {
+ const openAddAccountFlow = async () => {
const currentGroupId = activeGroup;
close();
if (currentGroupId === allUser.current) {
diff --git a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
index e60ed9d8..e8b67710 100644
--- a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
+++ b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
@@ -53,6 +53,8 @@ const AddAccountModal = memo(
const [isLocLoading, setIsLocLoading] = useState(false);
useEffect(() => {
+
+
if (!open || !targetGroupId) {
setIsCnSpace(null);
setIsLocLoading(false);
@@ -92,10 +94,11 @@ const AddAccountModal = memo(
// 判断平台是否在当前属地可用
const isPlatformAvailable = (platType: PlatType): boolean => {
+ // TODO: 暂时屏蔽国内平台 @@.@@
+ // return true;
if (isCnSpace === null) return true; // 未确定属地时显示所有平台
const cnOnlyPlatforms = new Set<PlatType>([
- PlatType.Xhs,
PlatType.Douyin,
PlatType.KWAI,
PlatType.WxGzh,
diff --git a/src/app/[lng]/login/page.tsx b/src/app/[lng]/login/page.tsx
index 2cd70858..8a026421 100644
--- a/src/app/[lng]/login/page.tsx
+++ b/src/app/[lng]/login/page.tsx
@@ -93,7 +93,7 @@ export default function LoginPage() {
setUserInfo(response.data.userInfo);
}
message.success(t('registerSuccess'));
- router.push('/');
+ router.push('/accounts');
}
} catch (error) {
console.error(t('checkStatusError'), error);
diff --git a/src/app/[lng]/profile/page.tsx b/src/app/[lng]/profile/page.tsx
index 3337eea6..81b1984d 100644
--- a/src/app/[lng]/profile/page.tsx
+++ b/src/app/[lng]/profile/page.tsx
@@ -5,7 +5,8 @@ import { Card, Descriptions, Button, message, Modal, Form, Input, Tabs, Table, T
import { CrownOutlined, TrophyOutlined, GiftOutlined, StarOutlined, RocketOutlined, ThunderboltOutlined, HistoryOutlined, DollarOutlined, ShoppingCartOutlined, UserOutlined, GiftFilled } from "@ant-design/icons";
import { useRouter } from "next/navigation";
import { useUserStore } from "@/store/user";
-import { getUserInfoApi, updateUserInfoApi, getPointsRecordsApi, rechargePointsApi } from "@/api/apiReq";
+import { getUserInfoApi, updateUserInfoApi, getPointsRecordsApi } from "@/api/apiReq";
+import { createPaymentOrderApi, PaymentType as VipPaymentType } from "@/api/vip";
import { getOrderListApi, getOrderDetailApi, getSubscriptionListApi, refundOrderApi, unsubscribeApi } from "@/api/payment";
import type { Order, OrderListParams, SubscriptionListParams, RefundParams, UnsubscribeParams } from "@/api/types/payment";
import { OrderStatus, PaymentType } from "@/api/types/payment";
@@ -70,6 +71,8 @@ export default function ProfilePage() {
const [rechargeAmount, setRechargeAmount] = useState(8);
const [rechargeForm] = Form.useForm();
const [isDragging, setIsDragging] = useState(false);
+ const [paymentOrderId, setPaymentOrderId] = useState<string | null>(null);
+ const [showPaymentSuccess, setShowPaymentSuccess] = useState(false);
// 积分记录类型定义
interface PointsRecord {
@@ -351,26 +354,75 @@ export default function ProfilePage() {
const handleRechargeSubmit = async (values: any) => {
try {
- const totalPrice = rechargeAmount * 15; // 每1000积分15美元
- const response = await rechargePointsApi({
- amount: rechargeAmount,
- totalPrice: totalPrice
+ const response = await createPaymentOrderApi({
+ success_url: `${window.location.origin}/profile`,
+ mode: 'payment',
+ payment: VipPaymentType.POINTS,
+ quantity: rechargeAmount, // 购买几份1000积分的资源包
+ metadata: {
+ userId: userInfo?.id || ''
+ }
});
- if (response?.code === 0) {
- message.success('积分充值成功!');
- setPointsRechargeVisible(false);
- fetchUserInfo(); // 刷新用户信息
+ if (response?.code === 0 && response.data && typeof response.data === 'object' && 'url' in response.data) {
+ // 保存订单ID
+ if ('id' in response.data) {
+ setPaymentOrderId((response.data as any).id);
+ setShowPaymentSuccess(true);
+ }
+ // 跳转到支付页面
+ window.open((response.data as any).url, '_blank');
+ // setPointsRechargeVisible(false);
+ message.success(t('pointsPurchase.redirectingToPayment' as any));
} else {
- message.error(response?.message || '积分充值失败,请重试');
+ message.error(response?.message || t('pointsPurchase.createOrderFailed' as any));
}
} catch (error) {
- message.error('积分充值失败,请重试');
+ message.error(t('pointsPurchase.createOrderFailed' as any));
}
};
const handleRechargeCancel = () => {
setPointsRechargeVisible(false);
+ setPaymentOrderId(null);
+ setShowPaymentSuccess(false);
+ };
+
+ // 处理"我已支付"按钮点击
+ const handlePaymentSuccess = async () => {
+ if (!paymentOrderId) return;
+
+ try {
+ const response = await getOrderDetailApi(paymentOrderId);
+ if (response?.code === 0 && response.data) {
+ const order = Array.isArray(response.data) ? response.data[0] : response.data;
+ // 检查订单状态:1=支付成功,2=等待支付,3=退款成功,4=订单取消
+ if (order.status === 1) {
+ message.success(t('pointsPurchase.purchaseSuccess' as any));
+ setShowPaymentSuccess(false);
+ setPaymentOrderId(null);
+ setPointsRechargeVisible(false);
+ // 刷新用户信息
+ fetchUserInfo();
+ } else if (order.status === 2) {
+ message.warning(t('pointsPurchase.paymentPending' as any));
+ } else if (order.status === 3) {
+ message.warning(t('pointsPurchase.orderRefunded' as any));
+ setShowPaymentSuccess(false);
+ setPaymentOrderId(null);
+ } else if (order.status === 4) {
+ message.warning(t('pointsPurchase.orderCancelled' as any));
+ setShowPaymentSuccess(false);
+ setPaymentOrderId(null);
+ } else {
+ message.warning(t('pointsPurchase.orderUnknown' as any));
+ }
+ } else {
+ message.error(t('pointsPurchase.queryFailed' as any));
+ }
+ } catch (error) {
+ message.error(t('pointsPurchase.queryFailed' as any));
+ }
};
// 滑块拖动处理
@@ -389,7 +441,7 @@ export default function ProfilePage() {
const rect = sliderTrack.getBoundingClientRect();
const x = e.clientX - rect.left;
const percentage = Math.max(0, Math.min(1, x / rect.width));
- const newAmount = Math.round(percentage * 49) + 1; // 1-50
+ const newAmount = Math.round(percentage * 49) + 1; // 1-50,只能选择1000的倍数
setRechargeAmount(newAmount);
};
@@ -612,12 +664,14 @@ export default function ProfilePage() {
key: 'type',
render: (type: string) => {
const typeMap: { [key: string]: { color: string; text: string } } = {
- 'ai_service': { color: 'green', text: t('points.aiService') },
- 'user_register': { color: 'blue', text: t('points.userRegister') },
- 'earn': { color: 'green', text: t('points.earn') },
- 'spend': { color: 'red', text: t('points.spend') },
- 'refund': { color: 'blue', text: t('points.refund') },
- 'expire': { color: 'orange', text: t('points.expire') }
+ 'ai_service': { color: 'green', text: t('points.aiService' as any) },
+ 'user_register': { color: 'blue', text: t('points.userRegister' as any) },
+ 'publish': { color: 'purple', text: t('points.publish' as any) },
+ 'point': { color: 'cyan', text: t('points.point' as any) },
+ 'earn': { color: 'green', text: t('points.earn' as any) },
+ 'spend': { color: 'red', text: t('points.spend' as any) },
+ 'refund': { color: 'blue', text: t('points.refund' as any) },
+ 'expire': { color: 'orange', text: t('points.expire' as any) }
};
const config = typeMap[type] || { color: 'default', text: type };
return <Tag color={config.color}>{config.text}</Tag>;
@@ -675,16 +729,16 @@ export default function ProfilePage() {
<div className={styles.pointsHeader}>
<div className={styles.pointsTitleSection}>
<span className={styles.pointsIcon}><GiftFilled /></span>
- <span className={styles.pointsTitle}>我的积分</span>
+ <span className={styles.pointsTitle}>{t('points.myPoints')}</span>
</div>
<span className={styles.pointsCount}>{userInfo?.score || 0}</span>
</div>
<p className={styles.pointsDescription}>
- 积分可用于AI服务消费,通过发布内容、开通会员或购买积分获得
+ {t('points.pointsDescription')}
</p>
<div className={styles.pointsMethods}>
- <h4 className={styles.methodsTitle}>获取积分的方法:</h4>
+ <h4 className={styles.methodsTitle}>{t('pointsPurchase.getPointsMethods' as any)}</h4>
<div className={styles.methodsGrid}>
<div className={styles.methodItem} onClick={handleGoToPublish}>
<div className={styles.methodIcon}>
@@ -693,8 +747,8 @@ export default function ProfilePage() {
</svg>
</div>
<div className={styles.methodContent}>
- <h5>发布</h5>
- <p>发布内容获得积分奖励</p>
+ <h5>{t('pointsPurchase.publish' as any)}</h5>
+ <p>{t('pointsPurchase.publishDesc' as any)}</p>
</div>
</div>
@@ -703,8 +757,8 @@ export default function ProfilePage() {
<CrownOutlined />
</div>
<div className={styles.methodContent}>
- <h5>开通会员</h5>
- <p>会员专享积分福利</p>
+ <h5>{t('pointsPurchase.vip' as any)}</h5>
+ <p>{t('pointsPurchase.vipDesc' as any)}</p>
</div>
</div>
@@ -715,8 +769,8 @@ export default function ProfilePage() {
</svg>
</div>
<div className={styles.methodContent}>
- <h5>购买积分</h5>
- <p>直接充值获得积分</p>
+ <h5>{t('pointsPurchase.buyPoints' as any)}</h5>
+ <p>{t('pointsPurchase.buyPointsDesc' as any)}</p>
</div>
</div>
</div>
@@ -1098,24 +1152,26 @@ export default function ProfilePage() {
</div>
</Modal>
- {/* 积分充值弹窗 */}
+ {/* 积分充值弹窗 */}
<Modal
- title="购买积分"
+ title={t('pointsPurchase.title' as any)}
open={pointsRechargeVisible}
onCancel={handleRechargeCancel}
footer={null}
width={500}
centered
+ maskClosable={false}
+ closable={true}
>
<div className={styles.rechargeContent}>
<div className={styles.currentPoints}>
- <span className={styles.pointsLabel}>账户积分</span>
+ <span className={styles.pointsLabel}>{t('pointsPurchase.currentPoints' as any)}</span>
<span className={styles.pointsValue}>{userInfo?.score || 0}</span>
</div>
<div className={styles.rechargeSection}>
- <h4>购买积分</h4>
- <p className={styles.rechargeDescription}>每1000积分售价15美元,以此类推</p>
+ <h4>{t('pointsPurchase.selectAmount' as any)}</h4>
+ <p className={styles.rechargeDescription}>{t('pointsPurchase.description' as any)}</p>
<div className={styles.sliderContainer}>
<div
@@ -1138,7 +1194,12 @@ export default function ProfilePage() {
<Input
type="number"
value={rechargeAmount}
- onChange={(e) => setRechargeAmount(Number(e.target.value))}
+ onChange={(e) => {
+ const value = Number(e.target.value);
+ if (value >= 1 && value <= 50) {
+ setRechargeAmount(value);
+ }
+ }}
min={1}
max={50}
style={{ width: '80px', marginRight: '8px' }}
@@ -1147,7 +1208,12 @@ export default function ProfilePage() {
</div>
<div className={styles.totalPrice}>
- <span>总价:</span>
+ <span>{t('pointsPurchase.purchasePoints' as any)}:</span>
+ <span className={styles.priceValue}>{rechargeAmount * 1000}</span>
+ </div>
+
+ <div className={styles.totalPrice}>
+ <span>{t('pointsPurchase.totalPrice' as any)}:</span>
<span className={styles.priceValue}>${(rechargeAmount * 15).toFixed(2)}</span>
</div>
</div>
@@ -1158,9 +1224,24 @@ export default function ProfilePage() {
block
onClick={() => handleRechargeSubmit({ amount: rechargeAmount })}
className={styles.rechargeButton}
+ disabled={showPaymentSuccess}
>
- 立即购买
+ {showPaymentSuccess ? t('pointsPurchase.paying' as any) : t('pointsPurchase.buyNow' as any)}
</Button>
+
+ {/* 支付成功提示 */}
+ {showPaymentSuccess && (
+ <div className={styles.paymentSuccessTip}>
+ <p>{t('pointsPurchase.paymentTip' as any)}</p>
+ <Button
+ type="primary"
+ onClick={handlePaymentSuccess}
+ className={styles.paymentSuccessButton}
+ >
+ {t('pointsPurchase.confirmPayment' as any)}
+ </Button>
+ </div>
+ )}
</div>
</Modal>
</div>
diff --git a/src/app/[lng]/profile/profile.module.css b/src/app/[lng]/profile/profile.module.css
index ad5aa7a6..d6056151 100644
--- a/src/app/[lng]/profile/profile.module.css
+++ b/src/app/[lng]/profile/profile.module.css
@@ -709,10 +709,24 @@
font-size: 12px;
}
- .methodContent p {
- font-size: 10px;
- }
-}
+ .methodContent p {
+ font-size: 10px;
+ }
+
+ .paymentSuccessTip {
+ padding: 10px;
+ margin-bottom: 12px;
+ }
+
+ .paymentSuccessTip p {
+ font-size: 12px;
+ }
+
+ .paymentSuccessButton {
+ font-size: 12px;
+ padding: 6px 12px;
+ }
+ }
/* 积分充值弹窗样式 */
.rechargeContent {
@@ -841,8 +855,41 @@
color: #fff;
}
-.rechargeButton:hover {
- transform: translateY(-2px);
- box-shadow: 0 4px 12px rgba(106, 90, 205, 0.3);
- background: linear-gradient(135deg, #7b68ee 0%, #b76dd9 100%);
-}
\ No newline at end of file
+ .rechargeButton:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(106, 90, 205, 0.3);
+ background: linear-gradient(135deg, #7b68ee 0%, #b76dd9 100%);
+ }
+
+ /* 支付成功提示样式 */
+ .paymentSuccessTip {
+ background: rgba(82, 196, 26, 0.1);
+ border: 1px solid rgba(82, 196, 26, 0.3);
+ border-radius: 8px;
+ padding: 12px;
+ margin-bottom: 16px;
+ text-align: center;
+ margin-top: 20px;
+ }
+
+ .paymentSuccessTip p {
+ color: #52c41a;
+ font-size: 13px;
+ margin-bottom: 8px;
+ font-weight: 500;
+ }
+
+ .paymentSuccessButton {
+ background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
+ border: none;
+ border-radius: 6px;
+ font-weight: 600;
+ transition: all 0.3s ease;
+ box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
+ }
+
+ .paymentSuccessButton:hover {
+ background: linear-gradient(135deg, #73d13d 0%, #95de64 100%);
+ transform: translateY(-1px);
+ box-shadow: 0 4px 12px rgba(82, 196, 26, 0.4);
+ }
\ No newline at end of file
diff --git a/src/app/i18n/locales/en/account.json b/src/app/i18n/locales/en/account.json
index 473952ab..b39ff306 100644
--- a/src/app/i18n/locales/en/account.json
+++ b/src/app/i18n/locales/en/account.json
@@ -9,7 +9,7 @@
"newWork": "New Work",
"allPlatforms": "All Platforms",
"accountManager": "Acct Manager",
- "addAccount": "Add Account",
+ "addAccount": "Add Channels",
"mcpManager": "MCP Manager",
"online": "Online",
"offline": "Offline",
@@ -53,5 +53,16 @@
"loading": "Getting IP info...",
"error": "Failed to get IP info",
"tooltip": "ASN: {{asn}}\nOrganization: {{org}}"
+ },
+ "createSpace": {
+ "title": "Add space",
+ "button": "Add space",
+ "name": "Channel Name",
+ "namePlaceholder": "Enter channel name",
+ "cancel": "Cancel",
+ "save": "Save",
+ "success": "Channel created successfully",
+ "failed": "Failed to create channel",
+ "nameRequired": "Please enter channel name"
}
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/en/profile.json b/src/app/i18n/locales/en/profile.json
index 69863a10..1c949b50 100644
--- a/src/app/i18n/locales/en/profile.json
+++ b/src/app/i18n/locales/en/profile.json
@@ -102,9 +102,38 @@
"expire": "Expire",
"aiService": "AI Service",
"userRegister": "User Register",
+ "publish": "Publish",
+ "point": "Points Trade",
"noPointsRecords": "No points records",
"totalRecords": "{{total}} records total"
},
+ "pointsPurchase": {
+ "title": "Buy Points",
+ "currentPoints": "Current Points",
+ "selectAmount": "Select Amount",
+ "description": "$15 for 1000 points, slide to select",
+ "purchasePoints": "Purchase Points",
+ "totalPrice": "Total",
+ "buyNow": "Buy Now",
+ "paying": "Paying...",
+ "paymentTip": "After payment, click to confirm status",
+ "confirmPayment": "I Paid",
+ "purchaseSuccess": "Points purchased!",
+ "paymentPending": "Payment pending, try later",
+ "orderRefunded": "Order refunded",
+ "orderCancelled": "Order cancelled",
+ "orderUnknown": "Unknown status, try later",
+ "queryFailed": "Query failed, retry",
+ "createOrderFailed": "Create order failed, retry",
+ "redirectingToPayment": "Redirecting to payment...",
+ "publish": "Publish",
+ "publishDesc": "Earn points by publishing",
+ "vip": "VIP",
+ "vipDesc": "VIP point benefits",
+ "buyPoints": "Buy Points",
+ "buyPointsDesc": "Direct recharge",
+ "getPointsMethods": "Get points:"
+ },
"freeTrial": {
"title": "🎉 Free Member Trial",
"congratulations": "Congratulations! You've earned a 7-day free member trial!",
diff --git a/src/app/i18n/locales/zh-CN/account.json b/src/app/i18n/locales/zh-CN/account.json
index 7088b388..6409cd2b 100644
--- a/src/app/i18n/locales/zh-CN/account.json
+++ b/src/app/i18n/locales/zh-CN/account.json
@@ -9,7 +9,7 @@
"newWork": "新建作品",
"allPlatforms": "所有平台",
"accountManager": "账号管理器",
- "addAccount": "添加账号",
+ "addAccount": "添加频道",
"mcpManager": "MCP 管理器",
"online": "在线",
"offline": "离线",
@@ -53,5 +53,16 @@
"loading": "获取IP信息中...",
"error": "IP信息获取失败",
"tooltip": "ASN: {{asn}}\n组织: {{org}}"
+ },
+ "createSpace": {
+ "title": "新建空间",
+ "button": "新建空间",
+ "name": "空间名",
+ "namePlaceholder": "请输入空间名称",
+ "cancel": "取消",
+ "save": "保存",
+ "success": "新建空间成功",
+ "failed": "新建空间失败",
+ "nameRequired": "请输入空间名称"
}
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/zh-CN/profile.json b/src/app/i18n/locales/zh-CN/profile.json
index 4fabc455..2ec5d2cf 100644
--- a/src/app/i18n/locales/zh-CN/profile.json
+++ b/src/app/i18n/locales/zh-CN/profile.json
@@ -102,9 +102,38 @@
"expire": "过期",
"aiService": "AI服务",
"userRegister": "用户注册",
+ "publish": "发布作品",
+ "point": "积分交易",
"noPointsRecords": "暂无积分记录",
"totalRecords": "共 {{total}} 条记录"
},
+ "pointsPurchase": {
+ "title": "购买积分",
+ "currentPoints": "当前积分",
+ "selectAmount": "选择购买数量",
+ "description": "每1000积分售价15美元,滑动选择购买数量",
+ "purchasePoints": "购买积分",
+ "totalPrice": "总价",
+ "buyNow": "立即购买",
+ "paying": "支付中...",
+ "paymentTip": "支付完成后,请点击下方按钮确认支付状态",
+ "confirmPayment": "我已支付",
+ "purchaseSuccess": "积分购买成功!",
+ "paymentPending": "订单尚未支付成功,请稍后再试",
+ "orderRefunded": "订单已退款",
+ "orderCancelled": "订单已取消",
+ "orderUnknown": "订单状态未知,请稍后再试",
+ "queryFailed": "查询订单状态失败,请重试",
+ "createOrderFailed": "创建支付订单失败,请重试",
+ "redirectingToPayment": "正在跳转到支付页面...",
+ "publish": "发布",
+ "publishDesc": "发布内容获得积分奖励",
+ "vip": "开通会员",
+ "vipDesc": "会员专享积分福利",
+ "buyPoints": "购买积分",
+ "buyPointsDesc": "直接充值获得积分",
+ "getPointsMethods": "获取积分的方法:"
+ },
"freeTrial": {
"title": "🎉 免费会员体验",
"congratulations": "恭喜您获得7天免费会员体验!",
diff --git a/src/utils/ipLocation.ts b/src/utils/ipLocation.ts
index 7a8e050e..68d789d5 100644
--- a/src/utils/ipLocation.ts
+++ b/src/utils/ipLocation.ts
@@ -61,11 +61,23 @@ export const getIpLocation = (): Promise<IpLocationInfo> => {
});
};
+/**
+ * 从位置信息中提取国家
+ * @param location 位置信息字符串
+ * @returns 国家名称
+ */
+export const extractCountry = (location: string): string => {
+ // 位置信息通常格式为: "国家 省份 城市" 或 "国家"
+ const parts = location.split(' ');
+ return parts[0] || location;
+};
+
/**
* 格式化地理位置信息
* @param info IP地理位置信息
* @returns 格式化后的字符串
*/
export const formatLocationInfo = (info: IpLocationInfo): string => {
- return `${info.ip} | ${info.location}`;
+ const country = extractCountry(info.location);
+ return `${country} | ${info.ip}`;
};