feat(worker-platform): 支持后台配置匹配日志保留上限与天数并提供一键清理历史多余记录
1. 扩展商品匹配配置支持 maxMatchLogs (条数上限) 与 matchLogRetentionDays (保留天数); 2. 新增分批物理清理逻辑 pruneWorkProductMatchLogs,通过索引高效分批删除超出限制的记录; 3. 集成定时任务数据保留清理 data-retention-job,并在保存配置与写入时自动滚动清理; 4. 匹配诊断日志面板新增可视化保留策略设置栏,支持管理员自定义上限、一键保存并提供一键清理超出记录按钮。
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
listAdminKuaishouMatchSources,
|
||||
listAdminWorkCategories,
|
||||
listAdminWorkProductMatchLogs,
|
||||
pruneAdminWorkProductMatchLogs,
|
||||
listAdminWorkProductRuleMappings,
|
||||
listAdminWorkProductRules,
|
||||
listAdminWorkerLevels,
|
||||
@@ -341,6 +342,22 @@ router.get(
|
||||
}),
|
||||
)
|
||||
|
||||
router.post(
|
||||
'/worker-platform/product-match-logs/cleanup',
|
||||
requireAdminRoles(['admin', 'operator']),
|
||||
createJsonHandler((req) => pruneAdminWorkProductMatchLogs(req.body || {}), {
|
||||
successMessage: '匹配日志清理完成',
|
||||
errorMessage: '清理匹配日志失败',
|
||||
scope: '[admin/worker-platform/product-match-logs/cleanup]',
|
||||
audit: (_req, data) => ({
|
||||
action: 'worker_product_match_logs_cleaned',
|
||||
targetType: 'worker_product_match_logs',
|
||||
targetId: 'cleanup',
|
||||
data: data && typeof data === 'object' ? (data as Record<string, unknown>) : {},
|
||||
}),
|
||||
}),
|
||||
)
|
||||
|
||||
router.get(
|
||||
'/worker-platform/finance-config',
|
||||
requireAdminRoles(['admin', 'operator', 'support', 'finance']),
|
||||
|
||||
Reference in New Issue
Block a user