第二词提交哦啊
This commit is contained in:
parent
5259325b94
commit
c6f71c7b16
@ -215,12 +215,12 @@ async def broadcast_pool_updates(streamer_id: int):
|
||||
# 获取最新奖池数据
|
||||
pool_data = get_pool_cache(chest.id)
|
||||
|
||||
# 计算赔率
|
||||
# 计算赔率 - 修改为只对获胜方抽水
|
||||
total = pool_data["pool_a"] + pool_data["pool_b"]
|
||||
if total > 0:
|
||||
distributable = total * 0.9
|
||||
odds_a = round(distributable / pool_data["pool_a"], 2) if pool_data["pool_a"] > 0 else 0
|
||||
odds_b = round(distributable / pool_data["pool_b"], 2) if pool_data["pool_b"] > 0 else 0
|
||||
# 赔率计算改为:(自己奖池 + 对方奖池 * 0.9) / 自己奖池
|
||||
odds_a = round((pool_data["pool_a"] + pool_data["pool_b"] * 0.9) / pool_data["pool_a"], 2) if pool_data["pool_a"] > 0 else 0
|
||||
odds_b = round((pool_data["pool_b"] + pool_data["pool_a"] * 0.9) / pool_data["pool_b"], 2) if pool_data["pool_b"] > 0 else 0
|
||||
else:
|
||||
odds_a = odds_b = 0
|
||||
|
||||
|
||||
@ -37,16 +37,16 @@ class ChestResponse(ChestBase):
|
||||
"""计算A边赔率 (1 : X)"""
|
||||
if self.pool_a == 0:
|
||||
return 0.0
|
||||
distributable = self.total_pool * 0.9
|
||||
return round(distributable / self.pool_a, 2)
|
||||
# 修改赔率计算方式,只对获胜方抽水
|
||||
return round((self.pool_a + self.pool_b * 0.9) / self.pool_a, 2)
|
||||
|
||||
@property
|
||||
def odds_b(self) -> float:
|
||||
"""计算B边赔率 (1 : X)"""
|
||||
if self.pool_b == 0:
|
||||
return 0.0
|
||||
distributable = self.total_pool * 0.9
|
||||
return round(distributable / self.pool_b, 2)
|
||||
# 修改赔率计算方式,只对获胜方抽水
|
||||
return round((self.pool_b + self.pool_a * 0.9) / self.pool_b, 2)
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@ -424,10 +424,12 @@ class GameService:
|
||||
print(f"平台抽水转账失败: {str(e)}")
|
||||
# 可以在这里添加更详细的错误处理逻辑,比如发送告警通知
|
||||
|
||||
# 计算赔率
|
||||
# 计算赔率 - 修改为只对获胜方抽水
|
||||
winner_pool = chest.pool_a if winner == "A" else chest.pool_b
|
||||
loser_pool = chest.pool_b if winner == "A" else chest.pool_a
|
||||
if winner_pool > 0:
|
||||
odds = distributable / winner_pool
|
||||
# 赔率计算改为:(获胜方奖池 + 失败方奖池 * 0.9) / 获胜方奖池
|
||||
odds = (winner_pool + loser_pool * 0.9) / winner_pool
|
||||
|
||||
# 结算给获胜方
|
||||
for bet in bets:
|
||||
|
||||
@ -275,8 +275,9 @@ const ChestPage = () => {
|
||||
}
|
||||
|
||||
const totalPool = chest.pool_a + chest.pool_b;
|
||||
const oddsA = totalPool > 0 ? (totalPool * 0.9) / chest.pool_a : 0;
|
||||
const oddsB = totalPool > 0 ? (totalPool * 0.9) / chest.pool_b : 0;
|
||||
// 修改赔率计算方式,只对获胜方抽水
|
||||
const oddsA = totalPool > 0 ? (chest.pool_a + chest.pool_b * 0.9) / chest.pool_a : 0;
|
||||
const oddsB = totalPool > 0 ? (chest.pool_b + chest.pool_a * 0.9) / chest.pool_b : 0;
|
||||
|
||||
// 计算用户在当前宝箱各选项上的累计下注金额
|
||||
const userBetsOnA = bets
|
||||
@ -388,9 +389,9 @@ const ChestPage = () => {
|
||||
disabled={chest.status !== 0}
|
||||
/>
|
||||
<div className="quick-amounts">
|
||||
<button onClick={() => setBetAmount('100')}>100</button>
|
||||
<button onClick={() => setBetAmount('500')}>500</button>
|
||||
<button onClick={() => setBetAmount('1000')}>1000</button>
|
||||
<button onClick={() => setBetAmount('10000')}>10000</button>
|
||||
<button onClick={() => setBetAmount('100000')}>100000</button>
|
||||
<button onClick={() => setBetAmount(user?.balance.toString() || '0')}>
|
||||
全押
|
||||
</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user