删除库存和旧回调管理

This commit is contained in:
yml
2026-05-25 23:07:19 +08:00
parent 90ad866ecc
commit 2c7464b1eb
87 changed files with 94 additions and 5794 deletions
-32
View File
@@ -24,15 +24,10 @@ export function formatAuditAction(action: string) {
admin_user_role_updated: "修改用户角色",
admin_user_status_updated: "修改用户状态",
admin_user_password_reset: "重置用户密码",
task_release_inventory: "释放任务库存",
task_release_inventory_binding: "释放任务库存绑定",
task_regenerate_claim_link: "重发领取链接",
task_closed: "关闭任务",
task_mark_manual_review: "转人工处理",
task_complete_manual_dispatch: "完成人工履约",
inventory_item_released: "释放库存项",
inventory_item_invalidated: "作废库存项",
webhook_replayed: "重放 Webhook",
platform_shop_config_updated: "更新店铺配置",
platform_fulfillment_config_updated: "更新履约配置",
};
@@ -44,9 +39,6 @@ export function formatAuditTargetType(targetType: string) {
const labelMap: Record<string, string> = {
admin_user: "后台用户",
task: "交付任务",
task_inventory_binding: "任务库存绑定",
inventory_item: "库存项",
webhook_event: "Webhook 事件",
platform_config: "平台配置",
};
@@ -56,10 +48,8 @@ export function formatAuditTargetType(targetType: string) {
export function formatTaskEventType(eventType: string) {
const labelMap: Record<string, string> = {
manual_dispatch_completed: "人工履约已回写",
inventory_binding_released: "库存绑定已释放",
claim_redeem_code_used: "兑换码已使用",
claim_redeem_code_invalid: "兑换码错误",
claim_redeem_inventory_replaced: "已切换新兑换码",
claim_redeem_completed: "兑换链路完成",
};
@@ -114,11 +104,6 @@ export function formatTaskEventPayload(payload: Record<string, unknown>) {
payload.codeMasked ? `凭据 ${payload.codeMasked}` : "",
payload.previousCodeMasked ? `旧码 ${payload.previousCodeMasked}` : "",
payload.nextCodeMasked ? `新码 ${payload.nextCodeMasked}` : "",
payload.inventoryItemId ? `库存项 #${payload.inventoryItemId}` : "",
payload.previousInventoryItemId
? `旧库存 #${payload.previousInventoryItemId}`
: "",
payload.nextInventoryItemId ? `新库存 #${payload.nextInventoryItemId}` : "",
payload.ticketCodeMasked ? `卡券号 ${payload.ticketCodeMasked}` : "",
payload.vnId ? `虚拟号 #${payload.vnId}` : "",
payload.vnPhoneMasked ? `号码 ${payload.vnPhoneMasked}` : "",
@@ -147,20 +132,3 @@ export function formatTaskEventPayload(payload: Record<string, unknown>) {
return JSON.stringify(payload || {});
}
export function formatBindingRoleSummary(
roleKeys: string[] | undefined | null,
emptyLabel = "-"
) {
if (!Array.isArray(roleKeys) || roleKeys.length === 0) return emptyLabel;
return roleKeys.join(" / ");
}
export function formatBindingCountSummary(summary: {
totalBindingCount: number;
reservedBindingCount: number;
consumedBindingCount: number;
releasedBindingCount: number;
}) {
return `${summary.totalBindingCount} 条 · 预占 ${summary.reservedBindingCount} · 已消费 ${summary.consumedBindingCount} · 已释放 ${summary.releasedBindingCount}`;
}
-39
View File
@@ -10,8 +10,6 @@ export const adminTaskStatusOptions = [
{ label: '全部', value: '' },
{ label: '待支付', value: 'pending_payment' },
{ label: '已支付', value: 'paid' },
{ label: '待库存', value: 'waiting_inventory' },
{ label: '已预占', value: 'cdk_reserved' },
{ label: '已生成链接', value: 'link_generated' },
{ label: '已创建会话', value: 'claimed' },
{ label: '已确认角色', value: 'role_confirmed' },
@@ -23,36 +21,6 @@ export const adminTaskStatusOptions = [
{ label: '已关闭', value: 'closed' },
]
export const adminInventoryStatusOptions = [
{ label: '全部', value: '' },
{ label: '可用', value: 'available' },
{ label: '已预占', value: 'reserved' },
{ label: '已发放', value: 'delivered' },
{ label: '已消耗', value: 'consumed' },
{ label: '已作废', value: 'invalid' },
]
export const adminInventoryCredentialTypeOptions = [
{ label: '全部凭据类型', value: '' },
{ label: '兑换码(领取链路)', value: 'claim_code' },
{ label: '卡号卡密', value: 'card_password' },
{ label: '账号密码', value: 'account_password' },
{ label: '激活链接', value: 'activation_link' },
{ label: '纯文本凭据', value: 'text_credential' },
]
export const adminWebhookProcessedOptions = [
{ label: '全部', value: '' },
{ label: '处理成功', value: '1' },
{ label: '处理失败', value: '0' },
]
export const adminWebhookVisibilityOptions = [
{ label: '仅重要', value: 'important' },
{ label: '仅忽略', value: 'ignored' },
{ label: '全部', value: 'all' },
]
export const adminUserRoleOptions = [
{ label: '全部', value: '' },
{ label: '管理员', value: 'admin' },
@@ -71,21 +39,14 @@ export const adminAuditActionOptions = [
{ label: '创建后台用户', value: 'admin_user_created' },
{ label: '修改用户角色', value: 'admin_user_role_updated' },
{ label: '修改用户状态', value: 'admin_user_status_updated' },
{ label: '修改用户库存组', value: 'admin_user_inventory_groups_updated' },
{ label: '重置用户密码', value: 'admin_user_password_reset' },
{ label: '释放任务库存', value: 'task_release_inventory' },
{ label: '重发领取链接', value: 'task_regenerate_claim_link' },
{ label: '关闭任务', value: 'task_closed' },
{ label: '转人工处理', value: 'task_mark_manual_review' },
{ label: '释放库存项', value: 'inventory_item_released' },
{ label: '作废库存项', value: 'inventory_item_invalidated' },
{ label: '重放 Webhook', value: 'webhook_replayed' },
]
export const adminAuditTargetTypeOptions = [
{ label: '全部', value: '' },
{ label: '后台用户', value: 'admin_user' },
{ label: '交付任务', value: 'task' },
{ label: '库存项', value: 'inventory_item' },
{ label: 'Webhook 事件', value: 'webhook_event' },
]
-22
View File
@@ -1,22 +0,0 @@
import { formatStatusWithRaw } from '@/utils/admin-display'
export function formatAdminWebhookEventType(eventType: string) {
const normalized = String(eventType || '').trim()
if (!normalized) {
return '-'
}
const labelMap: Record<string, string> = {
payment_success: '支付成功',
trade_create: '订单创建',
trade_closed: '订单关闭',
buyer_confirm_goods: '确认收货',
auto_delivery_done: '自动发货完成',
auto_delivery_confirmed: '自动发货确认完成',
refund_apply: '买家申请退款',
trade_event: '交易事件',
}
return formatStatusWithRaw(normalized, labelMap)
}