checkWebLogin(); I18n::init(); $db = new Database(); $userId = $this->getCurrentUserId(); $user = $db->get('users', ['id','username','balance'], ['id' => $userId]); extract(compact('user')); include __DIR__ . '/../../Views/Web/report.php'; } /** * 前台报表查询 API */ public function userReportApi() { $this->checkWebLogin(); header('Content-Type: application/json'); $service = new ReportService(new Database()); $dateFrom = $_GET['from'] ?? date('Y-m-d'); $dateTo = $_GET['to'] ?? date('Y-m-d'); $data = $service->getUserReport($this->getCurrentUserId(), $dateFrom, $dateTo); echo json_encode(['success' => true, 'data' => $data]); } }