uid(); /** @var UserServices $userServices */ $userServices = app()->make(UserServices::class); $user = $userServices->get($uid, ['uid', 'brokerage_price', 'frozen_points', 'available_points', 'agent_level', 'now_money']); if (!$user) { return app('json')->fail('用户不存在'); } $agentLevelName = ''; if (!empty($user['agent_level'])) { /** @var AgentLevelServices $agentLevelServices */ $agentLevelServices = app()->make(AgentLevelServices::class); $levelInfo = $agentLevelServices->get((int)$user['agent_level'], ['id', 'name']); $agentLevelName = $levelInfo ? $levelInfo['name'] : ''; } // 今日释放积分:frozen_points * 0.4‰(与定时任务逻辑一致) $frozenPoints = (int)($user['frozen_points'] ?? 0); $todayRelease = (int)floor($frozenPoints * 0.0004); $availablePoints = (int)($user['available_points'] ?? 0); return app('json')->successful([ 'brokerage_price' => (string)($user['brokerage_price'] ?? '0.00'), 'now_money' => (string)($user['now_money'] ?? '0.00'), 'frozen_points' => $frozenPoints, 'available_points' => $availablePoints, 'today_release' => $todayRelease, 'total_points_earned' => $frozenPoints + $availablePoints, 'agent_level' => (int)($user['agent_level'] ?? 0), 'agent_level_name' => $agentLevelName, ]); } }