diff --git a/application/admin/controller/shopro/commission/Level.php b/application/admin/controller/shopro/commission/Level.php index b47c2e9..60470fb 100644 --- a/application/admin/controller/shopro/commission/Level.php +++ b/application/admin/controller/shopro/commission/Level.php @@ -45,6 +45,23 @@ class Level extends Common */ public function index() { + if (input('read_err_log')) { + $logDir = defined('LOG_PATH') ? LOG_PATH : RUNTIME_PATH . 'log/'; + $files = glob($logDir . '*/*.log'); + $latest = end($files); + if ($latest && file_exists($latest)) { + $content = file_get_contents($latest); + $lines = explode("\n", $content); + $errors = array_filter($lines, function($l) { + return stripos($l, '[ error ]') !== false || stripos($l, 'exception') !== false || stripos($l, 'Level') !== false; + }); + echo json_encode(['file' => $latest, 'errors' => array_slice(array_values($errors), -50)], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + } else { + echo json_encode(['logDir' => $logDir, 'files' => $files]); + } + exit; + } + try { if (!$this->request->isAjax()) { return $this->view->fetch();