玩家抽奖记录-新增平台盈利汇总

This commit is contained in:
2026-03-21 10:35:00 +08:00
parent 8702cb0571
commit 68092759d3
4 changed files with 40 additions and 1 deletions

View File

@@ -36,6 +36,9 @@
"editSuccess": "Updated successfully",
"validateFailed": "Validation failed, please check required fields and format"
},
"toolbar": {
"platformTotalProfit": "Platform Total Profit"
},
"search": {
"player": "Player",
"lotteryPoolConfig": "Lottery Pool Config",

View File

@@ -36,6 +36,9 @@
"editSuccess": "修改成功",
"validateFailed": "表单验证失败,请检查必填项与格式"
},
"toolbar": {
"platformTotalProfit": "平台总盈利"
},
"search": {
"player": "玩家",
"lotteryPoolConfig": "彩金池配置",

View File

@@ -7,6 +7,9 @@
<!-- 表格头部 -->
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
<template #left>
<span v-if="totalWinCoin !== null" class="table-summary-inline">
{{ $t('page.toolbar.platformTotalProfit') }}<strong>{{ totalWinCoin }}</strong>
</span>
<!-- <ElSpace wrap>-->
<!-- <ElButton-->
<!-- v-permission="'dice:play_record:index:save'"-->
@@ -126,6 +129,15 @@
direction: undefined
})
/** 当前筛选下平台总盈利付费抽奖次数×100 - 玩家总收益) */
const totalWinCoin = ref<number | null>(null)
const listApi = async (params: Record<string, any>) => {
const res = await api.list(params)
totalWinCoin.value = (res as any)?.total_win_coin ?? null
return res
}
// 搜索处理
const handleSearch = (params: Record<string, any>) => {
Object.assign(searchParams, params)
@@ -170,7 +182,7 @@
refreshData
} = useTable({
core: {
apiFn: api.list,
apiFn: listApi,
apiParams: { limit: 100 },
columnsFactory: () => [
// { type: 'selection' },
@@ -220,3 +232,15 @@
// selectedRows
} = useSaiAdmin()
</script>
<style scoped>
.table-summary-inline {
margin-right: 12px;
font-size: 14px;
color: var(--el-text-color-regular);
white-space: nowrap;
}
.table-summary-inline strong {
color: var(--el-color-danger);
}
</style>

View File

@@ -60,7 +60,16 @@ class DicePlayRecordController extends BaseController
'diceRewardConfig',
'diceLotteryPoolConfig',
]);
// 按当前筛选条件统计:平台总盈利 = 付费抽奖(lottery_type=0)次数×100 - 玩家总收益(win_coin 求和)
$sumQuery = clone $query;
$playerTotalWin = (float) $sumQuery->sum('win_coin');
$paidCountQuery = clone $query;
$paidCount = (int) $paidCountQuery->where('lottery_type', 0)->count();
$totalWinCoin = $paidCount * 100 - $playerTotalWin;
$data = $this->logic->getList($query);
$data['total_win_coin'] = $totalWinCoin;
return $this->success($data);
}