优化彩金池安全线触发方式

This commit is contained in:
2026-03-16 16:33:53 +08:00
parent 1213f8e58a
commit 0b2f4a026e
7 changed files with 127 additions and 34 deletions

View File

@@ -97,7 +97,7 @@ export default {
},
/**
* 获取当前彩金池Redis 实例化,无则按 type=0 创建),含 profit_amount 实时值
* 获取当前彩金池Redis 实例化,无则按 type=0 创建),含玩家累计盈利 profit_amount 实时值
*/
getCurrentPool() {
return request.get<{
@@ -130,5 +130,14 @@ export default {
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/updateCurrentPool',
data: params
})
},
/**
* 重置当前彩金池的玩家累计盈利profit_amount 置为 0
*/
resetProfitAmount() {
return request.post<any>({
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/resetProfitAmount'
})
}
}

View File

@@ -16,19 +16,21 @@
</div>
<div class="profit-row mb-3">
<div class="flex items-center gap-2">
<span class="text-gray-500">彩金池盈利profit_amount</span>
<span class="font-mono text-lg" :class="profitAmountClass">{{ displayProfitAmount }}</span>
<span class="text-gray-500">玩家累计盈利profit_amount</span>
<span class="font-mono text-lg" :class="profitAmountClass">{{
displayProfitAmount
}}</span>
<span class="realtime-badge">实时</span>
</div>
<div class="profit-calc-hint">
计算方式每局抽奖扣除本局发放成本普通档位 real_ev + 大奖 BIGWIN.real_ev弹窗打开期间每 2 秒自动刷新
计算方式每局当前中奖金额含超级大奖 BIGWIN减去抽奖券费用 100累加弹窗打开期间每 2 秒自动刷新
</div>
</div>
<div class="tip-block">
<div class="tip-title">抽奖档位规则</div>
<div class="tip-content">
彩金池盈利 <strong>低于安全线</strong> <strong>玩家</strong> T*_weight 权重抽取抽奖档位
彩金池盈利 <strong>高于或等于安全线</strong> <strong>当前彩金池</strong> T*_weight 权重抽取档位
玩家在当前彩金池的累计盈利 <strong>低于安全线</strong> <strong>玩家</strong> T*_weight 权重抽取档位
累计盈利 <strong>高于或等于安全线</strong> <strong>当前彩金池</strong> T*_weight 权重抽取档位杀分
</div>
</div>
</div>
@@ -68,6 +70,9 @@
</template>
<template #footer>
<el-button @click="handleClose">关闭</el-button>
<el-button :loading="resetting" :disabled="!pool" @click="handleResetProfit">
重置玩家累计盈利
</el-button>
<el-button type="primary" :loading="saving" :disabled="!pool" @click="handleSubmit">
保存权重与安全线
</el-button>
@@ -102,6 +107,7 @@
const loading = ref(false)
const saving = ref(false)
const resetting = ref(false)
const pool = ref<PoolData | null>(null)
const formRef = ref<FormInstance>()
@@ -221,6 +227,21 @@
}
}
async function handleResetProfit() {
if (!pool.value) return
try {
resetting.value = true
await api.resetProfitAmount()
ElMessage.success('玩家累计盈利已重置为 0')
await loadPool()
emit('success')
} catch (e: any) {
ElMessage.error(e?.message ?? '重置失败')
} finally {
resetting.value = false
}
}
function handleClose() {
stopPolling()
visible.value = false