修改页面分页情况

This commit is contained in:
2026-06-15 17:50:47 +08:00
parent 3aa6c7cf2f
commit d71b50c200
12 changed files with 187 additions and 64 deletions
+26 -8
View File
@@ -153,9 +153,15 @@ export async function generateVideo(recordId: string, params: GenerateParams): P
});
}
// ── Credits ───────────────────────────────────────────────
export async function getCredits(): Promise<{ credits: number; records: CreditRecord[] }> {
if (USE_MOCK) return mock.mockGetCredits();
return api.get('/credits');
export async function getCredits(page = 1, pageSize = 20): Promise<{ credits: number; records: CreditRecord[]; total: number }> {
if (USE_MOCK) {
const data = await mock.mockGetCredits();
return data;
}
const params = new URLSearchParams();
params.set('page', String(page));
params.set('page_size', String(pageSize));
return api.get(`/credits?${params.toString()}`);
}
// ── Captcha ───────────────────────────────────────────────
export async function getSliderCaptcha(): Promise<{ captcha_id: string; bg_image: string; slider_image: string }> {
@@ -191,9 +197,18 @@ export async function verifySms(phone: string, code: string): Promise<{ token: s
return api.post('/sms/verify', { phone, code }, false);
}
// ── Notifications ─────────────────────────────────────────
export async function getNotifications(): Promise<AdminNotification[]> {
if (USE_MOCK) return mock.mockGetAdminNotifications();
return api.get('/notifications');
export async function getNotifications(page = 1, pageSize = 20, isRead?: boolean): Promise<{ items: AdminNotification[], total: number }> {
if (USE_MOCK) {
const items = await mock.mockGetAdminNotifications();
return { items, total: items.length };
}
const params = new URLSearchParams();
params.set('page', String(page));
params.set('page_size', String(pageSize));
if (isRead !== undefined) {
params.set('is_read', String(isRead));
}
return api.get(`/notifications?${params.toString()}`);
}
export async function getUnreadCount(): Promise<number> {
if (USE_MOCK) return mock.mockGetAdminNotifications().then(n => n.filter(x => !x.isRead).length);
@@ -271,8 +286,11 @@ export async function createRechargeOrder(planId: string, method: string = 'wech
return api.post('/payments/recharge', { plan: planId, method });
}
export async function getPaymentOrders(): Promise<any[]> {
return api.get('/payments/orders');
export async function getPaymentOrders(page = 1, pageSize = 20): Promise<{ items: any[]; total: number }> {
const params = new URLSearchParams();
params.set('page', String(page));
params.set('page_size', String(pageSize));
return api.get(`/payments/orders?${params.toString()}`);
}
export async function getPaymentOrder(orderNo: string): Promise<any> {