feat(weibo): 增加微博微豆基础自动化
This commit is contained in:
@@ -31,6 +31,7 @@ const HuyaTasksPage = lazy(() => import('./pages/HuyaTasksPage'));
|
||||
const HuyaElitePage = lazy(() => import('./pages/HuyaElitePage'));
|
||||
const HuyaCollabPage = lazy(() => import('./pages/HuyaCollabPage'));
|
||||
const HuyaBrowserExchangePage = lazy(() => import('./pages/HuyaBrowserExchangePage'));
|
||||
const WeiboAccountsPage = lazy(() => import('./pages/WeiboAccountsPage'));
|
||||
const YybRechargePage = lazy(() => import('./pages/YybRechargePage'));
|
||||
const AuditLogsPage = lazy(() => import('./pages/AuditLogsPage'));
|
||||
|
||||
@@ -105,6 +106,7 @@ function AppContent() {
|
||||
<Route path="huya/elite" element={lazyRoute(<HuyaElitePage />)} />
|
||||
<Route path="huya/collab" element={lazyRoute(<HuyaCollabPage />)} />
|
||||
<Route path="huya/browser-exchange" element={lazyRoute(<HuyaBrowserExchangePage />)} />
|
||||
<Route path="weibo/accounts" element={lazyRoute(<WeiboAccountsPage />)} />
|
||||
<Route path="yyb/recharge" element={lazyRoute(<YybRechargePage />)} />
|
||||
<Route path="proxy" element={lazyRoute(<ProxyPage />)} />
|
||||
<Route path="automation" element={lazyRoute(<AutomationPage />)} />
|
||||
|
||||
@@ -14,4 +14,5 @@ export { huyaApi } from './huya';
|
||||
export { loginApi } from './login';
|
||||
export { proxyApi } from './proxy';
|
||||
export { userApi } from './users';
|
||||
export { weiboApi } from './weibo';
|
||||
export { yybApi } from './yyb';
|
||||
|
||||
@@ -634,6 +634,7 @@ export interface DouyuTaskAccountItem {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
tag: string;
|
||||
activity: string;
|
||||
ck_check_status: string;
|
||||
ck_checked_at: string | null;
|
||||
points: number | null;
|
||||
@@ -745,6 +746,137 @@ export interface DouyuXpdGoodsItem extends DouyuGoodsItem {
|
||||
goods_left: number | null;
|
||||
}
|
||||
|
||||
// ==================== Weibo ====================
|
||||
|
||||
export interface WeiboAccountItem {
|
||||
id: number;
|
||||
uid: string;
|
||||
nickname: string;
|
||||
tag: string;
|
||||
ck_check_status: string;
|
||||
ck_check_message: string;
|
||||
ck_checked_at: string | null;
|
||||
is_bound: boolean | null;
|
||||
game_role_name: string;
|
||||
can_rebind: boolean | null;
|
||||
rebind_remain_days: number | null;
|
||||
weidou_balance: number | null;
|
||||
cookie_updated_at: string | null;
|
||||
created_at: string | null;
|
||||
updated_at: string | null;
|
||||
}
|
||||
|
||||
export interface WeiboImportError {
|
||||
line: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface WeiboImportResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
count: number;
|
||||
skipped: number;
|
||||
errors: WeiboImportError[];
|
||||
accounts: WeiboAccountItem[];
|
||||
}
|
||||
|
||||
export interface WeiboBindScheme {
|
||||
channel: 'wx' | 'qq';
|
||||
label: string;
|
||||
scheme: string;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface WeiboBindQrResult {
|
||||
account_id: number;
|
||||
is_bound: boolean;
|
||||
can_rebind: boolean;
|
||||
rebind_remain_days: number;
|
||||
schemes: WeiboBindScheme[];
|
||||
}
|
||||
|
||||
export interface WeiboGoodsItem {
|
||||
id: number;
|
||||
goods_name: string;
|
||||
goods_image: string;
|
||||
price: number;
|
||||
remain_count: number | null;
|
||||
is_sold_out: boolean;
|
||||
goods_desc: string;
|
||||
}
|
||||
|
||||
export interface WeiboMallListResult {
|
||||
account_id: number;
|
||||
weidou_balance: number;
|
||||
goods: WeiboGoodsItem[];
|
||||
}
|
||||
|
||||
export interface WeiboExchangeRecordItem {
|
||||
goods_name: string;
|
||||
game_account: string;
|
||||
cost_weidou: number | null;
|
||||
exchange_time: string;
|
||||
reward_status: number | null;
|
||||
raw: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface WeiboExchangeRecordsResult {
|
||||
account_id: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: WeiboExchangeRecordItem[];
|
||||
}
|
||||
|
||||
export interface WeiboExchangeResult {
|
||||
account_id: number;
|
||||
goods_id: number;
|
||||
goods_name: string;
|
||||
price: number;
|
||||
balance_before: number;
|
||||
balance_after: number | null;
|
||||
remain_before: number | null;
|
||||
remain_after: number | null;
|
||||
verified: boolean;
|
||||
verify_error: string;
|
||||
}
|
||||
|
||||
export interface WeiboPointRecordItem {
|
||||
id: string;
|
||||
source_type: number | null;
|
||||
record_type: number | null;
|
||||
source_id: string;
|
||||
source_name: string;
|
||||
point_num: number;
|
||||
create_time: string;
|
||||
expire_time: string;
|
||||
}
|
||||
|
||||
export interface WeiboPointHistoryResult {
|
||||
account_id: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: WeiboPointRecordItem[];
|
||||
}
|
||||
|
||||
export interface WeiboRechargeOrderResult {
|
||||
account_id: number;
|
||||
order_id: string;
|
||||
pay_id: string;
|
||||
amount_yuan: number;
|
||||
single_reward: number;
|
||||
alipay_qr_code: string;
|
||||
desktop_pay_url: string;
|
||||
}
|
||||
|
||||
export interface WeiboPaymentStatusResult {
|
||||
pay_id: string;
|
||||
out_pay_id: string;
|
||||
status: string;
|
||||
sub_status: string;
|
||||
}
|
||||
|
||||
// ==================== Huya ====================
|
||||
|
||||
export interface HuyaAccountItem {
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import api from './client';
|
||||
import type {
|
||||
MessageResponse,
|
||||
PaginatedResponse,
|
||||
WeiboAccountItem,
|
||||
WeiboBindQrResult,
|
||||
WeiboExchangeRecordsResult,
|
||||
WeiboExchangeResult,
|
||||
WeiboMallListResult,
|
||||
WeiboPaymentStatusResult,
|
||||
WeiboPointHistoryResult,
|
||||
WeiboRechargeOrderResult,
|
||||
WeiboImportResult,
|
||||
} from './types';
|
||||
|
||||
export const weiboApi = {
|
||||
listAccounts: (params: {
|
||||
search?: string;
|
||||
bind_status?: string;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}) =>
|
||||
api.get<PaginatedResponse<WeiboAccountItem>, PaginatedResponse<WeiboAccountItem>>(
|
||||
'/weibo/accounts',
|
||||
{ params },
|
||||
),
|
||||
importCookies: (text: string, tag = '') =>
|
||||
api.post<WeiboImportResult, WeiboImportResult>('/weibo/accounts/import-cookies', {
|
||||
text,
|
||||
tag,
|
||||
}),
|
||||
refreshAccount: (accountId: number) =>
|
||||
api.post<WeiboAccountItem, WeiboAccountItem>(
|
||||
`/weibo/accounts/${accountId}/refresh`,
|
||||
),
|
||||
bindQrcodes: (accountId: number) =>
|
||||
api.post<WeiboBindQrResult, WeiboBindQrResult>(
|
||||
`/weibo/accounts/${accountId}/bind-qrcodes`,
|
||||
undefined,
|
||||
{ timeout: 60000 },
|
||||
),
|
||||
mallList: (accountId: number) =>
|
||||
api.post<WeiboMallListResult, WeiboMallListResult>(
|
||||
`/weibo/accounts/${accountId}/mall-list`,
|
||||
undefined,
|
||||
{ timeout: 60000 },
|
||||
),
|
||||
exchangeGoods: (accountId: number, goodsId: number, expectedPrice: number) =>
|
||||
api.post<WeiboExchangeResult, WeiboExchangeResult>(
|
||||
`/weibo/accounts/${accountId}/exchange`,
|
||||
{
|
||||
goods_id: goodsId,
|
||||
expected_price: expectedPrice,
|
||||
confirm: true,
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
),
|
||||
exchangeRecords: (accountId: number, page = 1, pageSize = 20) =>
|
||||
api.post<WeiboExchangeRecordsResult, WeiboExchangeRecordsResult>(
|
||||
`/weibo/accounts/${accountId}/exchange-records`,
|
||||
undefined,
|
||||
{ params: { page, page_size: pageSize }, timeout: 60000 },
|
||||
),
|
||||
pointHistory: (accountId: number, page = 1, pageSize = 20) =>
|
||||
api.post<WeiboPointHistoryResult, WeiboPointHistoryResult>(
|
||||
`/weibo/accounts/${accountId}/point-history`,
|
||||
undefined,
|
||||
{ params: { page, page_size: pageSize }, timeout: 60000 },
|
||||
),
|
||||
createRechargeOrder: (accountId: number, amountYuan: number) =>
|
||||
api.post<WeiboRechargeOrderResult, WeiboRechargeOrderResult>(
|
||||
`/weibo/accounts/${accountId}/recharge/orders`,
|
||||
{ amount_yuan: amountYuan },
|
||||
{ timeout: 120000 },
|
||||
),
|
||||
rechargeStatus: (accountId: number, payId: string) =>
|
||||
api.post<WeiboPaymentStatusResult, WeiboPaymentStatusResult>(
|
||||
`/weibo/accounts/${accountId}/recharge/status`,
|
||||
{ pay_id: payId },
|
||||
{ timeout: 30000 },
|
||||
),
|
||||
deleteAccount: (accountId: number) =>
|
||||
api.delete<MessageResponse, MessageResponse>(`/weibo/accounts/${accountId}`),
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
SunOutlined, MoonOutlined, DesktopOutlined, GiftOutlined, ApartmentOutlined, MobileOutlined, ShoppingCartOutlined,
|
||||
BookOutlined, TrophyOutlined, ShopOutlined, GlobalOutlined,
|
||||
SafetyCertificateOutlined, FileSearchOutlined, RobotOutlined, FileExcelOutlined,
|
||||
MessageOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { useNavigate, useLocation, Outlet } from 'react-router-dom';
|
||||
import { getUser, clearAuth, type AuthUser } from '../store/auth';
|
||||
@@ -52,6 +53,7 @@ export default function MainLayout({ onLogout }: { onLogout?: () => void }) {
|
||||
const menuItems: MenuProps['items'] = [];
|
||||
const douyuItems: NonNullable<MenuProps['items']> = [];
|
||||
const huyaItems: NonNullable<MenuProps['items']> = [];
|
||||
const weiboItems: NonNullable<MenuProps['items']> = [];
|
||||
const systemItems: NonNullable<MenuProps['items']> = [];
|
||||
|
||||
// Dashboard - 所有人可见
|
||||
@@ -124,12 +126,19 @@ export default function MainLayout({ onLogout }: { onLogout?: () => void }) {
|
||||
huyaItems.push({ key: '/huya/collab', label: '外部单协作', icon: <FileExcelOutlined /> });
|
||||
}
|
||||
|
||||
if (can('weibo:view')) {
|
||||
weiboItems.push({ key: '/weibo/accounts', label: '账号与绑定', icon: <MessageOutlined /> });
|
||||
}
|
||||
|
||||
if (douyuItems.length > 0) {
|
||||
menuItems.push({ key: 'group-douyu', type: 'group', label: '斗鱼', children: douyuItems });
|
||||
}
|
||||
if (huyaItems.length > 0) {
|
||||
menuItems.push({ key: 'group-huya', type: 'group', label: '虎牙', children: huyaItems });
|
||||
}
|
||||
if (weiboItems.length > 0) {
|
||||
menuItems.push({ key: 'group-weibo', type: 'group', label: '微博', children: weiboItems });
|
||||
}
|
||||
|
||||
// 系统
|
||||
if (can('proxy:manage')) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user