feat(frontend-v2): ProfilePage 真实数据页 (#987-#990) - 接 profile API 6 区块

This commit is contained in:
QihuAI Design committed 2026-08-23 12:26:56 +08:00
1 parent 910394423d
commit 39fcdbf6da
1 file changed
+72 -7
+72 -7
View File
@@ -219,21 +219,86 @@ export const imBotApi = {
// ─── Profile ───────────────────────────────────────────────────────────────────── // ─── Profile ─────────────────────────────────────────────────────────────────────
export interface MembershipInfo {
id: string;
plan_id: string;
status: string;
start_at: string;
expire_at: string;
is_expired: boolean;
}
export interface UserProfile { export interface UserProfile {
id: string; id: string;
username: string; username: string;
email: string; email: string;
avatar_url: string; phone: string;
balance: number; avatar: string;
membership: string; role: string;
status: string;
membership: MembershipInfo | null;
created_at: string;
updated_at: string;
}
export interface LoginLogItem {
id: string;
ip: string;
user_agent: string;
login_at: string;
}
export interface LoginLogList {
total: number;
page: number;
page_size: number;
items: LoginLogItem[];
}
export interface ApiKeyItem {
id: string;
name: string;
key_preview: string;
status: string;
last_used_at: string | null;
created_at: string;
expire_at: string | null;
}
export interface PurchasedAppItem {
id: string;
app_id: string;
app_name: string;
app_icon: string;
app_type: string;
price: number;
purchased_at: string;
} }
export const profileApi = { export const profileApi = {
get: () => request<UserProfile>('/profile/'), get: () => data<UserProfile>('/profile/'),
update: (data: Partial<UserProfile>) =>
request<UserProfile>('/profile/', { method: 'PUT', body: JSON.stringify(data) }),
getBalance: () => request<{ balance: number; total_used: number }>('/profile/balance'), update: (payload: Partial<Pick<UserProfile, 'username' | 'email' | 'phone' | 'avatar'>>) =>
data<UserProfile>('/profile/', { method: 'PUT', body: JSON.stringify(payload) }),
getBalance: () => data<number>('/profile/balance'),
getMembership: () => data<{
has_membership: boolean;
id: string;
plan_id: string;
status: string;
start_at: string;
expire_at: string;
is_expired: boolean;
}>('/profile/membership'),
getLoginLogs: (page = 1, page_size = 10) =>
data<LoginLogList>(`/profile/login-logs?page=${page}&page_size=${page_size}`),
getApiKeys: () => data<ApiKeyItem[]>('/profile/api-keys'),
getPurchasedApps: () => data<PurchasedAppItem[]>('/profile/purchased-apps'),
}; };
// ─── Token 驾驶舱 ──────────────────────────────────────────────────────────────── // ─── Token 驾驶舱 ────────────────────────────────────────────────────────────────