feat(frontend-v2): ProfilePage 真实数据页 (#987-#990) - 接 profile API 6 区块
This commit is contained in:
1 parent
910394423d
commit
39fcdbf6da
1 file changed
+72
-7
@@ -219,21 +219,86 @@ export const imBotApi = {
|
||||
|
||||
// ─── Profile ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface MembershipInfo {
|
||||
id: string;
|
||||
plan_id: string;
|
||||
status: string;
|
||||
start_at: string;
|
||||
expire_at: string;
|
||||
is_expired: boolean;
|
||||
}
|
||||
|
||||
export interface UserProfile {
|
||||
id: string;
|
||||
username: string;
|
||||
email: string;
|
||||
avatar_url: string;
|
||||
balance: number;
|
||||
membership: string;
|
||||
phone: string;
|
||||
avatar: 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 = {
|
||||
get: () => request<UserProfile>('/profile/'),
|
||||
update: (data: Partial<UserProfile>) =>
|
||||
request<UserProfile>('/profile/', { method: 'PUT', body: JSON.stringify(data) }),
|
||||
get: () => data<UserProfile>('/profile/'),
|
||||
|
||||
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 驾驶舱 ────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user