feat: 增强开奖列表统计功能
- 在 AdminDrawIndexController 中新增 aggregateListStats 方法,聚合每个开奖的投注和派彩金额,计算盈亏情况。 - 更新 row 方法,使用聚合统计数据替代原有的直接查询,提升性能与可读性。 - 通过优化数据处理逻辑,确保在获取开奖列表时能够同时返回相关的统计信息。
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
/**
|
||||
* 对齐高频查询路径(PostgreSQL B-tree)。
|
||||
*
|
||||
* - ticket_orders:按 draw_id 结算/后台汇总
|
||||
* - wallet_txns / ticket_items:player_id + ORDER BY id DESC 分页
|
||||
* - draws:business_date 筛选 + draw_time 排序(往期/报表)
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('ticket_orders', function (Blueprint $table): void {
|
||||
$table->index('draw_id', 'idx_ticket_orders_draw_id');
|
||||
});
|
||||
|
||||
Schema::table('wallet_txns', function (Blueprint $table): void {
|
||||
$table->index(['player_id', 'id'], 'idx_wallet_txns_player_id');
|
||||
});
|
||||
|
||||
Schema::table('ticket_items', function (Blueprint $table): void {
|
||||
$table->index(['player_id', 'id'], 'idx_ticket_items_player_id');
|
||||
});
|
||||
|
||||
Schema::table('draws', function (Blueprint $table): void {
|
||||
$table->index(['business_date', 'draw_time'], 'idx_draws_business_date_draw_time');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('draws', function (Blueprint $table): void {
|
||||
$table->dropIndex('idx_draws_business_date_draw_time');
|
||||
});
|
||||
|
||||
Schema::table('ticket_items', function (Blueprint $table): void {
|
||||
$table->dropIndex('idx_ticket_items_player_id');
|
||||
});
|
||||
|
||||
Schema::table('wallet_txns', function (Blueprint $table): void {
|
||||
$table->dropIndex('idx_wallet_txns_player_id');
|
||||
});
|
||||
|
||||
Schema::table('ticket_orders', function (Blueprint $table): void {
|
||||
$table->dropIndex('idx_ticket_orders_draw_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user