优化杀分逻辑
This commit is contained in:
@@ -75,10 +75,6 @@ class PlayStartLogic
|
||||
if (!$configType0) {
|
||||
throw new ApiException('奖池配置不存在(需 type=0)');
|
||||
}
|
||||
// 杀分时使用 type=1 配置的权重;未杀分时付费用 type=0、免费用 type=1(无 type=1 时回退 type=0)
|
||||
$configForWeights = $ticketType === self::LOTTERY_TYPE_PAID
|
||||
? $configType0
|
||||
: ($configType1 ?? $configType0);
|
||||
|
||||
// 玩家累计盈利:仅统计 lottery_config_id=type=0 的成功对局(中奖金额-100*局数)
|
||||
$playerQuery = DicePlayRecord::where('player_id', $playerId)
|
||||
@@ -88,13 +84,11 @@ class PlayStartLogic
|
||||
$playerPlayCount = (int) $playerQuery->count();
|
||||
$playerProfitTotal = $playerWinSum - 100.0 * $playerPlayCount;
|
||||
$safetyLine = (int) ($configType0->safety_line ?? 0);
|
||||
// 玩家累计盈利>=安全线时杀分:用 type=1 的 T*_weight,并记录 lottery_config_id=type=1 的 id;否则用玩家权重,记录对应配置 id
|
||||
$usePoolWeights = $playerProfitTotal >= $safetyLine && $configType1 !== null;
|
||||
if ($usePoolWeights) {
|
||||
$config = $configType1;
|
||||
} else {
|
||||
$config = $configForWeights;
|
||||
}
|
||||
$killEnabled = ((int) ($configType0->kill_enabled ?? 1)) === 1;
|
||||
// 玩家累计盈利>=安全线时杀分:无论付费/免费,都用 type=1 的 T*_weight;未达到时一律按玩家权重
|
||||
// 记录 lottery_config_id:杀分记 type=1;未杀分统一记当前池 type=0
|
||||
$usePoolWeights = $killEnabled && $playerProfitTotal >= $safetyLine && $configType1 !== null;
|
||||
$config = $usePoolWeights ? $configType1 : $configType0;
|
||||
|
||||
// 按档位 T1-T5 抽取后,从 DiceReward 表按当前方向取该档位数据,再按 weight 抽取一条得到 grid_number
|
||||
$rewardInstance = DiceReward::getCachedInstance();
|
||||
|
||||
Reference in New Issue
Block a user