重构DiceLotteryConfig为DiceLotteryPoolConfig

This commit is contained in:
2026-03-10 17:56:14 +08:00
parent 1a748745cb
commit 54aa0bd34f
22 changed files with 160 additions and 160 deletions

View File

@@ -1,28 +1,28 @@
import request from '@/utils/http'
/**
* API
* API
*/
export default {
/**
* DiceLotteryConfig
* DiceLotteryPoolConfig
* @param params
* @returns
*/
list(params: Record<string, any>) {
return request.get<Api.Common.ApiPage>({
url: '/dice/lottery_config/DiceLotteryConfig/index',
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/index',
params
})
},
/**
* DiceLotteryConfig idname lottery_config_id
* @returns DiceLotteryConfig['id','name']
* DiceLotteryPoolConfig idname lottery_config_id
* @returns DiceLotteryPoolConfig['id','name']
*/
async getOptions(): Promise<Array<{ id: number; name: string }>> {
const res = await request.get<any>({
url: '/dice/lottery_config/DiceLotteryConfig/getOptions'
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/getOptions'
})
const rows = (res?.data ?? []) as Array<{ id: number; name: string }>
return Array.isArray(rows)
@@ -37,7 +37,7 @@ export default {
*/
read(id: number | string) {
return request.get<Api.Common.ApiData>({
url: '/dice/lottery_config/DiceLotteryConfig/read?id=' + id
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/read?id=' + id
})
},
@@ -48,7 +48,7 @@ export default {
*/
save(params: Record<string, any>) {
return request.post<any>({
url: '/dice/lottery_config/DiceLotteryConfig/save',
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/save',
data: params
})
},
@@ -60,7 +60,7 @@ export default {
*/
update(params: Record<string, any>) {
return request.put<any>({
url: '/dice/lottery_config/DiceLotteryConfig/update',
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/update',
data: params
})
},
@@ -72,7 +72,7 @@ export default {
*/
delete(params: Record<string, any>) {
return request.del<any>({
url: '/dice/lottery_config/DiceLotteryConfig/destroy',
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/destroy',
data: params
})
},
@@ -92,7 +92,7 @@ export default {
t5_weight: number
profit_amount: number
}>({
url: '/dice/lottery_config/DiceLotteryConfig/getCurrentPool'
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/getCurrentPool'
})
},
@@ -108,7 +108,7 @@ export default {
t5_weight?: number
}) {
return request.post<any>({
url: '/dice/lottery_config/DiceLotteryConfig/updateCurrentPool',
url: '/dice/lottery_pool_config/DiceLotteryPoolConfig/updateCurrentPool',
data: params
})
}

View File

@@ -74,7 +74,7 @@ export default {
},
/**
* 获取彩金池配置选项DiceLotteryConfig.id、name供 lottery_config_id 下拉使用
* 获取彩金池配置选项DiceLotteryPoolConfig.id、name供 lottery_config_id 下拉使用
* @returns [ { id, name } ]
*/
async getLotteryConfigOptions(): Promise<Array<{ id: number; name: string }>> {

View File

@@ -8,7 +8,7 @@
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
<template #left>
<ElButton
v-permission="'dice:lottery_config:index:index'"
v-permission="'dice:lottery_pool_config:index:index'"
type="primary"
@click="showCurrentPoolDialog"
>
@@ -34,12 +34,12 @@
<template #operation="{ row }">
<div class="flex gap-2">
<SaButton
v-permission="'dice:lottery_config:index:update'"
v-permission="'dice:lottery_pool_config:index:update'"
type="secondary"
@click="showDialog('edit', row)"
/>
<!-- <SaButton-->
<!-- v-permission="'dice:lottery_config:index:destroy'"-->
<!-- v-permission="'dice:lottery_pool_config:index:destroy'"-->
<!-- type="error"-->
<!-- @click="deleteRow(row, api.delete, refreshData)"-->
<!-- />-->
@@ -63,7 +63,7 @@
<script setup lang="ts">
import { useTable } from '@/hooks/core/useTable'
import { useSaiAdmin } from '@/composables/useSaiAdmin'
import api from '../../api/lottery_config/index'
import api from '../../api/lottery_pool_config/index'
import TableSearch from './modules/table-search.vue'
import EditDialog from './modules/edit-dialog.vue'
import CurrentPoolDialog from './modules/current-pool-dialog.vue'

View File

@@ -64,7 +64,7 @@
</template>
<script setup lang="ts">
import api from '../../../api/lottery_config/index'
import api from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'

View File

@@ -78,7 +78,7 @@
</template>
<script setup lang="ts">
import api from '../../../api/lottery_config/index'
import api from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'

View File

@@ -133,7 +133,7 @@
const usernameFormatter = (row: Record<string, any>) =>
row?.dicePlayer?.username ?? row?.player_id ?? '-'
const lotteryConfigNameFormatter = (row: Record<string, any>) =>
row?.diceLotteryConfig?.name ?? row?.lottery_config_id ?? '-'
row?.diceLotteryPoolConfig?.name ?? row?.lottery_config_id ?? '-'
const rewardTierFormatter = (row: Record<string, any>) =>
row?.diceRewardConfig?.tier ?? row?.reward_config_id ?? '-'

View File

@@ -1,10 +1,10 @@
<template>
<div class="art-full-height">
<!-- 搜索面板 -->
<!-- ???? -->
<TableSearch v-model="searchForm" @search="handleSearch" @reset="resetSearchParams" />
<ElCard class="art-table-card" shadow="never">
<!-- 表格头部 -->
<!-- ???? -->
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
<template #left>
<ElSpace wrap>
@@ -12,7 +12,7 @@
<template #icon>
<ArtSvgIcon icon="ri:add-fill" />
</template>
新增
??
</ElButton>
<ElButton
v-permission="'dice:player:index:destroy'"
@@ -23,13 +23,13 @@
<template #icon>
<ArtSvgIcon icon="ri:delete-bin-5-line" />
</template>
删除
??
</ElButton>
</ElSpace>
</template>
</ArtTableHeader>
<!-- 表格 -->
<!-- ?? -->
<ArtTable
ref="tableRef"
rowKey="id"
@@ -42,7 +42,7 @@
@pagination:size-change="handleSizeChange"
@pagination:current-change="handleCurrentChange"
>
<!-- 状态开关直接修改 -->
<!-- ????????? -->
<template #status="{ row }">
<ElSwitch
v-permission="'dice:player:index:update'"
@@ -51,7 +51,7 @@
@change="(v: string | number | boolean) => handleStatusChange(row, v ? 1 : 0)"
/>
</template>
<!-- 平台币tag 可点击打开钱包操作弹窗 -->
<!-- ????tag ??????????? -->
<template #coin="{ row }">
<ElTag
type="info"
@@ -62,7 +62,7 @@
{{ row.coin ?? 0 }}
</ElTag>
</template>
<!-- 操作列 -->
<!-- ??? -->
<template #operation="{ row }">
<div class="flex gap-2">
<SaButton
@@ -80,7 +80,7 @@
</ArtTable>
</ElCard>
<!-- 编辑弹窗 -->
<!-- ???? -->
<EditDialog
v-model="dialogVisible"
:dialog-type="dialogType"
@@ -88,7 +88,7 @@
@success="refreshData"
/>
<!-- 钱包操作弹窗加点/扣点 -->
<!-- ?????????/??? -->
<WalletOperateDialog
v-model="walletDialogVisible"
:player="walletOperatePlayer"
@@ -105,7 +105,7 @@
import EditDialog from './modules/edit-dialog.vue'
import WalletOperateDialog from './modules/WalletOperateDialog.vue'
// 搜索表单
// ????
const searchForm = ref({
username: undefined,
name: undefined,
@@ -115,23 +115,23 @@
lottery_config_id: undefined
})
// 搜索处理
// ????
const handleSearch = (params: Record<string, any>) => {
Object.assign(searchParams, params)
getData()
}
// 权重列带 % formatterColumnOption.formatter 仅接收 row
// ???? % ? formatter?ColumnOption.formatter ??? row?
const weightFormatter = (prop: string) => (row: any) => {
const cellValue = row[prop]
return cellValue != null && cellValue !== '' ? `${cellValue}%` : '-'
}
// 彩金池配置列:lottery_config_id 关联 DiceLotteryConfig,显示 name
// ???????lottery_config_id ?? DiceLotteryPoolConfig??? name
const lotteryConfigNameFormatter = (row: any) =>
row?.diceLotteryConfig?.name ?? (row?.lottery_config_id ? `#${row.lottery_config_id}` : '自定义')
row?.diceLotteryPoolConfig?.name ?? (row?.lottery_config_id ? `#${row.lottery_config_id}` : '???')
// 表格配置
// ????
const {
columns,
columnChecks,
@@ -150,73 +150,73 @@
apiFn: api.list,
columnsFactory: () => [
{ type: 'selection' },
{ prop: 'username', label: '用户名', align: 'center' },
{ prop: 'phone', label: '手机号', align: 'center' },
{ prop: 'name', label: '昵称', align: 'center' },
{ prop: 'username', label: '???', align: 'center' },
{ prop: 'phone', label: '???', align: 'center' },
{ prop: 'name', label: '??', align: 'center' },
{
prop: 'status',
label: '状态',
label: '??',
width: 88,
align: 'center',
useSlot: true
},
{
prop: 'coin',
label: '平台币',
label: '???',
width: 100,
align: 'center',
useSlot: true
},
{
prop: 'lottery_config_id',
label: '彩金池配置',
label: '?????',
width: 120,
align: 'center',
formatter: (row: any) => lotteryConfigNameFormatter(row)
},
{
prop: 't1_weight',
label: 'T1池权重',
label: 'T1???',
width: 80,
align: 'center',
formatter: weightFormatter('t1_weight')
},
{
prop: 't2_weight',
label: 'T2池权重',
label: 'T2???',
width: 100,
align: 'center',
formatter: weightFormatter('t2_weight')
},
{
prop: 't3_weight',
label: 'T3池权重',
label: 'T3???',
width: 100,
align: 'center',
formatter: weightFormatter('t3_weight')
},
{
prop: 't4_weight',
label: 'T4池权重',
label: 'T4???',
width: 100,
align: 'center',
formatter: weightFormatter('t4_weight')
},
{
prop: 't5_weight',
label: 'T5池权重',
label: 'T5???',
width: 100,
align: 'center',
formatter: weightFormatter('t5_weight')
},
{ prop: 'total_ticket_count', label: '总抽奖次数', align: 'center' },
{ prop: 'paid_ticket_count', label: '购买抽奖次数', align: 'center' },
{ prop: 'free_ticket_count', label: '赠送抽奖次数', align: 'center' },
{ prop: 'create_time', label: '创建时间', align: 'center' },
{ prop: 'update_time', label: '更新时间', align: 'center' },
{ prop: 'total_ticket_count', label: '?????', align: 'center' },
{ prop: 'paid_ticket_count', label: '??????', align: 'center' },
{ prop: 'free_ticket_count', label: '??????', align: 'center' },
{ prop: 'create_time', label: '????', align: 'center' },
{ prop: 'update_time', label: '????', align: 'center' },
{
prop: 'operation',
label: '操作',
label: '??',
width: 100,
align: 'center',
fixed: 'right',
@@ -226,7 +226,7 @@
}
})
// 状态开关切换(列表内直接修改)
// ???????????????
const handleStatusChange = async (row: Record<string, any>, status: number) => {
row._statusLoading = true
try {
@@ -239,7 +239,7 @@
}
}
// 编辑配置
// ????
const {
dialogType,
dialogVisible,
@@ -251,7 +251,7 @@
selectedRows
} = useSaiAdmin()
// 钱包操作弹窗(从平台币 tag 点击打开)
// ??????????? tag ?????
const walletDialogVisible = ref(false)
type WalletPlayer = { id: number; username?: string; coin?: number }
const walletOperatePlayer = ref<WalletPlayer | null>(null)

View File

@@ -170,7 +170,7 @@
<script setup lang="ts">
import api from '../../../api/player/index'
import lotteryConfigApi from '../../../api/lottery_config/index'
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'

View File

@@ -79,7 +79,7 @@
const isExpanded = ref<boolean>(false)
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
/** 从玩家控制器获取 DiceLotteryConfig id/name 列表,用于 lottery_config_id 筛选 */
/** 从玩家控制器获取 DiceLotteryPoolConfig id/name 列表,用于 lottery_config_id 筛选 */
onMounted(async () => {
try {
lotteryConfigOptions.value = await api.getLotteryConfigOptions()