1.玩家抽奖记录/dice/play_record/index新增时间筛选
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
"rollNumber": "Roll Number",
|
||||
"rewardTier": "Reward Tier",
|
||||
"rewardConfig": "Reward Config",
|
||||
"createTime": "Created At",
|
||||
"usernameFuzzy": "Username (fuzzy)",
|
||||
"nameFuzzy": "Name (fuzzy)",
|
||||
"uiTextFuzzy": "UI Text (fuzzy)",
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
"rollNumber": "摇取点数和",
|
||||
"rewardTier": "中奖档位",
|
||||
"rewardConfig": "奖励配置",
|
||||
"createTime": "创建时间",
|
||||
"usernameFuzzy": "用户名模糊",
|
||||
"nameFuzzy": "名称模糊",
|
||||
"uiTextFuzzy": "前端显示文本模糊",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="art-full-height">
|
||||
<!-- 搜索面板 -->
|
||||
<TableSearch v-model="searchForm" @search="handleSearch" @reset="resetSearchParams" />
|
||||
<TableSearch v-model="searchForm" @search="handleSearch" @reset="handleResetSearch" />
|
||||
|
||||
<ElCard class="art-table-card" shadow="never">
|
||||
<!-- 表格头部 -->
|
||||
@@ -158,9 +158,40 @@
|
||||
roll_number_max: undefined,
|
||||
reward_ui_text: undefined,
|
||||
reward_tier: undefined,
|
||||
direction: undefined
|
||||
direction: undefined,
|
||||
create_time: undefined
|
||||
})
|
||||
|
||||
const PLAY_RECORD_SEARCH_KEYS = [
|
||||
'username',
|
||||
'lottery_config_name',
|
||||
'lottery_type',
|
||||
'is_win',
|
||||
'win_coin_min',
|
||||
'win_coin_max',
|
||||
'roll_number_min',
|
||||
'roll_number_max',
|
||||
'reward_ui_text',
|
||||
'reward_tier',
|
||||
'direction',
|
||||
'create_time_min',
|
||||
'create_time_max'
|
||||
] as const
|
||||
|
||||
const applySearchParams = (params: Record<string, unknown>) => {
|
||||
const p = { ...params }
|
||||
if (Array.isArray(p.create_time) && p.create_time.length === 2) {
|
||||
p.create_time_min = p.create_time[0]
|
||||
p.create_time_max = p.create_time[1]
|
||||
}
|
||||
delete p.create_time
|
||||
const paramsRecord = searchParams as Record<string, unknown>
|
||||
PLAY_RECORD_SEARCH_KEYS.forEach((key) => {
|
||||
delete paramsRecord[key]
|
||||
})
|
||||
Object.assign(searchParams, p)
|
||||
}
|
||||
|
||||
/** 当前筛选下平台总盈利(付费金额 paid_amount 求和 - 玩家总收益) */
|
||||
const totalWinCoin = ref<number | null>(null)
|
||||
|
||||
@@ -170,12 +201,16 @@
|
||||
return res
|
||||
}
|
||||
|
||||
// 搜索处理
|
||||
const handleSearch = (params: Record<string, any>) => {
|
||||
Object.assign(searchParams, params)
|
||||
applySearchParams(params)
|
||||
getData()
|
||||
}
|
||||
|
||||
const handleResetSearch = () => {
|
||||
searchForm.value.create_time = undefined
|
||||
resetSearchParams()
|
||||
}
|
||||
|
||||
const usernameFormatter = (row: Record<string, any>) =>
|
||||
row?.dicePlayer?.username ?? row?.player_id ?? '-'
|
||||
const lotteryConfigNameFormatter = (row: Record<string, any>) => lotteryPoolRowLabel(row)
|
||||
@@ -221,6 +256,7 @@
|
||||
core: {
|
||||
apiFn: listApi,
|
||||
apiParams: { limit: 100 },
|
||||
excludeParams: ['create_time'],
|
||||
columnsFactory: () => [
|
||||
// { type: 'selection' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80 },
|
||||
|
||||
@@ -105,6 +105,19 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(8)">
|
||||
<el-form-item :label="$t('page.search.createTime')" prop="create_time">
|
||||
<el-date-picker
|
||||
v-model="formData.create_time"
|
||||
type="datetimerange"
|
||||
:range-separator="$t('table.searchBar.rangeSeparator')"
|
||||
:start-placeholder="$t('table.searchBar.startTime')"
|
||||
:end-placeholder="$t('table.searchBar.endTime')"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ class DicePlayRecordController extends BaseController
|
||||
['reward_ui_text', ''],
|
||||
['reward_tier', ''],
|
||||
['direction', ''],
|
||||
['create_time_min', ''],
|
||||
['create_time_max', ''],
|
||||
]);
|
||||
$query = $this->logic->search($where);
|
||||
AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null, $request->input('dept_id'));
|
||||
|
||||
@@ -286,4 +286,20 @@ class DicePlayRecord extends DiceModel
|
||||
$query->where('roll_number', '<=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建时间起始 */
|
||||
public function searchCreateTimeMinAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('create_time', '>=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建时间结束 */
|
||||
public function searchCreateTimeMaxAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('create_time', '<=', $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user