1.优化奖励配置设置-创建奖励对照表单样式

This commit is contained in:
2026-06-02 15:24:17 +08:00
parent 79c84c198a
commit 13dacc8fdd
4 changed files with 144 additions and 31 deletions

View File

@@ -344,10 +344,14 @@ class DiceRewardLogic
$compare = $this->compareReferenceRows($computed['rows'], $existing);
$unchanged = $compare['unchanged'];
$specialGrids = [5, 10, 15, 20, 25, 30];
$previewRows = [];
foreach ($computed['rows'] as $row) {
$key = $row['direction'] . ':' . $row['grid_number'];
$weight = self::WEIGHT_MIN;
$gridNumber = isset($row['grid_number']) ? (int) $row['grid_number'] : 0;
$weight = $unchanged
? self::WEIGHT_MIN
: (in_array($gridNumber, $specialGrids, true) ? self::WEIGHT_MIN : 100);
$oldStart = null;
$oldEnd = null;
$oldTier = null;
@@ -358,8 +362,13 @@ class DiceRewardLogic
$oldTier = isset($existing[$key]['tier']) ? (string) $existing[$key]['tier'] : null;
$oldWeight = isset($existing[$key]['weight']) ? (int) $existing[$key]['weight'] : null;
}
// 映射未变化时:通常复用旧权重;但若旧权重为 1 且非特殊点数,则按新默认建议展示为 100方便管理员快速落配置
if ($unchanged && $oldWeight !== null) {
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, (int) $oldWeight));
$oldWeight = (int) $oldWeight;
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $oldWeight));
if ($weight === self::WEIGHT_MIN && !in_array($gridNumber, $specialGrids, true)) {
$weight = 100;
}
}
$diffChanged = false;