diff --git a/extend/catcher/CatchTable.php b/extend/catcher/CatchTable.php new file mode 100644 index 0000000..69e4c0a --- /dev/null +++ b/extend/catcher/CatchTable.php @@ -0,0 +1,45 @@ + form || table + * @return array|\think\response\Json + */ + public function render($only) + { + if ($only) { + return CatchResponse::success([ + $only => $this->{$only}() + ]); + } + + return CatchResponse::success([ + 'table' => $this->table(), + 'form' => $this->form() + ]); + } + + /** + * 获取表对象 + * + * @time 2021年03月30日 + * @param string $tableName + * @return Table + */ + protected function getTable(string $tableName): Table + { + return new Table($tableName); + } +} \ No newline at end of file