diff --git a/extend/catcher/CatchAdmin.php b/extend/catcher/CatchAdmin.php index 5ac548a..f8c9f9f 100644 --- a/extend/catcher/CatchAdmin.php +++ b/extend/catcher/CatchAdmin.php @@ -131,15 +131,22 @@ class CatchAdmin * @time 2019年12月12日 * @return array */ - public static function getModulesInfo(): array + public static function getModulesInfo($select = true): array { $modules = []; - foreach (self::getModulesDirectory() as $module) { - $moduleInfo = self::getModuleInfo($module); - $modules[] = [ - 'value' => $moduleInfo['alias'], - 'title' => $moduleInfo['name'], - ]; + if ($select) { + foreach (self::getModulesDirectory() as $module) { + $moduleInfo = self::getModuleInfo($module); + $modules[] = [ + 'value' => $moduleInfo['alias'], + 'title' => $moduleInfo['name'], + ]; + } + } else { + foreach (self::getModulesDirectory() as $module) { + $moduleInfo = self::getModuleInfo($module); + $modules[$moduleInfo['alias']] = $moduleInfo['name']; + } } return $modules; diff --git a/extend/catcher/CatchResponse.php b/extend/catcher/CatchResponse.php index e97f682..58aa9a7 100644 --- a/extend/catcher/CatchResponse.php +++ b/extend/catcher/CatchResponse.php @@ -18,13 +18,11 @@ class CatchResponse */ public static function success($data = [], $msg = 'success', $code = 10000): \think\response\Json { - if (request()->isAjax()) { - return json([ - 'code' => $code, - 'msg' => $msg, - 'data' => $data, - ]); - } + return json([ + 'code' => $code, + 'msg' => $msg, + 'data' => $data, + ]); } /**