1.优化开奖逻辑

2.优化后台开奖派彩
3.优化接口规范
This commit is contained in:
2026-04-17 13:56:13 +08:00
parent 3cf386756b
commit bf3d50a309
50 changed files with 1036 additions and 770 deletions

View File

@@ -1,6 +1,13 @@
export default {
GroupName: 'Group Name',
'Group name': 'Group Name',
channel_id: 'Channel',
channel_name: 'Channel name',
channel_admin: 'Channel admin',
channel_auto_bind: 'Will bind to the current account channel automatically',
channel_inherit_hint:
'Sub groups do not pick a channel separately: saving uses the parent group channel; changing parent syncs automatically.',
system_group_no_channel: 'System (no channel)',
commission_rate: 'Commission rate (%)',
commission_rate_desc_title: 'Group commission notes',
commission_rate_desc_1: 'The total group commission rate under the same parent cannot exceed 100%.',

View File

@@ -58,6 +58,7 @@ export default {
admingroup__name: 'name',
admin_id: 'admin_id',
admin_tree_tip: 'Admins are grouped by channel. Pick a leaf under a channel name. One channel maps to one admin.',
admin_select_tip: 'Only administrators within your data permission scope are listed; search by username.',
manual_settle: 'Manual settle',
manual_settle_confirm: 'Confirm trigger manual settlement for this channel?',
manual_settle_settlement_no: 'Settlement No.',
@@ -70,8 +71,8 @@ export default {
manual_settle_calc_base: 'Settlement base',
manual_settle_commission_amount: 'Commission amount',
manual_settle_remark: 'Remark',
admin_id_placeholder: 'Select a channel admin account',
admin__username: 'username',
admin_id_placeholder: 'Select an admin (within your permission scope)',
admin__username: 'Person in charge',
create_time: 'create_time',
update_time: 'update_time',
'quick Search Fields': 'id,code,name',

View File

@@ -1,28 +0,0 @@
export default {
'quick Search Fields': 'Period No. / ID',
id: 'ID',
period_no: 'Period No.',
period_start_at: 'Start time',
status: 'Status',
'status 0': 'Betting open',
'status 1': 'Closed',
'status 2': 'Settling',
'status 3': 'Paying',
'status 4': 'Ended',
'status 5': 'Void',
draw_mode: 'Draw mode',
'draw_mode 0': 'Auto AI',
'draw_mode 1': 'Manual preset',
preset_number: 'Preset number',
result_number: 'Result number',
void_reason: 'Void reason',
create_time: 'Created',
update_time: 'Updated',
section_auto: 'Auto draw & new period',
auto_create_label: 'Allow auto-create next period',
auto_create_tip: 'When enabled, a background ticker inserts a new period if none is in progress',
manual_create_label: 'Allow manual create next period',
manual_create_tip: 'When enabled, the button below can create the next period',
btn_create_next: 'Create next period (manual)',
saving: 'Saving…',
}

View File

@@ -15,6 +15,8 @@ export default {
'draw_mode 1': 'Manual preset',
preset_number: 'Preset number',
result_number: 'Result number',
platform_profit_amount: 'Round P/L (platform)',
winner_user_count: 'Winners',
void_reason: 'Void reason',
create_time: 'Created',
update_time: 'Updated',

View File

@@ -1,6 +1,12 @@
export default {
GroupName: '组名',
'Group name': '组别名称',
channel_id: '所属渠道',
channel_name: '渠道名称',
channel_admin: '渠道管理员',
channel_auto_bind: '将自动绑定为当前账号所属渠道',
channel_inherit_hint: '子级不单独选渠道:保存时将使用上级分组对应渠道,变更上级时会自动同步。',
system_group_no_channel: '系统级(未绑定渠道)',
commission_rate: '分红比例(%)',
commission_rate_desc_title: '角色组分红说明',
commission_rate_desc_1: '同一父级下角色组分红比例总和不能超过100%。',

View File

@@ -58,6 +58,7 @@ export default {
admingroup__name: '组名',
admin_id: '管理员',
admin_tree_tip: '按渠道分组展示可关联的管理员账号,请在「渠道名称」下选择具体管理员(叶子节点)。渠道负责人仅对应一名管理员。',
admin_select_tip: '仅列出当前账号数据权限范围内的管理员,支持搜索用户名。',
manual_settle: '手动结算',
manual_settle_confirm: '确认触发当前渠道手动结算?',
manual_settle_settlement_no: '结算单号',
@@ -70,8 +71,8 @@ export default {
manual_settle_calc_base: '结算基数',
manual_settle_commission_amount: '佣金金额',
manual_settle_remark: '备注',
admin_id_placeholder: '请选择渠道下的管理员账号',
admin__username: '用户名',
admin_id_placeholder: '请选择管理员(仅当前权限范围内)',
admin__username: '负责人',
create_time: '创建时间',
update_time: '修改时间',
'quick Search Fields': 'ID、渠道标识、渠道名',

View File

@@ -1,28 +0,0 @@
export default {
'quick Search Fields': '期号/ID',
id: 'ID',
period_no: '期号',
period_start_at: '开始时间',
status: '状态',
'status 0': '下注开放',
'status 1': '已封盘',
'status 2': '算票中',
'status 3': '派彩中',
'status 4': '已结束',
'status 5': '已作废',
draw_mode: '开奖方式',
'draw_mode 0': '自动AI',
'draw_mode 1': '手动预设',
preset_number: '预设号码',
result_number: '开奖号码',
void_reason: '作废原因',
create_time: '创建时间',
update_time: '更新时间',
section_auto: '自动开奖与新建期',
auto_create_label: '允许自动创建下一期',
auto_create_tip: '开启后由后台定时任务在无进行中期号时自动插入新期',
manual_create_label: '允许手动创建下一期',
manual_create_tip: '开启后可在本页使用「手动创建下一期」按钮',
btn_create_next: '手动创建下一期',
saving: '保存中…',
}

View File

@@ -15,6 +15,8 @@ export default {
'draw_mode 1': '手动预设',
preset_number: '预设号码',
result_number: '开奖号码',
platform_profit_amount: '对局盈亏(平台)',
winner_user_count: '中奖人数',
void_reason: '作废原因',
create_time: '创建时间',
update_time: '更新时间',

View File

@@ -2,7 +2,7 @@ export default {
id: 'ID',
username: '用户名',
password: '密码',
uuid: '用户唯一标识',
uuid: 'uuid',
phone: '手机号',
email: '邮箱',
email_placeholder: '可选,与手机号二选一注册时填写',

View File

@@ -1,14 +1,14 @@
export default {
export default {
id: 'ID',
username: '用户名',
password: '密码',
uuid: '用户唯一标识',
uuid: 'uuid',
phone: '手机号',
email: '邮箱',
email_placeholder: '可选,与手机号二选一注册时填写',
head_image: '头像',
remark: '备注',
coin: '游戏币余额',
coin: '余额',
coin_placeholder: 'decimal(18,4),禁止业务用浮点存库',
total_deposit_coin: '累计充值(币)',
total_valid_bet_coin: '累计有效投注(币)',

View File

@@ -89,10 +89,16 @@ const baTable = new baTableClass(
label: t('State'),
prop: 'status',
align: 'center',
render: 'tag',
effect: 'dark',
custom: { disable: 'danger', enable: 'success' },
operator: 'eq',
sortable: false,
render: 'switch',
replaceValue: { disable: t('Disable'), enable: t('Enable') },
customRenderAttr: {
switch: () => ({
activeValue: 'enable',
inactiveValue: 'disable',
}),
},
},
{
label: t('Operate'),

View File

@@ -51,7 +51,7 @@ const baTable: baTableClass = new baTableClass(
new baTableApi('/admin/auth.Group/'),
{
expandAll: true,
dblClickNotEditColumn: [undefined],
dblClickNotEditColumn: [undefined, 'status'],
column: [
{ type: 'selection', align: 'center' },
{
@@ -60,15 +60,21 @@ const baTable: baTableClass = new baTableClass(
align: 'left',
minWidth: '180',
},
{
label: t('auth.group.channel_name'),
prop: 'channel_name',
align: 'center',
minWidth: '140',
},
{ label: t('auth.group.commission_rate'), prop: 'commission_rate', align: 'center', formatter: formatRatePercent },
{ label: t('auth.group.jurisdiction'), prop: 'rules', align: 'center' },
{
label: t('State'),
prop: 'status',
align: 'center',
render: 'tag',
effect: 'dark',
custom: { 0: 'danger', 1: 'success' },
operator: 'eq',
sortable: false,
render: 'switch',
replaceValue: { 0: t('Disable'), 1: t('Enable') },
},
{ label: t('Update time'), prop: 'update_time', align: 'center', width: '160', render: 'datetime' },
@@ -86,6 +92,7 @@ const baTable: baTableClass = new baTableClass(
{
defaultItems: {
status: 1,
channel_id: null,
},
}
)
@@ -94,9 +101,18 @@ const baTable: baTableClass = new baTableClass(
baTable.before.onSubmit = ({ formEl, operate, items }) => {
let submitCallback = () => {
baTable.form.submitLoading = true
const postItems: anyObj = { ...items }
const pid = Number(postItems.pid ?? 0)
if (pid !== 0) {
delete postItems.channel_id
delete postItems.channel_name
delete postItems.channel_admin_username
} else if (!adminInfo.super) {
delete postItems.channel_id
}
baTable.api
.postData(operate, {
...items,
...postItems,
rules: formRef.value?.getCheckeds(),
})
.then((res) => {
@@ -153,6 +169,10 @@ baTable.after.toggleForm = ({ operate }) => {
// 编辑请求完成后钩子
baTable.after.getEditData = () => {
const pid = Number(baTable.form.items?.pid ?? 0)
if (pid !== 0 && baTable.form.items) {
delete baTable.form.items.channel_id
}
menuRuleTreeUpdate()
}

View File

@@ -41,6 +41,42 @@
valueOnClear: 0,
}"
/>
<p
v-if="!isRootGroup"
class="group-channel-inherit-hint"
:style="{ paddingLeft: (baTable.form.labelWidth ?? 120) + 'px' }"
>
{{ t('auth.group.channel_inherit_hint') }}
</p>
<!-- 顶级+超管可选渠道展示只读渠道名称channel_id 仅由表单传给后端 -->
<FormItem
v-if="isRootGroup && adminInfo.super"
:label="t('auth.group.channel_id')"
v-model="baTable.form.items!.channel_id"
type="remoteSelect"
prop="channel_id"
:input-attr="{
pk: 'id',
field: 'name',
remoteUrl: '/admin/channel/index',
placeholder: t('Click select'),
emptyValues: ['', null, undefined, 0],
valueOnClear: null,
}"
/>
<template v-if="isRootGroup && adminInfo.super && channelPreviewName">
<el-form-item :label="t('auth.group.channel_name')">
<el-input :model-value="channelPreviewName" readonly />
</el-form-item>
</template>
<!-- 子级只读展示上级对应渠道名称不提交 channel_id由后端按父级写入 -->
<template v-if="!isRootGroup && channelPreviewName">
<el-form-item :label="t('auth.group.channel_name')">
<el-input :model-value="channelPreviewName" readonly />
</el-form-item>
</template>
<el-form-item prop="name" :label="t('auth.group.Group name')">
<el-input
@@ -103,7 +139,7 @@
</template>
<script setup lang="ts">
import { reactive, inject, useTemplateRef } from 'vue'
import { reactive, inject, useTemplateRef, computed, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import type baTableClass from '/@/utils/baTable'
import FormItem from '/@/components/formItem/index.vue'
@@ -112,6 +148,7 @@ import { buildValidatorData } from '/@/utils/validate'
import type Node from 'element-plus/es/components/tree/src/model/node'
import { useConfig } from '/@/stores/config'
import { useAdminInfo } from '/@/stores/adminInfo'
import createAxios from '/@/utils/axios'
const config = useConfig()
const adminInfo = useAdminInfo()
@@ -120,10 +157,100 @@ const treeRef = useTemplateRef('treeRef')
const baTable = inject('baTable') as baTableClass
const { t } = useI18n()
const isRootGroup = computed(() => {
const p = baTable.form.items?.pid
if (p === undefined || p === null || p === '') {
return true
}
return Number(p) === 0
})
const strFromRow = (key: string): string => {
const row = baTable.form.items
if (!row) return ''
const v = row[key]
return typeof v === 'string' ? v : ''
}
const channelPreviewName = computed(() => strFromRow('channel_name'))
const shouldDisableCommissionRate = () => {
return false
}
/**
* 子角色组选择上级分组后只拉取展示用渠道名channel_id 由后端按父级保存,不在此写入提交字段。
*/
watch(
() => baTable.form.items?.pid,
async (pid, oldPid) => {
const items = baTable.form.items
if (!items || !baTable.form.operate || !['Add', 'Edit'].includes(baTable.form.operate)) {
return
}
const pidNum = Number(pid ?? 0)
const oldNum = oldPid === undefined || oldPid === null || oldPid === '' ? null : Number(oldPid)
if (pidNum === 0) {
if (adminInfo.super && oldNum !== null && oldNum !== 0) {
items.channel_id = null
items['channel_name'] = ''
}
return
}
delete items.channel_id
try {
const res = await createAxios(
{
url: '/admin/auth.Group/edit',
method: 'get',
params: { id: pidNum },
},
{ showErrorMessage: false, showCodeMessage: false }
)
const row = res.data.row
if (row) {
items['channel_name'] = typeof row.channel_name === 'string' ? row.channel_name : ''
}
} catch {
items['channel_name'] = ''
}
}
)
/** 顶级+超管:所选渠道变更时刷新只读渠道名 */
watch(
() => baTable.form.items?.channel_id,
async (cid) => {
const items = baTable.form.items
if (!items || !baTable.form.operate || !['Add', 'Edit'].includes(baTable.form.operate)) {
return
}
if (!isRootGroup.value || !adminInfo.super) {
return
}
if (cid === null || cid === undefined || cid === '') {
items['channel_name'] = ''
return
}
try {
const res = await createAxios(
{
url: '/admin/auth.Group/channelBindPreview',
method: 'get',
params: { channel_id: cid },
},
{ showErrorMessage: false, showCodeMessage: false }
)
items['channel_name'] = typeof res.data.channel_name === 'string' ? res.data.channel_name : ''
} catch {
items['channel_name'] = ''
}
}
)
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
name: [buildValidatorData({ name: 'required', title: t('auth.group.Group name') })],
commission_rate: [
@@ -194,6 +321,14 @@ defineExpose({
</script>
<style scoped lang="scss">
.group-channel-inherit-hint {
margin: -6px 0 14px;
font-size: 12px;
line-height: 1.5;
color: var(--el-text-color-secondary);
box-sizing: border-box;
}
.commission-rate-alert {
margin-bottom: 12px;
}

View File

@@ -394,26 +394,6 @@ const baTable = new baTableClass(
render: 'switch',
replaceValue: { '0': t('channel.status 0'), '1': t('channel.status 1') },
},
{
label: t('channel.admingroup__name'),
prop: 'adminGroup.name',
align: 'center',
minWidth: 110,
operatorPlaceholder: t('Fuzzy query'),
render: 'tags',
operator: 'LIKE',
comSearchRender: 'string',
},
{
label: t('channel.admin__username'),
prop: 'admin.username',
align: 'center',
minWidth: 90,
operatorPlaceholder: t('Fuzzy query'),
render: 'tags',
operator: 'LIKE',
comSearchRender: 'string',
},
{
label: t('channel.create_time'),
prop: 'create_time',

View File

@@ -172,21 +172,6 @@
@keyup.ctrl.enter="baTable.onSubmit(formRef)"
:placeholder="t('Please input field', { field: t('channel.remark') })"
/>
<el-alert type="info" :closable="false" show-icon class="channel-admin-tree-tip">
{{ t('channel.admin_tree_tip') }}
</el-alert>
<el-form-item :label="t('channel.admin_id')" prop="admin_id">
<el-tree-select
v-model="baTable.form.items!.admin_id"
class="w100"
clearable
filterable
:data="channelAdminTree"
:props="channelAdminTreeProps"
:render-after-expand="false"
:placeholder="t('channel.admin_id_placeholder')"
/>
</el-form-item>
</el-form>
</div>
</el-scrollbar>
@@ -209,7 +194,6 @@ import { useI18n } from 'vue-i18n'
import FormItem from '/@/components/formItem/index.vue'
import { useConfig } from '/@/stores/config'
import type baTableClass from '/@/utils/baTable'
import createAxios from '/@/utils/axios'
import { buildValidatorData } from '/@/utils/validate'
const config = useConfig()
@@ -218,23 +202,6 @@ const baTable = inject('baTable') as baTableClass
const { t } = useI18n()
type ChannelAdminTreeNode = {
value: string
label: string
disabled?: boolean
children?: ChannelAdminTreeNode[]
channel_id?: number
is_leaf?: boolean
}
const channelAdminTree = ref<ChannelAdminTreeNode[]>([])
const channelAdminTreeProps = {
value: 'value',
label: 'label',
children: 'children',
disabled: 'disabled',
}
type LadderRuleRow = { minLoss: number; shareRate: number }
const ladderRuleList = ref<LadderRuleRow[]>([])
@@ -317,14 +284,6 @@ const onSettlePlanChange = () => {
})
}
const loadChannelAdminTree = async () => {
const res = await createAxios({
url: '/admin/channel/adminTree',
method: 'get',
})
channelAdminTree.value = (res.data?.list ?? []) as ChannelAdminTreeNode[]
}
const currentAgentMode = computed(() => baTable.form.items?.agent_mode ?? 'turnover')
const currentAgentModeDescList = computed(() => {
if (currentAgentMode.value === 'turnover') {
@@ -390,19 +349,9 @@ const removeLadderRule = (idx: number) => {
}
onMounted(() => {
loadChannelAdminTree()
syncSettlePlanFromItems()
})
watch(
() => baTable.form.operate,
(op) => {
if (op === 'Add' || op === 'Edit') {
loadChannelAdminTree()
}
}
)
watch(
() => [baTable.form.operate, baTable.form.items?.id] as const,
() => {
@@ -410,9 +359,6 @@ watch(
if (!items || baTable.form.operate !== 'Edit') {
return
}
if (items.admin_id !== undefined && items.admin_id !== null && items.admin_id !== '') {
items.admin_id = String(items.admin_id) as any
}
items.affiliate_ladder_rules = normalizeLadderRulesToText(items.affiliate_ladder_rules) as any
syncSettlePlanFromItems()
syncLadderRuleRowsFromItems()
@@ -557,7 +503,6 @@ const rules: Partial<Record<string, FormItemRule[]>> = reactive({
settle_time: [buildValidatorData({ name: 'required', title: t('channel.settle_time') })],
affiliate_effective_start_at: [buildValidatorData({ name: 'required', title: t('channel.affiliate_effective_start_at') })],
carryover_balance: [buildValidatorData({ name: 'number', title: t('channel.carryover_balance') })],
admin_id: [buildValidatorData({ name: 'required', title: t('channel.admin_id') })],
})
</script>
@@ -571,8 +516,4 @@ const rules: Partial<Record<string, FormItemRule[]>> = reactive({
padding-left: 18px;
line-height: 1.6;
}
.channel-admin-tree-tip {
margin-bottom: 12px;
}
</style>

View File

@@ -11,7 +11,7 @@
<div>{{ t('game.live.countdown') }}: {{ countdownText }}</div>
</div>
<div class="header-actions">
<el-input-number v-model="manualNumber" :min="1" :max="36" :step="1" />
<el-input-number v-model="manualNumber" :min="1" :max="snapshot.draw_number_max ?? 36" :step="1" />
<el-button :loading="calcLoading" :disabled="!snapshot.can_calculate" @click="onCalculate">
{{ t('game.live.btn_calc') }}
</el-button>
@@ -70,6 +70,8 @@ interface Snapshot {
period_seconds?: number
bet_seconds?: number
pick_max_number_count?: number
/** 开奖号码池上限1draw_number_max与单注可选号码上限无关 */
draw_number_max?: number
remaining_seconds?: number
bet_remaining_seconds?: number
can_calculate?: boolean
@@ -87,7 +89,8 @@ const snapshot = reactive<Snapshot>({
ai_default_number: null,
period_seconds: 30,
bet_seconds: 20,
pick_max_number_count: 36,
pick_max_number_count: 10,
draw_number_max: 36,
remaining_seconds: 0,
bet_remaining_seconds: 0,
can_calculate: false,
@@ -121,12 +124,14 @@ async function loadSnapshot() {
snapshot.ai_default_number = res.data.ai_default_number
snapshot.period_seconds = res.data.period_seconds ?? 30
snapshot.bet_seconds = res.data.bet_seconds ?? 20
snapshot.pick_max_number_count = 36
snapshot.pick_max_number_count = res.data.pick_max_number_count ?? 10
snapshot.draw_number_max = res.data.draw_number_max ?? 36
snapshot.remaining_seconds = res.data.remaining_seconds ?? 0
snapshot.bet_remaining_seconds = res.data.bet_remaining_seconds ?? 0
snapshot.can_calculate = !!res.data.can_calculate
snapshot.can_draw = !!res.data.can_draw
if (manualNumber.value === null || manualNumber.value < 1 || manualNumber.value > 36) manualNumber.value = 1
const dmax = res.data.draw_number_max ?? 36
if (manualNumber.value === null || manualNumber.value < 1 || manualNumber.value > dmax) manualNumber.value = 1
}
} finally {
loading.value = false
@@ -169,7 +174,8 @@ async function initPush() {
snapshot.ai_default_number = payload.ai_default_number ?? null
snapshot.period_seconds = payload.period_seconds ?? 30
snapshot.bet_seconds = payload.bet_seconds ?? 20
snapshot.pick_max_number_count = 36
snapshot.pick_max_number_count = payload.pick_max_number_count ?? 10
snapshot.draw_number_max = payload.draw_number_max ?? 36
snapshot.remaining_seconds = payload.remaining_seconds ?? 0
snapshot.bet_remaining_seconds = payload.bet_remaining_seconds ?? 0
snapshot.can_calculate = !!payload.can_calculate

View File

@@ -1,303 +0,0 @@
<template>
<div class="default-main ba-table-box">
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
<el-card v-if="canSettings" class="period-settings-card" shadow="never">
<template #header>
<span>{{ t('game.period.section_auto') }}</span>
</template>
<div v-loading="settingsLoading" class="period-settings-body">
<div class="period-setting-row">
<span class="period-setting-label">{{ t('game.period.auto_create_label') }}</span>
<el-switch v-model="autoCreate" :disabled="settingsSaving" @change="onSwitchChange" />
<span class="period-setting-tip">{{ t('game.period.auto_create_tip') }}</span>
</div>
<div class="period-setting-row">
<span class="period-setting-label">{{ t('game.period.manual_create_label') }}</span>
<el-switch v-model="manualCreate" :disabled="settingsSaving" @change="onSwitchChange" />
<span class="period-setting-tip">{{ t('game.period.manual_create_tip') }}</span>
</div>
<div v-if="canManual" class="period-setting-actions">
<el-button type="primary" :loading="createLoading" @click="onCreateNextManual">
{{ t('game.period.btn_create_next') }}
</el-button>
</div>
</div>
</el-card>
<TableHeader
:buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.period.quick Search Fields') })"
></TableHeader>
<Table ref="tableRef"></Table>
<PopupForm />
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, provide, ref, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import PopupForm from './popupForm.vue'
import { baTableApi } from '/@/api/common'
import { defaultOptButtons } from '/@/components/table'
import TableHeader from '/@/components/table/header/index.vue'
import Table from '/@/components/table/index.vue'
import createAxios from '/@/utils/axios'
import baTableClass from '/@/utils/baTable'
import { auth } from '/@/utils/common'
defineOptions({
name: 'game/period',
})
const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete'])
const settingsLoading = ref(false)
const settingsSaving = ref(false)
const createLoading = ref(false)
const autoCreate = ref(false)
const manualCreate = ref(false)
/** 避免初次拉取开关值时触发保存 */
const settingsReady = ref(false)
const canSettings = computed(() => auth('periodSettings'))
const canManual = computed(() => auth('createNextManual'))
const baTable = new baTableClass(
new baTableApi('/admin/game.Period/'),
{
pk: 'id',
column: [
{ type: 'selection', align: 'center', operator: false },
{ label: t('game.period.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
{
label: t('game.period.period_no'),
prop: 'period_no',
align: 'center',
minWidth: 180,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
},
{
label: t('game.period.period_start_at'),
prop: 'period_start_at',
align: 'center',
width: 170,
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
{
label: t('game.period.status'),
prop: 'status',
align: 'center',
width: 110,
operator: 'eq',
render: 'tag',
effect: 'dark',
custom: {
'0': 'success',
'1': 'warning',
'2': 'info',
'3': 'primary',
'4': 'warning',
'5': 'danger',
},
replaceValue: {
'0': t('game.period.status 0'),
'1': t('game.period.status 1'),
'2': t('game.period.status 2'),
'3': t('game.period.status 3'),
'4': t('game.period.status 4'),
'5': t('game.period.status 5'),
},
},
{
label: t('game.period.draw_mode'),
prop: 'draw_mode',
align: 'center',
width: 110,
operator: 'eq',
render: 'tag',
custom: {
'0': 'info',
'1': 'warning',
},
replaceValue: {
'0': t('game.period.draw_mode 0'),
'1': t('game.period.draw_mode 1'),
},
},
{
label: t('game.period.preset_number'),
prop: 'preset_number',
align: 'center',
width: 100,
operator: 'RANGE',
},
{
label: t('game.period.result_number'),
prop: 'result_number',
align: 'center',
width: 100,
operator: 'RANGE',
},
{
label: t('game.period.void_reason'),
prop: 'void_reason',
align: 'center',
minWidth: 140,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
showOverflowTooltip: true,
},
{
label: t('game.period.create_time'),
prop: 'create_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 170,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
{
label: t('game.period.update_time'),
prop: 'update_time',
align: 'center',
render: 'datetime',
operator: 'RANGE',
comSearchRender: 'datetime',
sortable: 'custom',
width: 170,
timeFormat: 'yyyy-mm-dd hh:MM:ss',
},
{ label: t('Operate'), align: 'center', width: 100, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
],
dblClickNotEditColumn: [undefined],
},
{
defaultItems: {
status: 0,
draw_mode: 0,
void_reason: '',
},
}
)
provide('baTable', baTable)
async function loadPeriodSettings() {
if (!canSettings.value) {
return
}
settingsLoading.value = true
try {
const res = await createAxios({
url: '/admin/game.Period/periodSettings',
method: 'get',
showCodeMessage: false,
})
if (res.code === 1 && res.data) {
autoCreate.value = res.data.period_auto_create_enabled === 1
manualCreate.value = res.data.period_manual_create_enabled === 1
settingsReady.value = true
}
} catch {
// 无权限或接口异常时不打断列表
} finally {
settingsLoading.value = false
}
}
async function onSaveSettings() {
if (!canSettings.value) {
return
}
settingsSaving.value = true
try {
await createAxios({
url: '/admin/game.Period/periodSettings',
method: 'post',
data: {
period_auto_create_enabled: autoCreate.value ? 1 : 0,
period_manual_create_enabled: manualCreate.value ? 1 : 0,
},
showSuccessMessage: true,
})
} finally {
settingsSaving.value = false
}
}
function onSwitchChange() {
if (!settingsReady.value) {
return
}
void onSaveSettings()
}
async function onCreateNextManual() {
if (!canManual.value) {
return
}
createLoading.value = true
try {
await createAxios({
url: '/admin/game.Period/createNextManual',
method: 'post',
showSuccessMessage: true,
})
await baTable.getData()
} finally {
createLoading.value = false
}
}
onMounted(() => {
baTable.table.ref = tableRef.value
baTable.mount()
void loadPeriodSettings()
baTable.getData()?.then(() => {
baTable.initSort()
baTable.dragSort()
})
})
</script>
<style scoped lang="scss">
.period-settings-card {
margin-bottom: 12px;
}
.period-settings-body {
display: flex;
flex-direction: column;
gap: 12px;
}
.period-setting-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
}
.period-setting-label {
min-width: 160px;
font-weight: 500;
}
.period-setting-tip {
color: var(--el-text-color-secondary);
font-size: 13px;
flex: 1;
min-width: 200px;
}
.period-setting-actions {
margin-top: 4px;
}
</style>

View File

@@ -1,131 +0,0 @@
<template>
<el-dialog
class="ba-operate-dialog"
:close-on-click-modal="false"
:model-value="['Add', 'Edit'].includes(baTable.form.operate!)"
@close="baTable.toggleForm"
>
<template #header>
<div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">
{{ baTable.form.operate ? t(baTable.form.operate) : '' }}
</div>
</template>
<el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
<div
class="ba-operate-form"
:class="'ba-' + baTable.form.operate + '-form'"
:style="config.layout.shrink ? '' : 'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'"
>
<el-form
v-if="!baTable.form.loading"
ref="formRef"
@submit.prevent=""
@keyup.enter="baTable.onSubmit(formRef)"
:model="baTable.form.items"
:label-position="config.layout.shrink ? 'top' : 'right'"
:label-width="baTable.form.labelWidth + 'px'"
:rules="rules"
>
<FormItem
:label="t('game.period.period_no')"
type="string"
v-model="baTable.form.items!.period_no"
prop="period_no"
:placeholder="t('Please input field', { field: t('game.period.period_no') })"
/>
<FormItem
:label="t('game.period.period_start_at')"
type="datetime"
v-model="baTable.form.items!.period_start_at"
prop="period_start_at"
:placeholder="t('Please select field', { field: t('game.period.period_start_at') })"
/>
<FormItem
:label="t('game.period.status')"
type="radio"
v-model="baTable.form.items!.status"
prop="status"
:input-attr="{
content: {
'0': t('game.period.status 0'),
'1': t('game.period.status 1'),
'2': t('game.period.status 2'),
'3': t('game.period.status 3'),
'4': t('game.period.status 4'),
'5': t('game.period.status 5'),
},
}"
/>
<FormItem
:label="t('game.period.draw_mode')"
type="radio"
v-model="baTable.form.items!.draw_mode"
prop="draw_mode"
:input-attr="{
content: {
'0': t('game.period.draw_mode 0'),
'1': t('game.period.draw_mode 1'),
},
}"
/>
<FormItem
:label="t('game.period.preset_number')"
type="number"
v-model="baTable.form.items!.preset_number"
prop="preset_number"
:input-attr="{ step: 1, min: 1, max: 36 }"
/>
<FormItem
:label="t('game.period.result_number')"
type="number"
v-model="baTable.form.items!.result_number"
prop="result_number"
:input-attr="{ step: 1, min: 1, max: 36 }"
/>
<FormItem
:label="t('game.period.void_reason')"
type="textarea"
v-model="baTable.form.items!.void_reason"
prop="void_reason"
:input-attr="{ rows: 3 }"
/>
</el-form>
</div>
</el-scrollbar>
<template #footer>
<div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
<el-button @click="baTable.toggleForm()">{{ t('Cancel') }}</el-button>
<el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">
{{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }}
</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import type { FormItemRule } from 'element-plus'
import { inject, reactive, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import FormItem from '/@/components/formItem/index.vue'
import { useConfig } from '/@/stores/config'
import type baTableClass from '/@/utils/baTable'
const config = useConfig()
const formRef = useTemplateRef('formRef')
const baTable = inject('baTable') as baTableClass
const { t } = useI18n()
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
period_no: [buildRequired()],
})
function buildRequired(): FormItemRule {
return {
required: true,
message: t('Please input field', { field: t('game.period.period_no') }),
}
}
</script>
<style scoped lang="scss"></style>

View File

@@ -31,6 +31,13 @@ const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
const optButtons: OptButton[] = defaultOptButtons(['edit'])
const formatCoin = (_row: any, _column: any, cellValue: number | string | null | undefined) => {
if (cellValue === null || cellValue === undefined || cellValue === '') return '—'
const n = Number(cellValue)
if (Number.isNaN(n)) return '—'
return n.toFixed(4)
}
const baTable = new baTableClass(
new baTableApi('/admin/game.Record/'),
{
@@ -63,6 +70,23 @@ const baTable = new baTableClass(
},
{ label: t('game.record.preset_number'), prop: 'preset_number', align: 'center', width: 100, operator: 'RANGE' },
{ label: t('game.record.result_number'), prop: 'result_number', align: 'center', width: 100, operator: 'RANGE' },
{
label: t('game.record.platform_profit_amount'),
prop: 'platform_profit_amount',
align: 'center',
minWidth: 130,
operator: 'RANGE',
sortable: false,
formatter: formatCoin,
},
{
label: t('game.record.winner_user_count'),
prop: 'winner_user_count',
align: 'center',
width: 110,
operator: 'RANGE',
sortable: false,
},
{ label: t('game.record.void_reason'), prop: 'void_reason', align: 'center', minWidth: 140, operatorPlaceholder: t('Fuzzy query'), operator: 'LIKE', showOverflowTooltip: true },
{ label: t('game.record.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 170, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
{ label: t('game.record.update_time'), prop: 'update_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 170, timeFormat: 'yyyy-mm-dd hh:MM:ss' },

View File

@@ -26,6 +26,8 @@
/>
<FormItem :label="t('game.record.preset_number')" type="number" v-model="baTable.form.items!.preset_number" prop="preset_number" :input-attr="{ step: 1, min: 1, max: 36 }" />
<FormItem :label="t('game.record.result_number')" type="number" v-model="baTable.form.items!.result_number" prop="result_number" :input-attr="{ step: 1, min: 1, max: 36 }" />
<FormItem :label="t('game.record.platform_profit_amount')" type="string" v-model="baTable.form.items!.platform_profit_amount" prop="platform_profit_amount" />
<FormItem :label="t('game.record.winner_user_count')" type="number" v-model="baTable.form.items!.winner_user_count" prop="winner_user_count" :input-attr="{ step: 1, min: 0 }" />
<FormItem :label="t('game.record.void_reason')" type="textarea" v-model="baTable.form.items!.void_reason" prop="void_reason" :input-attr="{ rows: 3 }" />
</el-form>
</div>

View File

@@ -66,9 +66,8 @@ const baTable = new baTableClass(
align: 'center',
width: 100,
operator: 'eq',
render: 'tag',
effect: 'dark',
custom: { 0: 'info', 1: 'success' },
sortable: false,
render: 'switch',
replaceValue: {
'0': t('operation.operationNotice.status 0'),
'1': t('operation.operationNotice.status 1'),
@@ -109,6 +108,7 @@ const baTable = new baTableClass(
},
{ label: t('Operate'), align: 'center', minWidth: 80, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
],
dblClickNotEditColumn: [undefined, 'status'],
},
{
defaultItems: { status: 0, notice_type: 0 },

View File

@@ -58,23 +58,30 @@ const baTable = new baTableClass(
pk: 'id',
column: [
{ label: t('order.betOrder.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
{ label: t('order.betOrder.period_id'), prop: 'period_id', align: 'center', width: 100, operator: 'RANGE' },
{
label: t('order.betOrder.period_no'),
prop: 'period_no',
label: t('order.betOrder.period_id'),
prop: 'period_id',
align: 'center',
minWidth: 160,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
show: false,
width: 100,
operator: 'RANGE',
},
// {
// label: t('order.betOrder.period_no'),
// prop: 'period_no',
// align: 'center',
// minWidth: 160,
// operatorPlaceholder: t('Fuzzy query'),
// operator: 'LIKE',
// },
{
label: t('order.betOrder.gameRecord_period_no'),
prop: 'gameRecord.period_no',
align: 'center',
minWidth: 160,
minWidth: 200,
operatorPlaceholder: t('Fuzzy query'),
operator: 'LIKE',
render: 'tags',
render: 'tag',
},
{
label: t('order.betOrder.gameRecord_status'),

View File

@@ -75,9 +75,9 @@ const baTable = new baTableClass(
label: t('State'),
prop: 'status',
align: 'center',
render: 'tag',
effect: 'dark',
custom: { 0: 'danger', 1: 'success' },
operator: 'eq',
sortable: false,
render: 'switch',
replaceValue: { 0: t('Disable'), 1: t('security.dataRecycle.Deleting monitoring') },
},
{ label: t('Update time'), prop: 'update_time', align: 'center', render: 'datetime', sortable: 'custom', operator: 'RANGE', width: 160 },

View File

@@ -84,9 +84,9 @@ const baTable = new sensitiveDataClass(
label: t('State'),
prop: 'status',
align: 'center',
render: 'tag',
effect: 'dark',
custom: { 0: 'danger', 1: 'success' },
operator: 'eq',
sortable: false,
render: 'switch',
replaceValue: { 0: t('Disable'), 1: t('security.sensitiveData.Modifying monitoring') },
},
{ label: t('Update time'), prop: 'update_time', align: 'center', render: 'datetime', sortable: 'custom', operator: 'RANGE', width: 160 },
@@ -101,7 +101,7 @@ const baTable = new sensitiveDataClass(
fixed: 'right',
},
],
dblClickNotEditColumn: [undefined],
dblClickNotEditColumn: [undefined, 'status'],
},
{
defaultItems: {

View File

@@ -1,10 +1,10 @@
<template>
<template>
<div class="default-main ba-table-box">
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
<TableHeader
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('record.userWalletRecord.quick Search Fields') })"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('user.userWalletRecord.quick Search Fields') })"
></TableHeader>
<Table ref="tableRef"></Table>
@@ -20,7 +20,7 @@ import Table from '/@/components/table/index.vue'
import baTableClass from '/@/utils/baTable'
defineOptions({
name: 'record/userWalletRecord',
name: 'user/userWalletRecord',
})
const { t } = useI18n()
@@ -39,19 +39,19 @@ function formatAmount(_row: anyObj, _column: any, cellValue: unknown) {
}
const bizReplace = {
deposit: t('record.userWalletRecord.biz deposit'),
withdraw: t('record.userWalletRecord.biz withdraw'),
withdraw_freeze: t('record.userWalletRecord.biz withdraw_freeze'),
withdraw_unfreeze: t('record.userWalletRecord.biz withdraw_unfreeze'),
platform_in: t('record.userWalletRecord.biz platform_in'),
platform_out: t('record.userWalletRecord.biz platform_out'),
admin_credit: t('record.userWalletRecord.biz admin_credit'),
admin_deduct: t('record.userWalletRecord.biz admin_deduct'),
bet: t('record.userWalletRecord.biz bet'),
payout: t('record.userWalletRecord.biz payout'),
fee: t('record.userWalletRecord.biz fee'),
void_refund: t('record.userWalletRecord.biz void_refund'),
adjust: t('record.userWalletRecord.biz adjust'),
deposit: t('user.userWalletRecord.biz deposit'),
withdraw: t('user.userWalletRecord.biz withdraw'),
withdraw_freeze: t('user.userWalletRecord.biz withdraw_freeze'),
withdraw_unfreeze: t('user.userWalletRecord.biz withdraw_unfreeze'),
platform_in: t('user.userWalletRecord.biz platform_in'),
platform_out: t('user.userWalletRecord.biz platform_out'),
admin_credit: t('user.userWalletRecord.biz admin_credit'),
admin_deduct: t('user.userWalletRecord.biz admin_deduct'),
bet: t('user.userWalletRecord.biz bet'),
payout: t('user.userWalletRecord.biz payout'),
fee: t('user.userWalletRecord.biz fee'),
void_refund: t('user.userWalletRecord.biz void_refund'),
adjust: t('user.userWalletRecord.biz adjust'),
}
const bizTypeTagCustom = {
@@ -71,18 +71,18 @@ const bizTypeTagCustom = {
}
const dirReplace = {
'1': t('record.userWalletRecord.direction in'),
'2': t('record.userWalletRecord.direction out'),
'1': t('user.userWalletRecord.direction in'),
'2': t('user.userWalletRecord.direction out'),
}
const baTable = new baTableClass(
new baTableApi('/admin/record.UserWalletRecord/'),
new baTableApi('/admin/user.UserWalletRecord/'),
{
pk: 'id',
column: [
{ label: t('record.userWalletRecord.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
{ label: t('user.userWalletRecord.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
{
label: t('record.userWalletRecord.user_id'),
label: t('user.userWalletRecord.user_id'),
prop: 'user_id',
align: 'center',
width: 90,
@@ -91,7 +91,7 @@ const baTable = new baTableClass(
sortable: false,
},
{
label: t('record.userWalletRecord.user__username'),
label: t('user.userWalletRecord.user__username'),
prop: 'user.username',
align: 'center',
minWidth: 110,
@@ -101,7 +101,7 @@ const baTable = new baTableClass(
comSearchRender: 'string',
},
{
label: t('record.userWalletRecord.channel__name'),
label: t('user.userWalletRecord.channel__name'),
prop: 'channel.name',
align: 'center',
minWidth: 100,
@@ -111,7 +111,7 @@ const baTable = new baTableClass(
comSearchRender: 'string',
},
{
label: t('record.userWalletRecord.biz_type'),
label: t('user.userWalletRecord.biz_type'),
prop: 'biz_type',
align: 'center',
minWidth: 120,
@@ -121,7 +121,7 @@ const baTable = new baTableClass(
replaceValue: bizReplace,
},
{
label: t('record.userWalletRecord.direction'),
label: t('user.userWalletRecord.direction'),
prop: 'direction',
align: 'center',
width: 90,
@@ -134,7 +134,7 @@ const baTable = new baTableClass(
replaceValue: dirReplace,
},
{
label: t('record.userWalletRecord.amount'),
label: t('user.userWalletRecord.amount'),
prop: 'amount',
align: 'center',
minWidth: 110,
@@ -142,7 +142,7 @@ const baTable = new baTableClass(
formatter: formatAmount,
},
{
label: t('record.userWalletRecord.balance_before'),
label: t('user.userWalletRecord.balance_before'),
prop: 'balance_before',
align: 'center',
minWidth: 110,
@@ -150,7 +150,7 @@ const baTable = new baTableClass(
formatter: formatAmount,
},
{
label: t('record.userWalletRecord.balance_after'),
label: t('user.userWalletRecord.balance_after'),
prop: 'balance_after',
align: 'center',
minWidth: 110,
@@ -158,16 +158,16 @@ const baTable = new baTableClass(
formatter: formatAmount,
},
{
label: t('record.userWalletRecord.ref_type'),
label: t('user.userWalletRecord.ref_type'),
prop: 'ref_type',
align: 'center',
minWidth: 100,
showOverflowTooltip: true,
operator: 'LIKE',
},
{ label: t('record.userWalletRecord.ref_id'), prop: 'ref_id', align: 'center', width: 100, operator: 'RANGE' },
{ label: t('user.userWalletRecord.ref_id'), prop: 'ref_id', align: 'center', width: 100, operator: 'RANGE' },
{
label: t('record.userWalletRecord.idempotency_key'),
label: t('user.userWalletRecord.idempotency_key'),
prop: 'idempotency_key',
align: 'center',
minWidth: 120,
@@ -175,7 +175,7 @@ const baTable = new baTableClass(
operator: 'LIKE',
},
{
label: t('record.userWalletRecord.operator_admin__username'),
label: t('user.userWalletRecord.operator_admin__username'),
prop: 'operatorAdmin.username',
align: 'center',
minWidth: 100,
@@ -185,7 +185,7 @@ const baTable = new baTableClass(
comSearchRender: 'string',
},
{
label: t('record.userWalletRecord.remark'),
label: t('user.userWalletRecord.remark'),
prop: 'remark',
align: 'center',
minWidth: 140,
@@ -193,7 +193,7 @@ const baTable = new baTableClass(
operator: 'LIKE',
},
{
label: t('record.userWalletRecord.create_time'),
label: t('user.userWalletRecord.create_time'),
prop: 'create_time',
align: 'center',
render: 'datetime',