1.新增默认彩金池配置

2.优化关联彩金池配置的名称显示
3.优化一键测试权重
4.优化底注配置
This commit is contained in:
2026-06-04 12:21:57 +08:00
parent 5d316ef7d6
commit dfb37dd33a
40 changed files with 845 additions and 177 deletions

View File

@@ -598,41 +598,100 @@ class DiceRewardLogic
if ($configCw !== null) {
$tier = isset($configCw['tier']) ? trim((string) $configCw['tier']) : '';
if ($tier !== '') {
$rows[] = [
'tier' => $tier,
'direction' => DiceReward::DIRECTION_CLOCKWISE,
'weight' => self::WEIGHT_MIN,
'grid_number' => $gridNumber,
'start_index' => $startId,
'end_index' => isset($configCw['id']) ? (int) $configCw['id'] : 0,
'ui_text' => $configCw['ui_text'] ?? '',
'real_ev' => $configCw['real_ev'] ?? null,
'remark' => $configCw['remark'] ?? '',
'type' => isset($configCw['type']) ? (int) $configCw['type'] : 0,
];
$rows[] = $this->buildReferenceRowFromLandingConfig(
$tier,
$configCw,
DiceReward::DIRECTION_CLOCKWISE,
$gridNumber,
$startId
);
}
}
if ($configCcw !== null) {
$tier = isset($configCcw['tier']) ? trim((string) $configCcw['tier']) : '';
if ($tier !== '') {
$rows[] = [
'tier' => $tier,
'direction' => DiceReward::DIRECTION_COUNTERCLOCKWISE,
'weight' => self::WEIGHT_MIN,
'grid_number' => $gridNumber,
'start_index' => $startId,
'end_index' => isset($configCcw['id']) ? (int) $configCcw['id'] : 0,
'ui_text' => $configCcw['ui_text'] ?? '',
'real_ev' => $configCcw['real_ev'] ?? null,
'remark' => $configCcw['remark'] ?? '',
'type' => isset($configCcw['type']) ? (int) $configCcw['type'] : 0,
];
$rows[] = $this->buildReferenceRowFromLandingConfig(
$tier,
$configCcw,
DiceReward::DIRECTION_COUNTERCLOCKWISE,
$gridNumber,
$startId
);
}
}
}
return ['rows' => $rows, 'skipped' => $skipped];
}
/**
* 对照表落点行:档位按结算金额推断,备注与奖励配置页规则一致
*
* @param array<string, mixed> $landingConfig
* @return array<string, mixed>
*/
private function buildReferenceRowFromLandingConfig(
string $tier,
array $landingConfig,
int $direction,
int $gridNumber,
int $startId
): array {
$realEv = isset($landingConfig['real_ev']) ? (float) $landingConfig['real_ev'] : 0.0;
if ($tier !== 'BIGWIN') {
$inferred = $this->inferTierFromRealEv($realEv);
if ($inferred !== '') {
$tier = $inferred;
}
}
return [
'tier' => $tier,
'direction' => $direction,
'weight' => self::WEIGHT_MIN,
'grid_number' => $gridNumber,
'start_index' => $startId,
'end_index' => isset($landingConfig['id']) ? (int) $landingConfig['id'] : 0,
'ui_text' => $landingConfig['ui_text'] ?? '',
'real_ev' => $landingConfig['real_ev'] ?? null,
'remark' => $this->defaultRemarkForTier($tier),
'type' => isset($landingConfig['type']) ? (int) $landingConfig['type'] : 0,
];
}
/**
* 按结算金额推断档位(与前端 generateIndexByRules 一致)
*/
private function inferTierFromRealEv(float $realEv): string
{
if ($realEv > 2) {
return 'T1';
}
if ($realEv > 1) {
return 'T2';
}
if ($realEv > 0) {
return 'T3';
}
if ($realEv < 0) {
return 'T4';
}
return 'T5';
}
/**
* 档位默认备注
*/
private function defaultRemarkForTier(string $tier): string
{
return match ($tier) {
'T1', 'BIGWIN' => '大奖',
'T2' => '小赚',
'T3' => '抽水',
'T4' => '惩罚',
'T5' => '再来一次',
default => '',
};
}
/**
* 读出当前 dice_reward用于对比/复用权重。key = "direction:grid_number"
* @return array<string, array<string, mixed>>