1.优化开奖和推送
2.新增控制连续开奖赔率
This commit is contained in:
8
web/src/lang/backend/en/config/streakWinReward.ts
Normal file
8
web/src/lang/backend/en/config/streakWinReward.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
desc: 'Streak levels 1–10: payout = bet total × odds_factor. Jackpot rows trigger jackpot.hit on the user private channel, public-game-period, and public-operation-notice when won.',
|
||||
btn_save: 'Save',
|
||||
streak: 'Streak (rounds)',
|
||||
odds_factor: 'Odds factor',
|
||||
is_jackpot: 'Jackpot',
|
||||
err_factor: 'Row {no}: odds factor must be ≥ 1',
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export default {
|
||||
tip: 'Subscribe to public-game-period (global period channel) for period.tick / period.locked / period.opened / period.payout. The server must publish to this channel.',
|
||||
tip: 'Subscribe to public-game-period (global period channel) for period.tick / period.locked / period.opened / period.payout / jackpot.hit. The server must publish to this channel.',
|
||||
}
|
||||
|
||||
8
web/src/lang/backend/zh-cn/config/streakWinReward.ts
Normal file
8
web/src/lang/backend/zh-cn/config/streakWinReward.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
desc: '1~10 档连胜:派彩 = 压注总额 × 赔率系数(odds_factor)。勾选「大奖」的档位在中奖时会对玩家私有频道、public-game-period 与 public-operation-notice 推送 jackpot.hit。',
|
||||
btn_save: '保存',
|
||||
streak: '连胜档(局)',
|
||||
odds_factor: '赔率系数',
|
||||
is_jackpot: '是否大奖',
|
||||
err_factor: '第 {no} 行赔率系数须 ≥1',
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export default {
|
||||
tip: '订阅文档中的「全局对局频道」public-game-period,用于验证 period.tick / period.locked / period.opened / period.payout 等公共事件(需服务端向该频道推送)。',
|
||||
tip: '订阅文档中的「全局对局频道」public-game-period,用于验证 period.tick / period.locked / period.opened / period.payout / jackpot.hit 等公共事件(需服务端向该频道推送)。',
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default {
|
||||
tip: '订阅文档中的「公告广播频道」public-operation-notice,用于验证 notice.popout 等全站公告类推送(需服务端向该频道推送)。',
|
||||
tip: '订阅「公告广播频道」public-operation-notice:全站公告 notice.popout 与本游戏 jackpot.hit(连胜大奖广播)均会发往此频道;需服务端推送。',
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ const DOC_EVENTS = [
|
||||
'period.locked',
|
||||
'period.opened',
|
||||
'period.payout',
|
||||
'jackpot.hit',
|
||||
'bet.accepted',
|
||||
'bet.settled',
|
||||
'wallet.changed',
|
||||
|
||||
@@ -14,32 +14,45 @@
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" border stripe :data="items" row-key="_rowKey" max-height="720">
|
||||
<el-table-column prop="sort" :label="t('config.depositTier.sort')" width="100" align="center">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
border
|
||||
stripe
|
||||
:data="items"
|
||||
row-key="_rowKey"
|
||||
max-height="720"
|
||||
class="deposit-tier-table"
|
||||
header-align="center"
|
||||
>
|
||||
<el-table-column prop="sort" :label="t('config.depositTier.sort')" width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input-number v-model="row.sort" :min="0" :max="9999" :controls="false" style="width: 100%" />
|
||||
<div class="cell-center">
|
||||
<el-input-number v-model="row.sort" :min="0" :max="9999" :controls="false" style="width: 100%; max-width: 160px" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.status')" width="100" align="center">
|
||||
<el-table-column :label="t('config.depositTier.status')" width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch v-model="row.status" :active-value="1" :inactive-value="0" />
|
||||
<div class="cell-center">
|
||||
<el-switch v-model="row.status" :active-value="1" :inactive-value="0" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.title_col')" min-width="180">
|
||||
<el-table-column :label="t('config.depositTier.title_col')" min-width="180" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.title" maxlength="64" :placeholder="t('config.depositTier.title_ph')" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.title_en_col')" min-width="180">
|
||||
<el-table-column :label="t('config.depositTier.title_en_col')" min-width="180" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.title_en" maxlength="64" :placeholder="t('config.depositTier.title_en_ph')" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.amount')" min-width="140">
|
||||
<el-table-column :label="t('config.depositTier.amount')" min-width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.amount" :placeholder="t('config.depositTier.amount_ph')">
|
||||
<template #suffix>
|
||||
@@ -49,7 +62,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.bonus_amount')" min-width="140">
|
||||
<el-table-column :label="t('config.depositTier.bonus_amount')" min-width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.bonus_amount" :placeholder="t('config.depositTier.bonus_ph')">
|
||||
<template #suffix>
|
||||
@@ -59,25 +72,25 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.desc_col')" min-width="220">
|
||||
<el-table-column :label="t('config.depositTier.desc_col')" min-width="220" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.desc" maxlength="255" :autosize="{ minRows: 1, maxRows: 3 }" type="textarea" :placeholder="t('config.depositTier.desc_ph')" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.desc_en_col')" min-width="220">
|
||||
<el-table-column :label="t('config.depositTier.desc_en_col')" min-width="220" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.desc_en" maxlength="255" :autosize="{ minRows: 1, maxRows: 3 }" type="textarea" :placeholder="t('config.depositTier.desc_en_ph')" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.tier_id')" width="140">
|
||||
<el-table-column :label="t('config.depositTier.tier_id')" width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-text class="tier-id" truncated>{{ row.id || t('config.depositTier.auto_id') }}</el-text>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('config.depositTier.operate')" width="90" align="center" fixed="right">
|
||||
<el-table-column :label="t('config.depositTier.operate')" width="90" align="center" header-align="center" fixed="right">
|
||||
<template #default="{ $index }">
|
||||
<el-button type="danger" link @click="onRemove($index)">
|
||||
{{ t('config.depositTier.btn_remove') }}
|
||||
@@ -248,4 +261,18 @@ onMounted(() => {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.deposit-tier-table {
|
||||
:deep(.el-table__header th),
|
||||
:deep(.el-table__body td) {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.cell-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -35,6 +35,7 @@ const baTable = new baTableClass(
|
||||
new baTableApi('/admin/config.GameConfig/'),
|
||||
{
|
||||
pk: 'id',
|
||||
filter: { page: 1, limit: 50 },
|
||||
column: [
|
||||
{ type: 'selection', align: 'center', operator: false },
|
||||
{ label: t('config.gameConfig.id'), prop: 'id', align: 'center', width: 80, operator: 'RANGE', sortable: 'custom' },
|
||||
|
||||
141
web/src/views/backend/config/streakWinReward/index.vue
Normal file
141
web/src/views/backend/config/streakWinReward/index.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="default-main ba-table-box streak-reward-page">
|
||||
<el-alert type="info" :closable="false" show-icon>
|
||||
{{ t('config.streakWinReward.desc') }}
|
||||
</el-alert>
|
||||
|
||||
<div class="toolbar">
|
||||
<el-button type="success" :loading="saving" :disabled="loading" @click="onSave">
|
||||
{{ t('config.streakWinReward.btn_save') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
border
|
||||
stripe
|
||||
:data="rows"
|
||||
max-height="720"
|
||||
class="streak-reward-table"
|
||||
header-align="center"
|
||||
>
|
||||
<el-table-column prop="streak" :label="t('config.streakWinReward.streak')" width="110" align="center" header-align="center" />
|
||||
<el-table-column :label="t('config.streakWinReward.odds_factor')" min-width="200" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="cell-center">
|
||||
<el-input-number v-model="row.odds_factor" :min="1" :max="999" :step="1" :controls="true" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('config.streakWinReward.is_jackpot')" min-width="90" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="cell-center">
|
||||
<el-switch v-model="row.is_jackpot" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import createAxios from '/@/utils/axios'
|
||||
import { auth } from '/@/utils/common'
|
||||
|
||||
defineOptions({
|
||||
name: 'config/streakWinReward',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
type Row = {
|
||||
streak: number
|
||||
odds_factor: number
|
||||
is_jackpot: boolean
|
||||
}
|
||||
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const rows = ref<Row[]>([])
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await createAxios({
|
||||
url: '/admin/config.StreakWinReward/index',
|
||||
method: 'get',
|
||||
})
|
||||
if (res.code === 1 && res.data && Array.isArray(res.data.rows)) {
|
||||
rows.value = res.data.rows.map((r: Row) => ({
|
||||
streak: typeof r.streak === 'number' ? r.streak : 1,
|
||||
odds_factor: typeof r.odds_factor === 'number' ? r.odds_factor : 1,
|
||||
is_jackpot: !!r.is_jackpot,
|
||||
}))
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onSave() {
|
||||
if (!auth('save')) {
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < rows.value.length; i++) {
|
||||
const row = rows.value[i]
|
||||
if (row.odds_factor < 1) {
|
||||
ElMessage.warning(t('config.streakWinReward.err_factor', { no: i + 1 }))
|
||||
return
|
||||
}
|
||||
}
|
||||
saving.value = true
|
||||
try {
|
||||
await createAxios({
|
||||
url: '/admin/config.StreakWinReward/save',
|
||||
method: 'post',
|
||||
data: {
|
||||
rows: rows.value.map((r) => ({
|
||||
streak: r.streak,
|
||||
odds_factor: r.odds_factor,
|
||||
is_jackpot: r.is_jackpot,
|
||||
})),
|
||||
},
|
||||
showSuccessMessage: true,
|
||||
})
|
||||
await load()
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.streak-reward-page {
|
||||
.toolbar {
|
||||
margin: 12px 0;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.streak-reward-table {
|
||||
:deep(.el-table__header th),
|
||||
:deep(.el-table__body td) {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.cell-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user