fix: some
Some checks failed
构建并部署前端到测试环境 / build-and-deploy (push) Failing after 11m29s

This commit is contained in:
luo
2026-09-20 11:37:47 +08:00
parent a6ce24f2f2
commit 94764b0e0a
5 changed files with 51 additions and 50 deletions

View File

@@ -40,8 +40,7 @@ export interface H5PopupConfiguration {
starts_at: string // 生效开始时间(ISO 8601)
ends_at: string // 生效结束时间(ISO 8601)
version: number // 配置版本,每次更新递增;版本参与频率去重,旧版本通知保留原快照
creator: number // 创建人账号ID
updater: number // 最近更新人账号ID
creator_name: string // 创建人名称
created_at: string // 创建时间(ISO 8601)
updated_at: string // 最近更新时间(ISO 8601);启停同样刷新该时间
}

View File

@@ -307,6 +307,7 @@ export function buildPaymentCredentials(
): PaymentCredentialValidationResult {
const spec = getPaymentCredentialFieldSpec(providerType)
const allowedKeys = [...spec.required, ...spec.optional]
const optionalKeys = new Set(spec.optional)
const credentials: Record<string, PaymentCredentialValue> = {}
for (const entry of entries) {
@@ -318,6 +319,7 @@ export function buildPaymentCredentials(
return { credentials: null, error: `凭证字段 ${key} 不属于当前服务商支持的字段` }
}
if (!entry.value) {
if (optionalKeys.has(key)) continue
return { credentials: null, error: `请填写凭证字段 ${key} 的值` }
}
if (Object.prototype.hasOwnProperty.call(credentials, key)) {

View File

@@ -153,13 +153,12 @@
formatList(data.card_types, (value) => cardTypeNames[value] || value),
fullWidth: true
},
{ label: '创建人', prop: 'creator' },
{ label: '创建人', prop: 'creator_name' },
{
label: '创建时间',
formatter: (_value: unknown, data: H5PopupConfiguration) =>
formatDateTime(data.created_at)
},
{ label: '最近更新人', prop: 'updater' },
{
label: '最近更新时间',
formatter: (_value: unknown, data: H5PopupConfiguration) =>

View File

@@ -303,8 +303,7 @@
{ label: '受控动作', prop: 'action_type' },
{ label: '生效时间', prop: 'effective_time' },
{ label: '版本', prop: 'version' },
{ label: '创建人', prop: 'creator' },
{ label: '最近更新人', prop: 'updater' },
{ label: '创建人', prop: 'creator_name' },
{ label: '最近更新时间', prop: 'updated_at' }
]
@@ -408,16 +407,10 @@
},
{ prop: 'version', label: '版本', width: 70 },
{
prop: 'creator',
prop: 'creator_name',
label: '创建人',
width: 90,
formatter: (row: H5PopupConfiguration) => String(row.creator || 0)
},
{
prop: 'updater',
label: '最近更新人',
width: 110,
formatter: (row: H5PopupConfiguration) => String(row.updater || 0)
width: 120,
formatter: (row: H5PopupConfiguration) => row.creator_name || '-'
},
{
prop: 'updated_at',

View File

@@ -72,6 +72,7 @@
v-model="form.provider_type"
:disabled="formMode === 'edit'"
style="width: 100%"
@change="handleProviderTypeChange"
>
<ElOption
v-for="item in providerOptions"
@@ -111,17 +112,15 @@
<template v-if="showCredentialEditor">
<ElDivider content-position="left">写入支付凭证</ElDivider>
<div class="credential-tip">
必填字段:{{ credentialFieldSpec.required.join('、') || '-' }}
字段名已按所选服务商预置,请填写对应的凭证值。必填字段:{{
credentialFieldSpec.required.join('、') || '-'
}}
<template v-if="credentialFieldSpec.optional.length">
;可选字段:{{ credentialFieldSpec.optional.join('、') }}
</template>
</div>
<div class="credential-list">
<div
v-for="entry in form.credentials"
:key="entry.localId"
class="credential-row"
>
<div v-for="entry in form.credentials" :key="entry.localId" class="credential-row">
<ElInput
v-model="entry.key"
placeholder="凭证字段名"
@@ -135,7 +134,11 @@
placeholder="凭证值(不可回显)"
autocomplete="new-password"
aria-label="凭证值"
/>
>
<template v-if="credentialFieldSpec.optional.includes(entry.key)" #prefix>
<ElTag size="small" type="info" effect="plain">可选</ElTag>
</template>
</ElInput>
</div>
</div>
<template v-if="form.provider_type === 'wechat_v2'">
@@ -144,8 +147,9 @@
<ElFormItem label="客户端证书内容">
<ElInput
:model-value="refundCredentialValue('wx_client_cert_content')"
type="textarea"
:rows="4"
type="password"
show-password
autocomplete="new-password"
placeholder="选填,PEM 格式客户端证书内容(仅原路退款需要)"
@update:model-value="setRefundCredentialValue('wx_client_cert_content', $event)"
/>
@@ -153,8 +157,9 @@
<ElFormItem label="客户端私钥内容">
<ElInput
:model-value="refundCredentialValue('wx_client_key_content')"
type="textarea"
:rows="4"
type="password"
show-password
autocomplete="new-password"
placeholder="选填,PEM 格式客户端私钥内容(仅原路退款需要)"
@update:model-value="setRefundCredentialValue('wx_client_key_content', $event)"
/>
@@ -187,7 +192,7 @@
<script setup lang="ts">
import { computed, h, onMounted, onUnmounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { Delete, Plus } from '@element-plus/icons-vue'
import { Plus } from '@element-plus/icons-vue'
import { ElButton, ElMessage, ElMessageBox, ElTag } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import { PaymentMerchantPoolsService } from '@/api/modules'
@@ -293,7 +298,8 @@
? h(
'span',
{
style: 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;',
style:
'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;',
onClick: (event: MouseEvent) => {
event.stopPropagation()
handleNameClick(row)
@@ -416,7 +422,6 @@
const formRef = ref<FormInstance>()
const showCredentialEditor = ref(false)
const credentialError = ref('')
const credentialTemplateKeys = ref<string[]>([])
const initialFormState = () => ({
id: 0,
@@ -440,6 +445,13 @@
// 当前服务商组合下的凭证必填/可选字段枚举
const credentialFieldSpec = computed(() => getPaymentCredentialFieldSpec(form.provider_type))
const isRefundCredentialKey = (key: string) =>
form.provider_type === 'wechat_v2' &&
['wx_client_cert_content', 'wx_client_key_content'].includes(key)
const credentialTemplateKeys = computed(() => [
...credentialFieldSpec.value.required,
...credentialFieldSpec.value.optional.filter((key) => !isRefundCredentialKey(key))
])
const formRules = reactive<FormRules>({
name: [
@@ -461,7 +473,6 @@
form.credentials = []
showCredentialEditor.value = false
credentialError.value = ''
credentialTemplateKeys.value = []
}
const clearSensitiveForm = () => {
@@ -488,34 +499,25 @@
const showCreateDrawer = () => {
if (!canCreateMerchant.value) return
Object.assign(form, initialFormState())
credentialTemplateKeys.value = []
formDrawerVisible.value = true
formMode.value = 'create'
showCredentialEditor.value = true
addCredential()
resetCredentialEntries()
}
const startCredentialReplacement = () => {
if (!canEditMerchant.value) return
form.credentials = []
if (credentialTemplateKeys.value.length > 0) {
form.credentials = credentialTemplateKeys.value.map((key) => ({
localId: generateLocalId(),
key,
value: ''
}))
} else {
addCredential()
}
resetCredentialEntries()
showCredentialEditor.value = true
}
const addCredential = () => {
form.credentials.push({ localId: generateLocalId(), key: '', value: '' })
}
const removeCredential = (index: number) => {
form.credentials.splice(index, 1)
const resetCredentialEntries = () => {
form.credentials = credentialTemplateKeys.value.map((key) => ({
localId: generateLocalId(),
key,
value: ''
}))
credentialError.value = ''
}
const refundCredentialValue = (key: string): string => {
@@ -550,9 +552,15 @@
const firstMatch = PAYMENT_PROVIDER_OPTIONS.find((option) => option.paymentMethod === value)
if (firstMatch) {
form.provider_type = firstMatch.value
if (showCredentialEditor.value) resetCredentialEntries()
}
}
const handleProviderTypeChange = (value: PaymentMerchantProviderType) => {
form.provider_type = value
if (showCredentialEditor.value) resetCredentialEntries()
}
const handleSubmit = async () => {
if (formMode.value === 'create' ? !canCreateMerchant.value : !canEditMerchant.value) return
if (!formRef.value) return
@@ -737,7 +745,7 @@
.credential-row {
display: grid;
grid-template-columns: 1fr 1fr auto;
grid-template-columns: 1fr 1fr;
gap: 8px;
align-items: center;
}
@@ -758,7 +766,7 @@
.refund-credential-fields {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-columns: 1fr;
gap: 12px;
margin-bottom: 8px;
}