优化首页样式
This commit is contained in:
@@ -30,3 +30,37 @@ export function fetchRechargeBarChart() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 玩家充值记录项 */
|
||||||
|
export interface WalletRecordItem {
|
||||||
|
player_name: string
|
||||||
|
coin: number
|
||||||
|
create_time: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作台-玩家充值记录(最新50条)
|
||||||
|
* @returns 列表
|
||||||
|
*/
|
||||||
|
export function fetchWalletRecordList() {
|
||||||
|
return request.get<WalletRecordItem[]>({
|
||||||
|
url: '/core/dice/dashboard/walletRecordList'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增玩家记录项 */
|
||||||
|
export interface NewPlayerItem {
|
||||||
|
name: string
|
||||||
|
coin: number
|
||||||
|
total_ticket_count: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作台-新增玩家记录(最新50条)
|
||||||
|
* @returns 列表
|
||||||
|
*/
|
||||||
|
export function fetchNewPlayerList() {
|
||||||
|
return request.get<NewPlayerItem[]>({
|
||||||
|
url: '/core/dice/dashboard/newPlayerList'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,15 @@
|
|||||||
<SalesOverview />
|
<SalesOverview />
|
||||||
</ElCol>
|
</ElCol>
|
||||||
</ElRow>
|
</ElRow>
|
||||||
|
|
||||||
|
<ElRow :gutter="20">
|
||||||
|
<ElCol :sm="24" :md="12" :lg="12">
|
||||||
|
<WalletRecordList />
|
||||||
|
</ElCol>
|
||||||
|
<ElCol :sm="24" :md="12" :lg="12">
|
||||||
|
<NewPlayerList />
|
||||||
|
</ElCol>
|
||||||
|
</ElRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="userInfo.dashboard === 'work'">
|
<template v-if="userInfo.dashboard === 'work'">
|
||||||
@@ -34,6 +43,8 @@
|
|||||||
import CardList from './modules/card-list.vue'
|
import CardList from './modules/card-list.vue'
|
||||||
import ActiveUser from './modules/active-user.vue'
|
import ActiveUser from './modules/active-user.vue'
|
||||||
import SalesOverview from './modules/sales-overview.vue'
|
import SalesOverview from './modules/sales-overview.vue'
|
||||||
|
import WalletRecordList from './modules/wallet-record-list.vue'
|
||||||
|
import NewPlayerList from './modules/new-player-list.vue'
|
||||||
import NewUser from './modules/new-user.vue'
|
import NewUser from './modules/new-user.vue'
|
||||||
import Dynamic from './modules/dynamic-stats.vue'
|
import Dynamic from './modules/dynamic-stats.vue'
|
||||||
import TodoList from './modules/todo-list.vue'
|
import TodoList from './modules/todo-list.vue'
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<div class="art-card p-5 overflow-hidden mb-5 max-sm:mb-4">
|
||||||
|
<div class="art-card-header mb-4">
|
||||||
|
<div class="title">
|
||||||
|
<h4>新增玩家</h4>
|
||||||
|
<p class="text-g-600 text-sm mt-1">最新50条新增玩家记录</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ArtTable
|
||||||
|
class="w-full"
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
size="default"
|
||||||
|
:border="false"
|
||||||
|
:stripe="true"
|
||||||
|
:header-cell-style="{ background: 'transparent' }"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<ElTableColumn label="玩家" prop="name" min-width="120" />
|
||||||
|
<ElTableColumn label="余额" prop="coin" min-width="120" align="right">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatCoin(scope.row.coin) }}
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
<ElTableColumn label="抽奖券" prop="total_ticket_count" min-width="100" align="right" />
|
||||||
|
</template>
|
||||||
|
</ArtTable>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { fetchNewPlayerList, type NewPlayerItem } from '@/api/dashboard'
|
||||||
|
|
||||||
|
const tableData = ref<NewPlayerItem[]>([])
|
||||||
|
|
||||||
|
function formatCoin(val: number | undefined): string {
|
||||||
|
if (val === undefined || val === null) return '0.00'
|
||||||
|
return Number(val).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchNewPlayerList().then((data) => {
|
||||||
|
tableData.value = Array.isArray(data) ? data : []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<div class="art-card p-5 overflow-hidden mb-5 max-sm:mb-4">
|
||||||
|
<div class="art-card-header mb-4">
|
||||||
|
<div class="title">
|
||||||
|
<h4>玩家充值记录</h4>
|
||||||
|
<p class="text-g-600 text-sm mt-1">最新50条充值记录</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ArtTable
|
||||||
|
class="w-full"
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
size="default"
|
||||||
|
:border="false"
|
||||||
|
:stripe="true"
|
||||||
|
:header-cell-style="{ background: 'transparent' }"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<ElTableColumn label="玩家" prop="player_name" min-width="120" />
|
||||||
|
<ElTableColumn label="充值金额" prop="coin" min-width="120" align="right">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatCoin(scope.row.coin) }}
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
<ElTableColumn label="充值时间" prop="create_time" min-width="170" />
|
||||||
|
</template>
|
||||||
|
</ArtTable>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { fetchWalletRecordList, type WalletRecordItem } from '@/api/dashboard'
|
||||||
|
|
||||||
|
const tableData = ref<WalletRecordItem[]>([])
|
||||||
|
|
||||||
|
function formatCoin(val: number | undefined): string {
|
||||||
|
if (val === undefined || val === null) return '0.00'
|
||||||
|
return Number(val).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchWalletRecordList().then((data) => {
|
||||||
|
tableData.value = Array.isArray(data) ? data : []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -173,6 +173,60 @@ class DiceDashboardController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作台-玩家充值记录:最新50条(admin_id=当前管理员及子管理员,type=0)
|
||||||
|
* 返回:玩家账号(DicePlayer.username)、充值金额(coin)、充值时间(create_time)
|
||||||
|
*/
|
||||||
|
#[Permission('工作台数据统计', 'core:console:list')]
|
||||||
|
public function walletRecordList(): Response
|
||||||
|
{
|
||||||
|
$adminInfo = $this->adminInfo ?? null;
|
||||||
|
$query = DicePlayerWalletRecord::with([
|
||||||
|
'dicePlayer' => function ($q) {
|
||||||
|
$q->field('id,username');
|
||||||
|
},
|
||||||
|
])
|
||||||
|
->where('type', 0)
|
||||||
|
->order('create_time', 'desc')
|
||||||
|
->limit(50);
|
||||||
|
AdminScopeHelper::applyAdminScope($query, $adminInfo);
|
||||||
|
$list = $query->select();
|
||||||
|
$rows = [];
|
||||||
|
foreach ($list as $row) {
|
||||||
|
$player = $row->dicePlayer;
|
||||||
|
$rows[] = [
|
||||||
|
'player_name' => $player ? $player->getAttr('username') : '',
|
||||||
|
'coin' => $row->getAttr('coin'),
|
||||||
|
'create_time' => $row->getAttr('create_time'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $this->success($rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作台-新增玩家记录:最新50条(admin_id=当前管理员及子管理员)
|
||||||
|
* 返回:玩家账号(username)、余额(coin)、抽奖券(total_ticket_count)
|
||||||
|
*/
|
||||||
|
#[Permission('工作台数据统计', 'core:console:list')]
|
||||||
|
public function newPlayerList(): Response
|
||||||
|
{
|
||||||
|
$adminInfo = $this->adminInfo ?? null;
|
||||||
|
$query = DicePlayer::field('username,coin,total_ticket_count,create_time')
|
||||||
|
->order('create_time', 'desc')
|
||||||
|
->limit(50);
|
||||||
|
AdminScopeHelper::applyAdminScope($query, $adminInfo);
|
||||||
|
$list = $query->select();
|
||||||
|
$rows = [];
|
||||||
|
foreach ($list as $row) {
|
||||||
|
$rows[] = [
|
||||||
|
'name' => $row->getAttr('username'),
|
||||||
|
'coin' => $row->getAttr('coin'),
|
||||||
|
'total_ticket_count' => $row->getAttr('total_ticket_count'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $this->success($rows);
|
||||||
|
}
|
||||||
|
|
||||||
private function calcWeekChange($current, $last): float
|
private function calcWeekChange($current, $last): float
|
||||||
{
|
{
|
||||||
if ($last == 0) {
|
if ($last == 0) {
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ Route::group('/core', function () {
|
|||||||
Route::get('/dice/dashboard/statistics', [\app\dice\controller\DiceDashboardController::class, 'statistics']);
|
Route::get('/dice/dashboard/statistics', [\app\dice\controller\DiceDashboardController::class, 'statistics']);
|
||||||
Route::get('/dice/dashboard/rechargeChart', [\app\dice\controller\DiceDashboardController::class, 'rechargeChart']);
|
Route::get('/dice/dashboard/rechargeChart', [\app\dice\controller\DiceDashboardController::class, 'rechargeChart']);
|
||||||
Route::get('/dice/dashboard/rechargeBarChart', [\app\dice\controller\DiceDashboardController::class, 'rechargeBarChart']);
|
Route::get('/dice/dashboard/rechargeBarChart', [\app\dice\controller\DiceDashboardController::class, 'rechargeBarChart']);
|
||||||
|
Route::get('/dice/dashboard/walletRecordList', [\app\dice\controller\DiceDashboardController::class, 'walletRecordList']);
|
||||||
|
Route::get('/dice/dashboard/newPlayerList', [\app\dice\controller\DiceDashboardController::class, 'newPlayerList']);
|
||||||
Route::get('/system/clearAllCache', [plugin\saiadmin\app\controller\SystemController::class, 'clearAllCache']);
|
Route::get('/system/clearAllCache', [plugin\saiadmin\app\controller\SystemController::class, 'clearAllCache']);
|
||||||
|
|
||||||
Route::get("/system/getResourceCategory", [plugin\saiadmin\app\controller\SystemController::class, 'getResourceCategory']);
|
Route::get("/system/getResourceCategory", [plugin\saiadmin\app\controller\SystemController::class, 'getResourceCategory']);
|
||||||
|
|||||||
Reference in New Issue
Block a user