mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: add payment fields to UpdateSettingsRequest, remove as any casts and dead code
- Add payment fields to UpdateSettingsRequest TypeScript interface - Remove duplicate payment_enabled_types assignment in saveSettings - Remove all (payload as any) casts for payment fields - Remove unused parseTypes function from providerConfig.ts
This commit is contained in:
@@ -1 +1 @@
|
||||
0.1.108.59
|
||||
0.1.108.60
|
||||
|
||||
@@ -158,6 +158,20 @@ export interface UpdateSettingsRequest {
|
||||
allow_ungrouped_key_scheduling?: boolean
|
||||
enable_fingerprint_unification?: boolean
|
||||
enable_metadata_passthrough?: boolean
|
||||
// Payment configuration
|
||||
payment_enabled?: boolean
|
||||
payment_min_amount?: number
|
||||
payment_max_amount?: number
|
||||
payment_daily_limit?: number
|
||||
payment_order_timeout_minutes?: number
|
||||
payment_max_pending_orders?: number
|
||||
payment_enabled_types?: string[]
|
||||
payment_balance_disabled?: boolean
|
||||
payment_load_balance_strategy?: string
|
||||
payment_product_name_prefix?: string
|
||||
payment_product_name_suffix?: string
|
||||
payment_help_image_url?: string
|
||||
payment_help_text?: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,12 +83,6 @@ export const PROVIDER_CONFIG_FIELDS: Record<string, ConfigFieldDef[]> = {
|
||||
|
||||
// --- Helpers ---
|
||||
|
||||
/** Parse comma-separated types string into array. */
|
||||
export function parseTypes(raw: string): string[] {
|
||||
if (!raw) return []
|
||||
return raw.split(',').map(s => s.trim()).filter(Boolean)
|
||||
}
|
||||
|
||||
/** Resolve type label: for easypay provider, show "跳转" for the easypay type. */
|
||||
export function resolveTypeLabel(
|
||||
typeVal: string,
|
||||
|
||||
@@ -2483,25 +2483,23 @@ async function saveSettings() {
|
||||
max_claude_code_version: form.max_claude_code_version,
|
||||
allow_ungrouped_key_scheduling: form.allow_ungrouped_key_scheduling,
|
||||
enable_fingerprint_unification: form.enable_fingerprint_unification,
|
||||
enable_metadata_passthrough: form.enable_metadata_passthrough
|
||||
enable_metadata_passthrough: form.enable_metadata_passthrough,
|
||||
// Payment configuration
|
||||
payment_enabled: form.payment_enabled,
|
||||
payment_min_amount: Number(form.payment_min_amount) || 0,
|
||||
payment_max_amount: Number(form.payment_max_amount) || 0,
|
||||
payment_daily_limit: Number(form.payment_daily_limit) || 0,
|
||||
payment_max_pending_orders: Number(form.payment_max_pending_orders) || 0,
|
||||
payment_order_timeout_minutes: Number(form.payment_order_timeout_minutes) || 0,
|
||||
payment_balance_disabled: form.payment_balance_disabled,
|
||||
payment_enabled_types: form.payment_enabled_types,
|
||||
payment_load_balance_strategy: form.payment_load_balance_strategy,
|
||||
payment_product_name_prefix: form.payment_product_name_prefix,
|
||||
payment_product_name_suffix: form.payment_product_name_suffix,
|
||||
payment_help_image_url: form.payment_help_image_url,
|
||||
payment_help_text: form.payment_help_text,
|
||||
}
|
||||
|
||||
// Payment config fields (integrated into settings payload)
|
||||
;(payload as any).payment_enabled_types = form.payment_enabled_types
|
||||
;(payload as any).payment_enabled = form.payment_enabled
|
||||
;(payload as any).payment_min_amount = Number(form.payment_min_amount) || 0
|
||||
;(payload as any).payment_max_amount = Number(form.payment_max_amount) || 0
|
||||
;(payload as any).payment_daily_limit = Number(form.payment_daily_limit) || 0
|
||||
;(payload as any).payment_max_pending_orders = Number(form.payment_max_pending_orders) || 0
|
||||
;(payload as any).payment_order_timeout_minutes = Number(form.payment_order_timeout_minutes) || 0
|
||||
;(payload as any).payment_balance_disabled = form.payment_balance_disabled
|
||||
;(payload as any).payment_enabled_types = form.payment_enabled_types
|
||||
;(payload as any).payment_load_balance_strategy = form.payment_load_balance_strategy
|
||||
;(payload as any).payment_product_name_prefix = form.payment_product_name_prefix
|
||||
;(payload as any).payment_product_name_suffix = form.payment_product_name_suffix
|
||||
;(payload as any).payment_help_image_url = form.payment_help_image_url
|
||||
;(payload as any).payment_help_text = form.payment_help_text
|
||||
|
||||
const updated = await adminAPI.settings.updateSettings(payload)
|
||||
Object.assign(form, updated)
|
||||
registrationEmailSuffixWhitelistTags.value = normalizeRegistrationEmailSuffixDomains(
|
||||
|
||||
Reference in New Issue
Block a user