优化平台币显示样式不显示小数点,优化中大奖计算
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"platformTotalProfit": "Platform Total Profit"
|
||||
},
|
||||
"search": {
|
||||
"rewardConfigRecordId": "Weight Test Record ID",
|
||||
"drawType": "Draw Type",
|
||||
"direction": "Direction",
|
||||
"isBigWin": "Is Big Win",
|
||||
@@ -21,6 +22,7 @@
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"rewardConfigRecordId": "Weight Test Record ID",
|
||||
"player": "Player",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"drawType": "Draw Type",
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"platformTotalProfit": "平台总盈利"
|
||||
},
|
||||
"search": {
|
||||
"rewardConfigRecordId": "测试记录ID",
|
||||
"drawType": "抽奖类型",
|
||||
"direction": "方向",
|
||||
"isBigWin": "是否中大奖",
|
||||
@@ -21,6 +22,7 @@
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"rewardConfigRecordId": "测试记录ID",
|
||||
"player": "玩家",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"drawType": "抽奖类型",
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
* @returns 数据列表
|
||||
*/
|
||||
list(params: Record<string, any>) {
|
||||
return request.get<Api.Common.ApiPage>({
|
||||
return request.get<Api.Common.ApiPage & { total_win_coin?: number }>({
|
||||
url: '/core/dice/play_record_test/DicePlayRecordTest/index',
|
||||
params
|
||||
})
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<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>
|
||||
{{ $t('page.toolbar.platformTotalProfit') }}:<strong>{{ formatPlatformCoin(totalWinCoin) }}</strong>
|
||||
</span>
|
||||
<ElSpace wrap class="table-toolbar-buttons">
|
||||
<ElButton
|
||||
@@ -101,6 +101,16 @@
|
||||
<template #reward_config_id="{ row }">
|
||||
<ElTag size="small">{{ rewardTierFormatter(row) }}</ElTag>
|
||||
</template>
|
||||
<!-- 平台币相关:统一整数显示 -->
|
||||
<template #win_coin="{ row }">
|
||||
<span>{{ formatPlatformCoin(row?.win_coin) }}</span>
|
||||
</template>
|
||||
<template #super_win_coin="{ row }">
|
||||
<span>{{ formatPlatformCoin(row?.super_win_coin) }}</span>
|
||||
</template>
|
||||
<template #reward_win_coin="{ row }">
|
||||
<span>{{ formatPlatformCoin(row?.reward_win_coin) }}</span>
|
||||
</template>
|
||||
<!-- 状态 -->
|
||||
<template #status="{ row }">
|
||||
<ElTag size="small" :type="row.status === 1 ? 'success' : 'info'">
|
||||
@@ -147,6 +157,7 @@
|
||||
|
||||
// 搜索表单(与 play_record 对齐:方向、赢取平台币范围、是否中大奖、中奖档位、点数和)
|
||||
const searchForm = ref<Record<string, unknown>>({
|
||||
reward_config_record_id: undefined,
|
||||
lottery_type: undefined,
|
||||
direction: undefined,
|
||||
is_win: undefined,
|
||||
@@ -163,7 +174,7 @@
|
||||
|
||||
const listApi = async (params: Record<string, any>) => {
|
||||
const res = await api.list(params)
|
||||
totalWinCoin.value = (res as any)?.total_win_coin ?? null
|
||||
totalWinCoin.value = res?.total_win_coin ?? null
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -187,6 +198,13 @@
|
||||
return String(val)
|
||||
}
|
||||
|
||||
function formatPlatformCoin(val: unknown): string {
|
||||
if (val === '' || val === null || val === undefined) return '-'
|
||||
const n = typeof val === 'number' ? val : Number(val)
|
||||
if (!Number.isFinite(n)) return '-'
|
||||
return String(Math.trunc(n))
|
||||
}
|
||||
|
||||
const handleClearAll = async () => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定清空所有玩家抽奖测试数据?', '提示', {
|
||||
@@ -228,6 +246,11 @@
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80 },
|
||||
{
|
||||
prop: 'reward_config_record_id',
|
||||
label: 'page.table.rewardConfigRecordId',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
prop: 'lottery_config_id',
|
||||
label: 'page.table.lotteryPoolConfig',
|
||||
@@ -238,9 +261,9 @@
|
||||
{ prop: 'is_win', label: 'page.table.isBigWin', width: 100, useSlot: true },
|
||||
{ prop: 'paid_amount', label: 'page.table.paidAmount', width: 130 },
|
||||
{ prop: 'ante', label: 'page.table.ante', width: 90 },
|
||||
{ prop: 'win_coin', label: 'page.table.winCoin', width: 110 },
|
||||
{ prop: 'super_win_coin', label: 'page.table.superWinCoin', width: 120 },
|
||||
{ prop: 'reward_win_coin', label: 'page.table.rewardWinCoin', width: 140 },
|
||||
{ prop: 'win_coin', label: 'page.table.winCoin', width: 110, useSlot: true },
|
||||
{ prop: 'super_win_coin', label: 'page.table.superWinCoin', width: 120, useSlot: true },
|
||||
{ prop: 'reward_win_coin', label: 'page.table.rewardWinCoin', width: 140, useSlot: true },
|
||||
{ prop: 'direction', label: 'page.table.direction', width: 90, useSlot: true },
|
||||
{ prop: 'start_index', label: 'page.table.startIndex', width: 90 },
|
||||
{ prop: 'target_index', label: 'page.table.targetIndex', width: 90 },
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<el-input-number
|
||||
v-model="formData.win_coin"
|
||||
:placeholder="$t('page.form.placeholderWinCoin')"
|
||||
:precision="2"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
@@ -98,10 +98,22 @@
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.table.superWinCoin')" prop="super_win_coin">
|
||||
<el-input v-model="formData.super_win_coin" :placeholder="$t('page.form.placeholderSuperWinCoin')" />
|
||||
<el-input-number
|
||||
v-model="formData.super_win_coin"
|
||||
:placeholder="$t('page.form.placeholderSuperWinCoin')"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.table.rewardWinCoin')" prop="reward_win_coin">
|
||||
<el-input v-model="formData.reward_win_coin" :placeholder="$t('page.form.placeholderRewardWinCoin')" />
|
||||
<el-input-number
|
||||
v-model="formData.reward_win_coin"
|
||||
:placeholder="$t('page.form.placeholderRewardWinCoin')"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.form.labelAdminId')" prop="admin_id">
|
||||
<el-input v-model="formData.admin_id" :placeholder="$t('page.form.placeholderAdminId')" />
|
||||
@@ -182,8 +194,8 @@
|
||||
roll_number: null,
|
||||
roll_array: '',
|
||||
status: 1,
|
||||
super_win_coin: '0.00',
|
||||
reward_win_coin: '0.00',
|
||||
super_win_coin: 0,
|
||||
reward_win_coin: 0,
|
||||
admin_id: null
|
||||
}
|
||||
|
||||
@@ -220,6 +232,13 @@
|
||||
/**
|
||||
* 初始化表单数据
|
||||
*/
|
||||
function normalizePlatformCoin(val: unknown): number {
|
||||
if (val === '' || val === null || val === undefined) return 0
|
||||
const n = typeof val === 'number' ? val : Number(val)
|
||||
if (!Number.isFinite(n)) return 0
|
||||
return Math.trunc(n)
|
||||
}
|
||||
|
||||
const initForm = () => {
|
||||
if (props.data) {
|
||||
for (const key in formData) {
|
||||
@@ -228,9 +247,9 @@
|
||||
;(formData as Record<string, unknown>)[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
if (typeof formData.win_coin === 'string') {
|
||||
formData.win_coin = parseFloat(formData.win_coin) || 0
|
||||
}
|
||||
formData.win_coin = normalizePlatformCoin(formData.win_coin)
|
||||
formData.super_win_coin = normalizePlatformCoin(formData.super_win_coin)
|
||||
formData.reward_win_coin = normalizePlatformCoin(formData.reward_win_coin)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,8 +266,8 @@
|
||||
saiType: 'all',
|
||||
tier: tier
|
||||
})
|
||||
const list = (res as any)?.data ?? (Array.isArray(res) ? res : [])
|
||||
const first = Array.isArray(list) ? list[0] : (list?.data?.[0] ?? list?.[0])
|
||||
const list = res?.data
|
||||
const first = Array.isArray(list) && list.length > 0 ? list[0] : undefined
|
||||
if (first && first.id != null) {
|
||||
formData.reward_config_id = first.id
|
||||
} else {
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
@search="handleSearch"
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item :label="$t('page.search.rewardConfigRecordId')" prop="reward_config_record_id">
|
||||
<el-input-number
|
||||
v-model="formData.reward_config_record_id"
|
||||
:placeholder="$t('table.searchBar.all')"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item :label="$t('page.search.drawType')" prop="lottery_type">
|
||||
<el-select v-model="formData.lottery_type" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
@@ -60,7 +72,7 @@
|
||||
<el-input-number
|
||||
v-model="formData.win_coin_min"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:precision="2"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
@@ -68,7 +80,7 @@
|
||||
<el-input-number
|
||||
v-model="formData.win_coin_max"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:precision="2"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
|
||||
@@ -162,8 +162,8 @@ class PlayStartLogic
|
||||
$rollNumber = (int) ($chosen['grid_number'] ?? 0);
|
||||
$realEv = (float) ($chosen['real_ev'] ?? 0);
|
||||
$isTierT5 = (string) ($chosen['tier'] ?? '') === 'T5';
|
||||
// 玩家始终增加:(100 + real_ev) * ante(费用已在开始前扣除;免费抽奖同样按该口径结算)
|
||||
$rewardWinCoin = (self::UNIT_COST + $realEv) * $ante;
|
||||
// 摇色子中奖:按 dice_reward_config.real_ev 直接结算(已乘 ante);不再叠加票价 100
|
||||
$rewardWinCoin = $realEv * $ante;
|
||||
|
||||
// 豹子判定:5/30 必豹子;10/15/20/25 按 DiceRewardConfig 中 BIGWIN 该点数的 weight 判定(0-10000,10000=100%)
|
||||
// 杀分档位:不触发豹子,5/30 已在上方抽取时排除,10/15/20/25 仅生成非豹子组合
|
||||
@@ -197,7 +197,7 @@ class PlayStartLogic
|
||||
$rollArray = $this->getSuperWinRollArray($rollNumber);
|
||||
$isWin = 1;
|
||||
$bigWinEv = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
|
||||
$superWinCoin = (self::UNIT_COST + $bigWinEv) * $ante;
|
||||
$superWinCoin = $bigWinEv * $ante;
|
||||
// 中 BIGWIN 豹子:不走原奖励流程,不记录原奖励,不触发 T5 再来一次,仅发放豹子奖金
|
||||
$rewardWinCoin = 0;
|
||||
$realEv = 0;
|
||||
@@ -322,8 +322,8 @@ class PlayStartLogic
|
||||
$p->save();
|
||||
|
||||
// 彩金池累计盈利累加在 name=default 彩金池上:
|
||||
// 付费:每局按“当前中奖金额(含 BIGWIN) - 抽奖费用(ante*100)”
|
||||
// 免费券:取消票价成本 100,只计入中奖金额
|
||||
// 付费:每局按「本局赢取平台币 win_coin - 抽奖费用 paid_amount(ante*100)」
|
||||
// 免费券:paid_amount=0,只计入 win_coin
|
||||
$perPlayProfit = ($ticketType === self::LOTTERY_TYPE_PAID) ? ($winCoin - (float) $paidAmount) : $winCoin;
|
||||
$addProfit = $perPlayProfit;
|
||||
try {
|
||||
@@ -574,8 +574,8 @@ class PlayStartLogic
|
||||
$targetIndex = (int) ($chosen['end_index'] ?? 0);
|
||||
$rollNumber = (int) ($chosen['grid_number'] ?? 0);
|
||||
$realEv = (float) ($chosen['real_ev'] ?? 0);
|
||||
// 玩家始终增加:(100 + real_ev) * ante
|
||||
$rewardWinCoin = (self::UNIT_COST + $realEv) * $ante;
|
||||
// 摇色子中奖:按 real_ev 直接结算(与正式抽奖 run() 一致)
|
||||
$rewardWinCoin = $realEv * $ante;
|
||||
|
||||
$superWinCoin = 0;
|
||||
$isWin = 0;
|
||||
@@ -605,7 +605,7 @@ class PlayStartLogic
|
||||
$rollArray = $this->getSuperWinRollArray($rollNumber);
|
||||
$isWin = 1;
|
||||
$bigWinEv = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
|
||||
$superWinCoin = (self::UNIT_COST + $bigWinEv) * $ante;
|
||||
$superWinCoin = $bigWinEv * $ante;
|
||||
$rewardWinCoin = 0;
|
||||
// 中豹子时不走原奖励流程
|
||||
$realEv = 0.0;
|
||||
|
||||
@@ -38,6 +38,7 @@ class DicePlayRecordTestController extends BaseController
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$where = $request->more([
|
||||
['reward_config_record_id', ''],
|
||||
['lottery_type', ''],
|
||||
['direction', ''],
|
||||
['is_win', ''],
|
||||
|
||||
@@ -22,6 +22,8 @@ class DicePlayRecordTestLogic extends BaseLogic
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new DicePlayRecordTest();
|
||||
// 默认按 id 倒序,保证列表默认显示最新记录
|
||||
$this->setOrderField('id')->setOrderType('DESC');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -156,4 +156,12 @@ class DicePlayRecordTest extends BaseModel
|
||||
$query->where('roll_number', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 关联 dice_reward_config_record.id(权重测试记录) */
|
||||
public function searchRewardConfigRecordIdAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('reward_config_record_id', '=', $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user