1.优化奖励配置设置-创建奖励对照表单样式
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user