优化当前彩金池累加逻辑

This commit is contained in:
2026-03-20 15:03:18 +08:00
parent d72868eb76
commit 8684fdc9f0
2 changed files with 17 additions and 7 deletions

View File

@@ -80,7 +80,8 @@ class WeightTestRunner
DiceRewardConfig::clearRequestInstance();
DiceReward::clearRequestInstance();
//“玩家”盈利: 玩家累计盈利:仅统计 lottery_config_id=default 的成功对局win_coin - 100与 PlayStartLogic 一致
//“玩家”盈利:仅统计 lottery_config_id=default 的成功对局
// 付费券:盈利 = win_coin - 100/局;免费券:盈利 = win_coin不扣除 100/局)
$playerProfitTotal = 0.0;
$playLogic = new PlayStartLogic();
@@ -114,6 +115,7 @@ class WeightTestRunner
}
for ($i = 0; $i < $freeS; $i++) {
$row = $playLogic->simulateOnePlay($freeConfig, 0, 1, null);
$this->accumulateProfitForDefault($row, 1, $freeConfig, $configType0, $playerProfitTotal);
$this->aggregate($row, $resultCounts, $tierCounts);
$buffer[] = $this->rowForInsert($row, $recordId);
$done++;
@@ -121,6 +123,7 @@ class WeightTestRunner
}
for ($i = 0; $i < $freeN; $i++) {
$row = $playLogic->simulateOnePlay($freeConfig, 1, 1, null);
$this->accumulateProfitForDefault($row, 1, $freeConfig, $configType0, $playerProfitTotal);
$this->aggregate($row, $resultCounts, $tierCounts);
$buffer[] = $this->rowForInsert($row, $recordId);
$done++;
@@ -139,17 +142,19 @@ class WeightTestRunner
}
/**
* 仅当付费抽奖且使用 default 池时累加玩家盈利win_coin - 100,与 PlayStartLogic 一致
* 仅当使用 default 池lottery_config_id=default时累加玩家盈利,与 PlayStartLogic 一致
* @param int $lotteryType 0=付费券1=免费券
* @param object $usedConfig 本次使用的奖池配置
* @param object $configType0 name=default 的彩金池
*/
private function accumulateProfitForDefault(array $row, int $lotteryType, $usedConfig, $configType0, float &$playerProfitTotal): void
{
if ($lotteryType !== 0 || $usedConfig === null || $configType0 === null || !isset($row['win_coin'])) {
if (($lotteryType !== 0 && $lotteryType !== 1) || $usedConfig === null || $configType0 === null || !isset($row['win_coin'])) {
return;
}
if ((int) $usedConfig->id === (int) $configType0->id) {
$playerProfitTotal += (float) $row['win_coin'] - 100.0;
$winCoin = (float) $row['win_coin'];
$playerProfitTotal += $lotteryType === 0 ? ($winCoin - 100.0) : $winCoin;
}
}