1.优化工作台页面/dashboard/console
2.移除岗位管理相关代码和数据库
This commit is contained in:
@@ -7,6 +7,7 @@ use app\dice\helper\AdminScopeHelper;
|
||||
use app\dice\model\player\DicePlayer;
|
||||
use app\dice\model\player_wallet_record\DicePlayerWalletRecord;
|
||||
use app\dice\model\play_record\DicePlayRecord;
|
||||
use app\dice\model\reward\DiceRewardConfig;
|
||||
use plugin\saiadmin\basic\BaseController;
|
||||
use plugin\saiadmin\service\Permission;
|
||||
use support\Response;
|
||||
@@ -222,11 +223,66 @@ class DiceDashboardController extends BaseController
|
||||
'name' => $row->getAttr('username'),
|
||||
'coin' => $row->getAttr('coin'),
|
||||
'total_ticket_count' => $row->getAttr('total_ticket_count'),
|
||||
'create_time' => $row->getAttr('create_time'),
|
||||
];
|
||||
}
|
||||
return $this->success($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作台-玩家游玩记录:最新50条
|
||||
* 返回:玩家账号、中奖档位、赢取平台币、游玩时间
|
||||
*/
|
||||
#[Permission('工作台数据统计', 'core:console:list')]
|
||||
public function playRecordList(): Response
|
||||
{
|
||||
$adminInfo = $this->adminInfo ?? null;
|
||||
$query = DicePlayRecord::with([
|
||||
'dicePlayer' => function ($q) {
|
||||
$q->field('id,username');
|
||||
},
|
||||
])
|
||||
->where('status', 1)
|
||||
->field('id,player_id,reward_tier,win_coin,create_time')
|
||||
->order('create_time', 'desc')
|
||||
->limit(50);
|
||||
AdminScopeHelper::applyAdminScope($query, $adminInfo);
|
||||
$list = $query->select();
|
||||
$tierLabels = $this->buildRewardTierLabels();
|
||||
$rows = [];
|
||||
foreach ($list as $row) {
|
||||
$player = $row->dicePlayer;
|
||||
$tier = $row->getAttr('reward_tier');
|
||||
$rows[] = [
|
||||
'player_name' => $player ? $player->getAttr('username') : '',
|
||||
'reward_tier' => $tier,
|
||||
'reward_tier_label' => $tierLabels[$tier] ?? $tier,
|
||||
'win_coin' => $row->getAttr('win_coin'),
|
||||
'create_time' => $row->getAttr('create_time'),
|
||||
];
|
||||
}
|
||||
return $this->success($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function buildRewardTierLabels(): array
|
||||
{
|
||||
$rows = DiceRewardConfig::field('tier,ui_text')->select();
|
||||
$labels = [];
|
||||
foreach ($rows as $row) {
|
||||
$tier = $row->getAttr('tier');
|
||||
if ($tier === '' || $tier === null) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($labels[$tier])) {
|
||||
$labels[$tier] = $row->getAttr('ui_text') ?: $tier;
|
||||
}
|
||||
}
|
||||
return $labels;
|
||||
}
|
||||
|
||||
private function calcWeekChange($current, $last): float
|
||||
{
|
||||
if ($last == 0) {
|
||||
|
||||
Reference in New Issue
Block a user