feat(admin): 密码校验统一与后台 API/设置增强
- 管理端账号/代理/站点等密码最短长度统一为 6 位 - LotterySettings、审计日志展示、币种与报表接口等小修复 - 补充设置批量更新、注单、校验错误等相关测试
This commit is contained in:
@@ -16,21 +16,24 @@ final class AuditLogApiPresenter
|
||||
{
|
||||
/** @var array<string, string> */
|
||||
private const MODULE_LABELS = [
|
||||
'agent' => '代理',
|
||||
'system' => '系统',
|
||||
'agent' => '代理管理',
|
||||
'system' => '系统管理',
|
||||
'settings' => '系统设置',
|
||||
'integration' => '对接站点',
|
||||
'integration' => '接入站点',
|
||||
'player_manage' => '玩家管理',
|
||||
'risk_cap' => '风险池',
|
||||
'odds' => '赔率',
|
||||
'player_service' => '玩家服务',
|
||||
'risk_cap' => '限额规则',
|
||||
'odds' => '赔率配置',
|
||||
'play_config' => '玩法配置',
|
||||
'settlement' => '结算',
|
||||
'report_jobs' => '报表任务',
|
||||
'settlement' => '派彩结算',
|
||||
'report_jobs' => '报表导出',
|
||||
'reconcile_jobs' => '对账任务',
|
||||
'draw' => '开奖',
|
||||
'wallet' => '钱包',
|
||||
'reconcile' => '对账',
|
||||
'job' => '任务',
|
||||
'draw' => '开奖期号',
|
||||
'wallet' => '钱包资金',
|
||||
'reconcile' => '对账核对',
|
||||
'jackpot' => '奖池',
|
||||
'dashboard' => '工作台',
|
||||
'job' => '后台任务',
|
||||
'bootstrap' => '系统',
|
||||
];
|
||||
|
||||
@@ -58,7 +61,17 @@ final class AuditLogApiPresenter
|
||||
'payout_adjustment' => '派彩调整',
|
||||
'rotate_secrets' => '轮换密钥',
|
||||
'toggle_active' => '切换启用状态',
|
||||
'enqueue' => '提交报表任务',
|
||||
'enqueue' => '提交报表导出',
|
||||
'freeze' => '冻结玩家',
|
||||
'unfreeze' => '解冻玩家',
|
||||
'publish' => '发布开奖结果',
|
||||
'reopen' => '重新开奖',
|
||||
'run' => '执行结算',
|
||||
'confirm' => '确认账单',
|
||||
'close' => '关账',
|
||||
'payment' => '登记回款',
|
||||
'write_off' => '坏账核销',
|
||||
'adjustment' => '调整账单',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
@@ -80,6 +93,30 @@ final class AuditLogApiPresenter
|
||||
'transfer_no' => '转账单',
|
||||
'draw' => '期次',
|
||||
'batch' => '批次',
|
||||
'agent_settlement_bill' => '代理结算单',
|
||||
'agent_settlement_period' => '代理结算期',
|
||||
'integration_site' => '接入站点',
|
||||
'jackpot_pool' => '奖池',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
private const API_RESOURCE_ENTITY_LABELS = [
|
||||
'admin-users' => '管理员',
|
||||
'admin-roles' => '角色',
|
||||
'agent-nodes' => '代理',
|
||||
'agent-roles' => '代理角色',
|
||||
'agent-admin-users' => '代理账号',
|
||||
'agent-lines' => '代理线路',
|
||||
'agent-delegation-grants' => '代理授权',
|
||||
'draws' => '期次',
|
||||
'players' => '玩家',
|
||||
'settings' => '系统设置',
|
||||
'integration-sites' => '接入站点',
|
||||
'reconcile-jobs' => '对账任务',
|
||||
'report-jobs' => '报表任务',
|
||||
'settlement-batches' => '结算批次',
|
||||
'jackpot' => '奖池',
|
||||
'risk' => '风控',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
@@ -138,6 +175,7 @@ final class AuditLogApiPresenter
|
||||
'module_label' => self::moduleLabel($r->module_code),
|
||||
'action_label' => self::actionLabel($r, $resourceNames),
|
||||
'target_label' => self::targetLabel($r, $resourceNames),
|
||||
'summary_label' => self::summaryLabel($r, $resourceNames),
|
||||
'before_json' => $r->before_json,
|
||||
'after_json' => $r->after_json,
|
||||
'ip' => $r->ip,
|
||||
@@ -311,9 +349,9 @@ final class AuditLogApiPresenter
|
||||
}
|
||||
|
||||
if (self::isApiResourceCode($type)) {
|
||||
$name = $resourceNames[$type] ?? $type;
|
||||
$entity = self::entityLabelFromResourceCode($type, $resourceNames);
|
||||
|
||||
return $id !== '' ? sprintf('%s #%s', $name, $id) : $name;
|
||||
return $id !== '' ? sprintf('%s #%s', $entity, $id) : $entity;
|
||||
}
|
||||
|
||||
$typeLabel = self::TARGET_TYPE_LABELS[$type] ?? $type;
|
||||
@@ -321,6 +359,48 @@ final class AuditLogApiPresenter
|
||||
return $id !== '' ? sprintf('%s #%s', $typeLabel, $id) : $typeLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $resourceNames
|
||||
*/
|
||||
private static function summaryLabel(AuditLog $r, array $resourceNames): string
|
||||
{
|
||||
$module = self::moduleLabel($r->module_code);
|
||||
$action = self::actionLabel($r, $resourceNames);
|
||||
$target = self::targetLabel($r, $resourceNames);
|
||||
|
||||
if ($action === '—') {
|
||||
return $module;
|
||||
}
|
||||
|
||||
if ($target === '—') {
|
||||
return sprintf('%s · %s', $module, $action);
|
||||
}
|
||||
|
||||
if ($target === $action || str_starts_with($target, $action.' #')) {
|
||||
return sprintf('%s · %s', $module, $action);
|
||||
}
|
||||
|
||||
return sprintf('%s · %s(%s)', $module, $action, $target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $resourceNames
|
||||
*/
|
||||
private static function entityLabelFromResourceCode(string $code, array $resourceNames): string
|
||||
{
|
||||
$segments = explode('.', $code);
|
||||
if (count($segments) < 2) {
|
||||
return $resourceNames[$code] ?? $code;
|
||||
}
|
||||
|
||||
$resourceSegment = $segments[1] ?? '';
|
||||
if (isset(self::API_RESOURCE_ENTITY_LABELS[$resourceSegment])) {
|
||||
return self::API_RESOURCE_ENTITY_LABELS[$resourceSegment];
|
||||
}
|
||||
|
||||
return $resourceNames[$code] ?? $resourceSegment;
|
||||
}
|
||||
|
||||
private static function isApiResourceCode(?string $code): bool
|
||||
{
|
||||
return is_string($code) && str_starts_with($code, 'admin.');
|
||||
|
||||
Reference in New Issue
Block a user