fix: 微信配置
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m39s

This commit is contained in:
sexygoat
2026-05-22 16:07:47 +08:00
parent b364fb4aec
commit 878d93a865
10 changed files with 994 additions and 633 deletions

View File

@@ -0,0 +1,64 @@
import type { PaymentProviderType, WechatConfig } from '@/types/api'
const PAYMENT_PROVIDER_LABELS: Record<PaymentProviderType, string> = {
wechat: '微信直连',
wechat_v2: '微信直连V2',
fuiou: '富友支付'
}
export const getPaymentProviderText = (type: PaymentProviderType): string => {
return PAYMENT_PROVIDER_LABELS[type] || type
}
export const getPaymentMerchantId = (
config: Pick<WechatConfig, 'provider_type' | 'wx_mch_id' | 'fy_mchnt_cd'>
): string => {
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
return config.wx_mch_id || '-'
}
if (config.provider_type === 'fuiou') {
return config.fy_mchnt_cd || '-'
}
return '-'
}
export const getPaymentNotifyUrl = (
config: Pick<WechatConfig, 'provider_type' | 'wx_notify_url' | 'fy_notify_url' | 'ali_notify_url'>
): string => {
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
return config.wx_notify_url || '-'
}
if (config.provider_type === 'fuiou') {
return config.fy_notify_url || '-'
}
return config.ali_notify_url || '-'
}
export const getPaymentConfigStatus = (value: string | undefined | null): string => {
if (!value) return '未配置'
if (value === 'configured' || value === '[已配置]' || value === '已配置') {
return '已配置'
}
if (value === '[未配置]' || value === '未配置') {
return '未配置'
}
return value
}
export const isMaskedPaymentConfigValue = (value: string | undefined | null): boolean => {
if (!value) return false
return (
value === '***' ||
value.includes('已配置') ||
value.includes('未配置') ||
/\*{2,}/.test(value)
)
}