优化中奖权重计算方式

This commit is contained in:
2026-03-12 17:17:00 +08:00
parent 064ce06393
commit 7e4ba86afa
25 changed files with 2344 additions and 403 deletions

View File

@@ -10,11 +10,13 @@
<ElSpace wrap>
<ElButton
v-permission="'dice:reward_config:index:update'"
type="primary"
@click="weightRatioVisible = true"
type="warning"
:loading="createRewardLoading"
@click="handleCreateRewardReference"
v-ripple
title="按规则start_index=config(grid_number).id顺时针 end_index=(start_index+grid_number)%26逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number"
>
T1-T5 BIGWIN 权重配比
创建奖励对照
</ElButton>
<ElButton
v-permission="'dice:reward_config:index:index'"
@@ -66,24 +68,52 @@
:data="dialogData"
@success="refreshData"
/>
<!-- T1-T5BIGWIN 权重配比弹窗 -->
<WeightRatioDialog v-model="weightRatioVisible" @success="refreshData" />
<!-- 权重配比测试弹窗 -->
<WeightTestDialog v-model="weightTestVisible" />
</div>
</template>
<script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus'
import { useTable } from '@/hooks/core/useTable'
import { useSaiAdmin } from '@/composables/useSaiAdmin'
import api from '../../api/reward_config/index'
import TableSearch from './modules/table-search.vue'
import EditDialog from './modules/edit-dialog.vue'
import WeightRatioDialog from './modules/weight-ratio-dialog.vue'
import WeightTestDialog from './modules/weight-test-dialog.vue'
const weightRatioVisible = ref(false)
const weightTestVisible = ref(false)
const createRewardLoading = ref(false)
async function handleCreateRewardReference() {
try {
await ElMessageBox.confirm(
'按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id顺时针 end_index=(start_index+摇取点数)%26逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?',
'创建奖励对照',
{
confirmButtonText: '确定创建',
cancelButtonText: '取消',
type: 'warning'
}
)
} catch {
return
}
createRewardLoading.value = true
try {
const res: any = await api.createRewardReference()
const data = res?.data ?? res
const msg =
typeof data === 'object' && data !== null
? `已按 5-30 共26个点数、顺时针+逆时针创建:顺时针新增 ${data.created_clockwise ?? 0} 条、逆时针新增 ${data.created_counterclockwise ?? 0} 条;顺时针更新 ${data.updated_clockwise ?? 0} 条、逆时针更新 ${data.updated_counterclockwise ?? 0}${(data.skipped ?? 0) > 0 ? `${data.skipped} 个点数使用兜底起始索引` : ''}`
: '创建成功'
ElMessage.success(msg)
} catch (e: any) {
ElMessage.error(e?.message ?? '创建奖励对照失败')
} finally {
createRewardLoading.value = false
}
}
// 搜索表单
const searchForm = ref<Record<string, unknown>>({
@@ -121,12 +151,12 @@
apiParams: { limit: 100 },
columnsFactory: () => [
// { type: 'selection' },
{ prop: 'id', label: 'ID(索引)', width: 80, align: 'center' },
{ prop: 'grid_number', label: '色子点数', align: 'center' },
{ prop: 'ui_text', label: '前端显示文本', align: 'center' },
{ prop: 'real_ev', label: '真实资金结算', align: 'center' },
{ prop: 'tier', label: '所属档位', sortable: true, align: 'center' },
{ prop: 'weight', label: '权重(1-10000)', width: 110, align: 'center' },
{ prop: 'weight', label: '权重(1-10000)', sortable: true, align: 'center' },
// 权重已迁移至「权重配比」弹窗dice_reward 表,区分顺时针/逆时针)
// { prop: 'create_time', label: '创建时间', sortable: true, align: 'center' },
{
prop: 'operation',