优化当前彩金池累加逻辑
This commit is contained in:
@@ -77,13 +77,18 @@ class PlayStartLogic
|
||||
throw new ApiException('Lottery pool config not found (name=default required)');
|
||||
}
|
||||
|
||||
// 玩家累计盈利:仅统计 lottery_config_id=type=0 的成功对局(中奖金额-100*局数)
|
||||
// 玩家累计盈利:仅统计 lottery_config_id=default 的成功对局。
|
||||
// 付费券:盈利按 win_coin - 100/局计算;免费券:不扣除 100/局,只计入 win_coin。
|
||||
$playerQuery = DicePlayRecord::where('player_id', $playerId)
|
||||
->where('lottery_config_id', $configType0->id)
|
||||
->where('status', self::RECORD_STATUS_SUCCESS);
|
||||
$playerWinSum = (float) $playerQuery->sum('win_coin');
|
||||
$playerPlayCount = (int) $playerQuery->count();
|
||||
$playerProfitTotal = $playerWinSum - 100.0 * $playerPlayCount;
|
||||
$paidPlayCount = (int) DicePlayRecord::where('player_id', $playerId)
|
||||
->where('lottery_config_id', $configType0->id)
|
||||
->where('lottery_type', self::LOTTERY_TYPE_PAID)
|
||||
->where('status', self::RECORD_STATUS_SUCCESS)
|
||||
->count();
|
||||
$playerProfitTotal = $playerWinSum - 100.0 * $paidPlayCount;
|
||||
$safetyLine = (int) ($configType0->safety_line ?? 0);
|
||||
$killEnabled = ((int) ($configType0->kill_enabled ?? 1)) === 1;
|
||||
// 盈利>=安全线且开启杀分:付费/免费都用 killScore;盈利<安全线:付费用玩家权重,免费用 killScore(无则用 default)
|
||||
|
||||
Reference in New Issue
Block a user