1.新增默认彩金池配置
2.优化关联彩金池配置的名称显示 3.优化一键测试权重 4.优化底注配置
This commit is contained in:
@@ -12,6 +12,19 @@ export type LotteryPoolConfigOption = LotteryPoolOption & {
|
|||||||
t5_weight: number
|
t5_weight: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 规范化接口返回的彩金池配置(含权重) */
|
||||||
|
export function parseLotteryPoolConfigOption(raw: Record<string, unknown>): LotteryPoolConfigOption {
|
||||||
|
const base = normalizeLotteryPoolOption(raw)
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
t1_weight: Number(raw.t1_weight ?? 0),
|
||||||
|
t2_weight: Number(raw.t2_weight ?? 0),
|
||||||
|
t3_weight: Number(raw.t3_weight ?? 0),
|
||||||
|
t4_weight: Number(raw.t4_weight ?? 0),
|
||||||
|
t5_weight: Number(raw.t5_weight ?? 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 色子奖池配置 API 接口
|
* 色子奖池配置 API 接口
|
||||||
*/
|
*/
|
||||||
@@ -39,17 +52,7 @@ export default {
|
|||||||
})
|
})
|
||||||
const rows = Array.isArray(res) ? res : (Array.isArray((res as any)?.data) ? (res as any).data : [])
|
const rows = Array.isArray(res) ? res : (Array.isArray((res as any)?.data) ? (res as any).data : [])
|
||||||
if (!Array.isArray(rows)) return []
|
if (!Array.isArray(rows)) return []
|
||||||
return rows.map((r: Record<string, unknown>) => {
|
return rows.map((r: Record<string, unknown>) => parseLotteryPoolConfigOption(r))
|
||||||
const base = normalizeLotteryPoolOption(r)
|
|
||||||
return {
|
|
||||||
...base,
|
|
||||||
t1_weight: Number(r.t1_weight ?? 0),
|
|
||||||
t2_weight: Number(r.t2_weight ?? 0),
|
|
||||||
t3_weight: Number(r.t3_weight ?? 0),
|
|
||||||
t4_weight: Number(r.t4_weight ?? 0),
|
|
||||||
t5_weight: Number(r.t5_weight ?? 0)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import request from '@/utils/http'
|
import request from '@/utils/http'
|
||||||
import { normalizeLotteryPoolOption } from '@/views/plugin/dice/utils/lotteryPoolDisplay'
|
import { normalizeLotteryPoolOption, type LotteryPoolOption } from '@/views/plugin/dice/utils/lotteryPoolDisplay'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 大富翁-玩家 API接口
|
* 大富翁-玩家 API接口
|
||||||
@@ -87,7 +87,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 获取彩金池配置选项,供 lottery_config_id 下拉使用(含奖池名称 display_name)
|
* 获取彩金池配置选项,供 lottery_config_id 下拉使用(含奖池名称 display_name)
|
||||||
*/
|
*/
|
||||||
async getLotteryConfigOptions(params?: Record<string, unknown>) {
|
async getLotteryConfigOptions(params?: Record<string, unknown>): Promise<LotteryPoolOption[]> {
|
||||||
const res = await request.get<any>({
|
const res = await request.get<any>({
|
||||||
url: '/core/dice/player/DicePlayer/getLotteryConfigOptions',
|
url: '/core/dice/player/DicePlayer/getLotteryConfigOptions',
|
||||||
params
|
params
|
||||||
|
|||||||
@@ -183,9 +183,16 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '../../../api/player/index'
|
import api from '../../../api/player/index'
|
||||||
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
|
import lotteryConfigApi, {
|
||||||
|
parseLotteryPoolConfigOption,
|
||||||
|
type LotteryPoolConfigOption
|
||||||
|
} from '../../../api/lottery_pool_config/index'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { lotteryPoolDisplayLabel, lotteryPoolOptionLabel } from '@/views/plugin/dice/utils/lotteryPoolDisplay'
|
import {
|
||||||
|
lotteryPoolDisplayLabel,
|
||||||
|
lotteryPoolOptionLabel,
|
||||||
|
type LotteryPoolOption
|
||||||
|
} from '@/views/plugin/dice/utils/lotteryPoolDisplay'
|
||||||
import { getChannelDeptRequestParams, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
import { getChannelDeptRequestParams, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||||
import { isSuperAdminUser } from '@/utils/channelLayout'
|
import { isSuperAdminUser } from '@/utils/channelLayout'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
@@ -273,7 +280,7 @@
|
|||||||
const formData = reactive({ ...initialFormData })
|
const formData = reactive({ ...initialFormData })
|
||||||
|
|
||||||
/** 彩金池配置下拉选项(DiceLotteryConfig id、name) */
|
/** 彩金池配置下拉选项(DiceLotteryConfig id、name) */
|
||||||
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
|
const lotteryConfigOptions = ref<LotteryPoolOption[]>([])
|
||||||
/** 彩金池选项加载中 */
|
/** 彩金池选项加载中 */
|
||||||
const lotteryConfigLoading = ref(false)
|
const lotteryConfigLoading = ref(false)
|
||||||
/** 后台管理员下拉选项(SystemUser) */
|
/** 后台管理员下拉选项(SystemUser) */
|
||||||
@@ -299,7 +306,21 @@
|
|||||||
/** 管理员选项加载中 */
|
/** 管理员选项加载中 */
|
||||||
const systemUserOptionsLoading = ref(false)
|
const systemUserOptionsLoading = ref(false)
|
||||||
/** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */
|
/** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */
|
||||||
const currentLotteryConfig = ref<Record<string, any> | null>(null)
|
const currentLotteryConfig = ref<LotteryPoolConfigOption | null>(null)
|
||||||
|
|
||||||
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||||
|
return value !== null && typeof value === 'object'
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractReadPayload(res: unknown): Record<string, unknown> | null {
|
||||||
|
if (!isRecord(res)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (isRecord(res.data)) {
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
function lotteryConfigTypeText(name: unknown): string {
|
function lotteryConfigTypeText(name: unknown): string {
|
||||||
const n = String(name ?? '')
|
const n = String(name ?? '')
|
||||||
@@ -324,8 +345,9 @@
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const res = await lotteryConfigApi.read(id)
|
const res = await lotteryConfigApi.read(id)
|
||||||
const row = (res as any)?.data ?? (res as any)
|
const payload = extractReadPayload(res)
|
||||||
if (row && typeof row === 'object') {
|
if (payload) {
|
||||||
|
const row = parseLotteryPoolConfigOption(payload)
|
||||||
currentLotteryConfig.value = row
|
currentLotteryConfig.value = row
|
||||||
WEIGHT_FIELDS.forEach((key) => {
|
WEIGHT_FIELDS.forEach((key) => {
|
||||||
;(formData as any)[key] = Number(row[key] ?? 0)
|
;(formData as any)[key] = Number(row[key] ?? 0)
|
||||||
@@ -353,8 +375,9 @@
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const res = await lotteryConfigApi.read(lotteryConfigId)
|
const res = await lotteryConfigApi.read(lotteryConfigId)
|
||||||
const row = (res as any)?.data ?? (res as any)
|
const payload = extractReadPayload(res)
|
||||||
if (row && typeof row === 'object') {
|
if (payload) {
|
||||||
|
const row = parseLotteryPoolConfigOption(payload)
|
||||||
WEIGHT_FIELDS.forEach((key) => {
|
WEIGHT_FIELDS.forEach((key) => {
|
||||||
;(formData as any)[key] = Number(row[key] ?? 0)
|
;(formData as any)[key] = Number(row[key] ?? 0)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '../../../api/player/index'
|
import api from '../../../api/player/index'
|
||||||
import { lotteryPoolOptionLabel } from '@/views/plugin/dice/utils/lotteryPoolDisplay'
|
import { lotteryPoolOptionLabel, type LotteryPoolOption } from '@/views/plugin/dice/utils/lotteryPoolDisplay'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
modelValue: Record<string, any>
|
modelValue: Record<string, any>
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
const emit = defineEmits<Emits>()
|
const emit = defineEmits<Emits>()
|
||||||
const isExpanded = ref<boolean>(false)
|
const isExpanded = ref<boolean>(false)
|
||||||
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
|
const lotteryConfigOptions = ref<LotteryPoolOption[]>([])
|
||||||
|
|
||||||
/** 从玩家控制器获取 DiceLotteryPoolConfig id/name 列表,用于 lottery_config_id 筛选 */
|
/** 从玩家控制器获取 DiceLotteryPoolConfig id/name 列表,用于 lottery_config_id 筛选 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|||||||
@@ -226,7 +226,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '../../../api/reward/index'
|
import api from '../../../api/reward/index'
|
||||||
import anteConfigApi from '../../../api/ante_config/index'
|
import anteConfigApi from '../../../api/ante_config/index'
|
||||||
import lotteryPoolApi from '../../../api/lottery_pool_config/index'
|
import lotteryPoolApi, { type LotteryPoolConfigOption } from '../../../api/lottery_pool_config/index'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import {
|
import {
|
||||||
@@ -272,18 +272,7 @@
|
|||||||
kill_mode_enabled: false,
|
kill_mode_enabled: false,
|
||||||
test_safety_line: 0
|
test_safety_line: 0
|
||||||
})
|
})
|
||||||
type LotteryPoolOption = {
|
const lotteryOptions = ref<LotteryPoolConfigOption[]>([])
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
remark?: string
|
|
||||||
display_name?: string
|
|
||||||
t1_weight?: number
|
|
||||||
t2_weight?: number
|
|
||||||
t3_weight?: number
|
|
||||||
t4_weight?: number
|
|
||||||
t5_weight?: number
|
|
||||||
}
|
|
||||||
const lotteryOptions = ref<LotteryPoolOption[]>([])
|
|
||||||
const selectedPaidPool = computed(() =>
|
const selectedPaidPool = computed(() =>
|
||||||
lotteryOptions.value.find((r) => r.id === form.paid_lottery_config_id) ?? null
|
lotteryOptions.value.find((r) => r.id === form.paid_lottery_config_id) ?? null
|
||||||
)
|
)
|
||||||
@@ -355,9 +344,9 @@
|
|||||||
return label ? `${label} (×${item.mult})` : `×${item.mult}`
|
return label ? `${label} (×${item.mult})` : `×${item.mult}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function poolTierWeightsText(pool: LotteryPoolOption): string {
|
function poolTierWeightsText(pool: LotteryPoolConfigOption): string {
|
||||||
const parts = tierKeys.map((t) => {
|
const parts = tierKeys.map((t) => {
|
||||||
const key = `${t.toLowerCase()}_weight` as keyof LotteryPoolOption
|
const key = `${t.toLowerCase()}_weight` as keyof LotteryPoolConfigOption
|
||||||
const v = pool[key]
|
const v = pool[key]
|
||||||
return `${t} ${v ?? 0}%`
|
return `${t} ${v ?? 0}%`
|
||||||
})
|
})
|
||||||
@@ -407,31 +396,9 @@
|
|||||||
async function loadLotteryOptions() {
|
async function loadLotteryOptions() {
|
||||||
try {
|
try {
|
||||||
const list = await lotteryPoolApi.getOptions(resolveDeptParams())
|
const list = await lotteryPoolApi.getOptions(resolveDeptParams())
|
||||||
lotteryOptions.value = list.map(
|
lotteryOptions.value = list
|
||||||
(r: {
|
const playerDefault = list.find((r) => r.name === 'playerDefault')
|
||||||
id: number
|
const normal = list.find((r) => r.name === 'default')
|
||||||
name: string
|
|
||||||
remark?: string
|
|
||||||
display_name?: string
|
|
||||||
t1_weight?: number
|
|
||||||
t2_weight?: number
|
|
||||||
t3_weight?: number
|
|
||||||
t4_weight?: number
|
|
||||||
t5_weight?: number
|
|
||||||
}) => ({
|
|
||||||
id: r.id,
|
|
||||||
name: r.name,
|
|
||||||
remark: r.remark,
|
|
||||||
display_name: r.display_name,
|
|
||||||
t1_weight: r.t1_weight,
|
|
||||||
t2_weight: r.t2_weight,
|
|
||||||
t3_weight: r.t3_weight,
|
|
||||||
t4_weight: r.t4_weight,
|
|
||||||
t5_weight: r.t5_weight
|
|
||||||
})
|
|
||||||
)
|
|
||||||
const playerDefault = list.find((r: { name?: string }) => r.name === 'playerDefault')
|
|
||||||
const normal = list.find((r: { name?: string }) => r.name === 'default')
|
|
||||||
if (playerDefault) {
|
if (playerDefault) {
|
||||||
form.paid_lottery_config_id = playerDefault.id
|
form.paid_lottery_config_id = playerDefault.id
|
||||||
} else if (normal) {
|
} else if (normal) {
|
||||||
|
|||||||
@@ -298,7 +298,7 @@
|
|||||||
return t('page.detail.killModeOff')
|
return t('page.detail.killModeOff')
|
||||||
}
|
}
|
||||||
const line = record.test_safety_line
|
const line = record.test_safety_line
|
||||||
if (line === null || line === undefined || line === '') {
|
if (line === null || line === undefined) {
|
||||||
return t('page.detail.dash')
|
return t('page.detail.dash')
|
||||||
}
|
}
|
||||||
return String(line)
|
return String(line)
|
||||||
@@ -307,7 +307,7 @@
|
|||||||
function formatAnteDetail(record: RecordRow | null): string {
|
function formatAnteDetail(record: RecordRow | null): string {
|
||||||
if (!record) return t('page.detail.dash')
|
if (!record) return t('page.detail.dash')
|
||||||
const ante = record.ante
|
const ante = record.ante
|
||||||
if (ante === null || ante === undefined || ante === '') {
|
if (ante === null || ante === undefined) {
|
||||||
return t('page.detail.dash')
|
return t('page.detail.dash')
|
||||||
}
|
}
|
||||||
const snap = record.tier_weights_snapshot
|
const snap = record.tier_weights_snapshot
|
||||||
|
|||||||
Reference in New Issue
Block a user