merge main
This commit is contained in:
@@ -241,6 +241,10 @@ export async function createSystemConfig(key: string, value: string, description
|
||||
return api.post('/admin/system-configs', { key, value, description });
|
||||
}
|
||||
|
||||
export async function resetActivityBanner(): Promise<{ siteBannerVersion: number }> {
|
||||
return api.post('/admin/system-configs/banner/reset');
|
||||
}
|
||||
|
||||
export async function getGlobalResourceCapacity(): Promise<ResourceCapacityConfigOut> {
|
||||
return api.get('/admin/resource-capacity/global');
|
||||
}
|
||||
@@ -390,6 +394,131 @@ export async function deleteCreditRatio(id: string): Promise<void> {
|
||||
await api.delete(`/admin/credit-ratios/${id}`);
|
||||
}
|
||||
|
||||
// === API 模型价格管理 ===
|
||||
|
||||
export async function getApiModelPricings(): Promise<any[]> {
|
||||
return api.get('/admin/api-model-pricings');
|
||||
}
|
||||
|
||||
export async function saveApiModelPricing(pricing: any): Promise<any> {
|
||||
if (pricing.id) return api.put(`/admin/api-model-pricings/${pricing.id}`, pricing);
|
||||
return api.post('/admin/api-model-pricings', pricing);
|
||||
}
|
||||
|
||||
export async function deleteApiModelPricing(id: string): Promise<void> {
|
||||
await api.delete(`/admin/api-model-pricings/${id}`);
|
||||
}
|
||||
|
||||
// === API Key 管理 ===
|
||||
|
||||
export async function getApiKeys(params?: {
|
||||
skip?: number;
|
||||
limit?: number;
|
||||
companyName?: string;
|
||||
isActive?: boolean;
|
||||
}): Promise<any> {
|
||||
const query = new URLSearchParams();
|
||||
if (params?.skip !== undefined) query.set('skip', String(params.skip));
|
||||
if (params?.limit !== undefined) query.set('limit', String(params.limit));
|
||||
if (params?.companyName) query.set('company_name', params.companyName);
|
||||
if (params?.isActive !== undefined) query.set('is_active', String(params.isActive));
|
||||
const qs = query.toString();
|
||||
return api.get(`/admin/api-keys${qs ? '?' + qs : ''}`);
|
||||
}
|
||||
|
||||
export async function getApiKeyDetail(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}`);
|
||||
}
|
||||
|
||||
export async function createApiKey(data: any): Promise<any> {
|
||||
return api.post('/admin/api-keys', data);
|
||||
}
|
||||
|
||||
export async function updateApiKey(id: string, data: any): Promise<any> {
|
||||
return api.put(`/admin/api-keys/${id}`, data);
|
||||
}
|
||||
|
||||
export async function deleteApiKey(id: string): Promise<void> {
|
||||
await api.delete(`/admin/api-keys/${id}`);
|
||||
}
|
||||
|
||||
export async function getApiKeyUsage(id: string, days?: number, page?: number, pageSize?: number): Promise<any> {
|
||||
const params = new URLSearchParams();
|
||||
if (days) params.set('days', String(days));
|
||||
if (page) params.set('page', String(page));
|
||||
if (pageSize) params.set('page_size', String(pageSize));
|
||||
const qs = params.toString() ? `?${params.toString()}` : '';
|
||||
return api.get(`/admin/api-keys/${id}/usage${qs}`);
|
||||
}
|
||||
|
||||
export async function adjustApiKeyQuota(
|
||||
id: string,
|
||||
data: {
|
||||
action: 'adjust' | 'reset_usage' | 'set_limit' | 'change_cycle';
|
||||
quotaLimitDelta?: number;
|
||||
quotaLimit?: number | null;
|
||||
quotaCycle?: string | null;
|
||||
reason?: string | null;
|
||||
},
|
||||
): Promise<any> {
|
||||
return api.post(`/admin/api-keys/${id}/quota-adjust`, {
|
||||
action: data.action,
|
||||
quota_limit_delta: data.quotaLimitDelta,
|
||||
quota_limit: data.quotaLimit,
|
||||
quota_cycle: data.quotaCycle,
|
||||
reason: data.reason,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getApiKeyUpscaleConfig(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}/upscale`);
|
||||
}
|
||||
|
||||
export async function saveApiKeyUpscaleConfig(id: string, data: any): Promise<any> {
|
||||
return api.put(`/admin/api-keys/${id}/upscale`, data);
|
||||
}
|
||||
|
||||
// === V3 虚拟素材库配额 ===
|
||||
export async function getApiKeyVpV3Quota(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}/vp-v3-quota`);
|
||||
}
|
||||
|
||||
export async function saveApiKeyVpV3Quota(id: string, data: { projectLimit: number; assetLimit: number; storageMbLimit: number; remark?: string | null }): Promise<any> {
|
||||
return api.post(`/admin/api-keys/${id}/vp-v3-quota`, {
|
||||
project_limit: data.projectLimit,
|
||||
asset_limit: data.assetLimit,
|
||||
storage_mb_limit: data.storageMbLimit,
|
||||
remark: data.remark,
|
||||
});
|
||||
}
|
||||
|
||||
export async function revealApiKey(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}/reveal`);
|
||||
}
|
||||
|
||||
// === 整体消耗列表 ===
|
||||
|
||||
export async function getApiUsageAll(params?: {
|
||||
skip?: number;
|
||||
limit?: number;
|
||||
apiKeyId?: string;
|
||||
genType?: string;
|
||||
status?: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
}): Promise<any> {
|
||||
const query = new URLSearchParams();
|
||||
if (params?.skip !== undefined) query.set('skip', String(params.skip));
|
||||
if (params?.limit !== undefined) query.set('limit', String(params.limit));
|
||||
if (params?.apiKeyId) query.set('api_key_id', params.apiKeyId);
|
||||
if (params?.genType) query.set('gen_type', params.genType);
|
||||
if (params?.status) query.set('status', params.status);
|
||||
if (params?.startDate) query.set('start_date', params.startDate);
|
||||
if (params?.endDate) query.set('end_date', params.endDate);
|
||||
const qs = query.toString();
|
||||
return api.get(`/admin/api-keys/usage/all${qs ? '?' + qs : ''}`);
|
||||
}
|
||||
|
||||
export async function getPaymentConfigs(): Promise<any[]> {
|
||||
return api.get('/admin/payment-configs');
|
||||
}
|
||||
@@ -439,6 +568,40 @@ export async function refundPaymentOrder(orderNo: string): Promise<void> {
|
||||
await api.post(`/admin/payment-orders/${orderNo}/refund`);
|
||||
}
|
||||
|
||||
// ── Invoice Management ───────────────────────────────────
|
||||
|
||||
export async function getAdminInvoices(params?: {
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
status?: string;
|
||||
phone?: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
}): Promise<{ items: any[]; total: number }> {
|
||||
const qs = new URLSearchParams();
|
||||
if (params?.page) qs.set('page', String(params.page));
|
||||
if (params?.pageSize) qs.set('page_size', String(params.pageSize));
|
||||
if (params?.status) qs.set('status', params.status);
|
||||
if (params?.phone) qs.set('phone', params.phone);
|
||||
if (params?.startDate) qs.set('start_date', params.startDate);
|
||||
if (params?.endDate) qs.set('end_date', params.endDate);
|
||||
return api.get(`/admin/invoices?${qs.toString()}`);
|
||||
}
|
||||
|
||||
export async function getAdminInvoiceDetail(id: string): Promise<any> {
|
||||
return api.get(`/admin/invoices/${id}`);
|
||||
}
|
||||
|
||||
export async function updateInvoiceStatus(id: string, data: {
|
||||
status: 'success' | 'failed';
|
||||
failureReason?: string;
|
||||
}): Promise<void> {
|
||||
await api.put(`/admin/invoices/${id}/status`, {
|
||||
status: data.status,
|
||||
failure_reason: data.failureReason,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAdminNotifications(page = 1, pageSize = 20): Promise<{ total: number; items: any[] }> {
|
||||
const params = new URLSearchParams();
|
||||
params.set('page', String(page));
|
||||
@@ -516,8 +679,16 @@ export async function deleteRechargePackage(id: string): Promise<void> {
|
||||
|
||||
// ── Operation Logs ──────────────────────────────────────
|
||||
|
||||
export async function getOperationLogs(page?: number): Promise<{ total: number; items: any[] }> {
|
||||
const q = page ? `?page=${page}` : '';
|
||||
export async function getOperationLogs(params?: {
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
action?: string;
|
||||
}): Promise<{ total: number; items: any[] }> {
|
||||
const sp = new URLSearchParams();
|
||||
if (params?.page) sp.set('page', String(params.page));
|
||||
if (params?.pageSize) sp.set('page_size', String(params.pageSize));
|
||||
if (params?.action) sp.set('action', params.action);
|
||||
const q = sp.toString() ? `?${sp.toString()}` : '';
|
||||
return api.get(`/admin/operation-logs${q}`);
|
||||
}
|
||||
|
||||
@@ -623,6 +794,8 @@ export async function getAdminGenerationRecords(params?: {
|
||||
status?: string;
|
||||
engineId?: string;
|
||||
includeMediaReferences?: boolean;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
}): Promise<{ total: number; items: any[] }> {
|
||||
@@ -633,6 +806,8 @@ export async function getAdminGenerationRecords(params?: {
|
||||
if (params?.includeMediaReferences !== undefined) {
|
||||
q.set('include_media_references', String(params.includeMediaReferences));
|
||||
}
|
||||
if (params?.startDate) q.set('start_date', params.startDate);
|
||||
if (params?.endDate) q.set('end_date', params.endDate);
|
||||
if (params?.page) q.set('page', String(params.page));
|
||||
if (params?.pageSize) q.set('page_size', String(params.pageSize));
|
||||
const qs = q.toString();
|
||||
|
||||
Reference in New Issue
Block a user