diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index c2c3e769..cc8ac754 100644 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -15,6 +15,8 @@ use think\Lang; class Crud extends Command { + protected $stubList = []; + protected function configure() { $this @@ -28,7 +30,8 @@ class Crud extends Command ->addOption('relationmodel', 'e', Option::VALUE_OPTIONAL, 'relation model name', null) ->addOption('relationforeignkey', 'k', Option::VALUE_OPTIONAL, 'relation foreign key', null) ->addOption('relationprimarykey', 'p', Option::VALUE_OPTIONAL, 'relation primary key', null) - ->addOption('mode', 'o', Option::VALUE_OPTIONAL, 'relation table mode,hasone or belongsto', 'hasone') + ->addOption('mode', 'o', Option::VALUE_OPTIONAL, 'relation table mode,hasone or belongsto', 'belongsto') + ->addOption('delete', 'd', Option::VALUE_OPTIONAL, 'delete all files generated by CRUD', null) ->setDescription('Build CRUD controller and model from table'); } @@ -98,25 +101,66 @@ class Crud extends Command $controllerName = ucfirst(array_pop($controllerArr)); $controllerDir = implode(DS, $controllerArr); $controllerFile = ($controllerDir ? $controllerDir . DS : '') . $controllerName . '.php'; + $viewDir = $adminPath . 'view' . DS . $controllerUrl . DS; - //非覆盖模式时如果存在控制器文件则报错 - if (is_file($controllerFile) && !$force) - { - throw new Exception('controller already exists!\nIf you need to rebuild again, use the parameter --force=true '); - } + //最终将生成的文件路径 + $controllerFile = $adminPath . 'controller' . DS . $controllerFile; + $javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerUrl . '.js'; + $addFile = $viewDir . 'add.html'; + $editFile = $viewDir . 'edit.html'; + $indexFile = $viewDir . 'index.html'; + $langFile = $adminPath . 'lang' . DS . Lang::detect() . DS . $controllerUrl . '.php'; //模型默认以表名进行处理,以下划线进行分隔,如果需要自定义则需要传入model,不支持目录层级 $modelName = $this->getModelName($model, $table); $modelFile = ($local ? $adminPath : APP_PATH . 'common' . DS) . 'model' . DS . $modelName . '.php'; + $validateFile = $adminPath . 'validate' . DS . $modelName . '.php'; + //关联模型默认以表名进行处理,以下划线进行分隔,如果需要自定义则需要传入relationmodel,不支持目录层级 $relationModelName = $this->getModelName($relationModel, $relation); $relationModelFile = ($local ? $adminPath : APP_PATH . 'common' . DS) . 'model' . DS . $relationModelName . '.php'; + //是否为删除模式 + $delete = $input->getOption('delete'); + if ($delete) + { + $readyFiles = [$controllerFile, $modelFile, $validateFile, $addFile, $editFile, $indexFile, $langFile, $javascriptFile]; + foreach ($readyFiles as $k => $v) + { + $output->warning($v); + } + $output->info("Are you sure you want to delete all those files? Type 'yes' to continue: "); + $line = fgets(STDIN); + if (trim($line) != 'yes') + { + throw new Exception("Operation is aborted!"); + } + foreach ($readyFiles as $k => $v) + { + unlink($v); + } + + $output->info("Delete Successed"); + return; + } + + //非覆盖模式时如果存在控制器文件则报错 + if (is_file($controllerFile) && !$force) + { + throw new Exception("controller already exists!\nIf you need to rebuild again, use the parameter --force=true "); + } + //非覆盖模式时如果存在模型文件则报错 if (is_file($modelFile) && !$force) { - throw new Exception('model already exists!\nIf you need to rebuild again, use the parameter --force=true '); + throw new Exception("model already exists!\nIf you need to rebuild again, use the parameter --force=true "); + } + + //非覆盖模式时如果存在验证文件则报错 + if (is_file($validateFile) && !$force) + { + throw new Exception("validate already exists!\nIf you need to rebuild again, use the parameter --force=true "); } require $adminPath . 'common.php'; @@ -219,7 +263,9 @@ class Crud extends Command Form::setEscapeHtml(false); $setAttrArr = []; $getAttrArr = []; + $getEnumArr = []; $appendAttrList = []; + $controllerAssignList = []; //循环所有字段,开始构造视图的HTML和JS信息 foreach ($columnList as $k => $v) @@ -231,12 +277,14 @@ class Crud extends Command { $itemArr = substr($v['COLUMN_TYPE'], strlen($v['DATA_TYPE']) + 1, -1); $itemArr = explode(',', str_replace("'", '', $itemArr)); + $itemArr = $this->getItemArray($itemArr, $field, $v['COLUMN_COMMENT']); } // 语言列表 if ($v['COLUMN_COMMENT'] != '') { $langList[] = $this->getLangItem($field, $v['COLUMN_COMMENT']); } + $inputType = ''; //createtime和updatetime是保留字段不能修改和添加 if ($v['COLUMN_KEY'] != 'PRI' && !in_array($field, ['createtime', 'updatetime'])) { @@ -255,13 +303,7 @@ class Crud extends Command { $attrArr['data-rule'] = 'required'; } - if ($field == 'status' && in_array($inputType, ['text', 'number'])) - { - //如果状态类型不是enum或set - $itemArr = !$itemArr ? ['normal', 'hidden'] : $itemArr; - $inputType = 'radio'; - $this->getAttr($getAttrArr, $field); - } + if ($inputType == 'select') { $cssClassArr[] = 'selectpicker'; @@ -271,15 +313,16 @@ class Crud extends Command $attrArr['multiple'] = ''; $fieldName .= "[]"; } - $attrStr = $this->getArrayString($attrArr); - $itemArr = $this->getLangArray($itemArr, FALSE); - $itemString = $this->getArrayString($itemArr); + $attrArr['name'] = $fieldName; + $this->getEnum($getEnumArr, $controllerAssignList, $field, $itemArr, $v['DATA_TYPE'] == 'set' ? 'multiple' : 'select'); + + $itemArr = $this->getLangArray($itemArr, FALSE); //添加一个获取器 - $this->getAttr($getAttrArr, $field, $itemArr, $v['DATA_TYPE'] == 'set' ? 'multiple' : 'select'); + $this->getAttr($getAttrArr, $field, $v['DATA_TYPE'] == 'set' ? 'multiple' : 'select'); $this->appendAttr($appendAttrList, $field); - $formAddElement = "{:build_select('{$fieldName}', [{$itemString}], '{$defaultValue}', [{$attrStr}])}"; - $formEditElement = "{:build_select('{$fieldName}', [{$itemString}], \$row.{$field}, [{$attrStr}])}"; + $formAddElement = $this->getReplacedStub('html/select', ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => $defaultValue]); + $formEditElement = $this->getReplacedStub('html/select', ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]); } else if ($inputType == 'datetime') { @@ -310,8 +353,8 @@ class Crud extends Command break; default: $fieldFunc = 'datetime'; - $this->getAttr($getAttrArr, $field, '', $inputType); - $this->setAttr($setAttrArr, $field, '', $inputType); + $this->getAttr($getAttrArr, $field, $inputType); + $this->setAttr($setAttrArr, $field, $inputType); $this->appendAttr($appendAttrList, $field); break; } @@ -322,27 +365,19 @@ class Crud extends Command $formAddElement = Form::text($fieldName, $defaultDateTime, $attrArr); $formEditElement = Form::text($fieldName, "{\$row.{$field}{$fieldFunc}}", $attrArr); } - else if ($inputType == 'checkbox') + else if ($inputType == 'checkbox' || $inputType == 'radio') { - $fieldName .= "[]"; + $fieldName = $inputType == 'checkbox' ? $fieldName .= "[]" : $fieldName; + $attrArr['name'] = "row[{$fieldName}]"; $itemArr = $this->getLangArray($itemArr, FALSE); - $itemString = $this->getArrayString($itemArr); + $this->getEnum($getEnumArr, $controllerAssignList, $field, $itemArr, $inputType); //添加一个获取器 - $this->getAttr($getAttrArr, $field, $itemArr, $inputType); + $this->getAttr($getAttrArr, $field, $inputType); $this->appendAttr($appendAttrList, $field); - $formAddElement = "{:build_checkboxs('{$fieldName}', [{$itemString}], '{$defaultValue}')}"; - $formEditElement = "{:build_checkboxs('{$fieldName}', [{$itemString}], \$row.{$field})}"; - } - else if ($inputType == 'radio') - { - $itemArr = $this->getLangArray($itemArr, FALSE); - $itemString = $this->getArrayString($itemArr); - $defaultValue = $defaultValue ? $defaultValue : key($itemArr); - //添加一个获取器 - $this->getAttr($getAttrArr, $field, $itemArr, $inputType); - $this->appendAttr($appendAttrList, $field); - $formAddElement = "{:build_radios('{$fieldName}', [{$itemString}], '{$defaultValue}')}"; - $formEditElement = "{:build_radios('{$fieldName}', [{$itemString}], \$row.{$field})}"; + $defaultValue = $inputType == 'radio' && !$defaultValue ? key($itemArr) : $defaultValue; + + $formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => $defaultValue]); + $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldList' => $this->getFieldListName($field), 'attrStr' => Form::attributes($attrArr), 'selectedValue' => "\$row.{$field}"]); } else if ($inputType == 'textarea') { @@ -410,7 +445,11 @@ class Crud extends Command $javascriptList[] = "{field: 'state', checkbox: true}"; } //构造JS列信息 - $javascriptList[] = $this->getJsColumn($field); + $javascriptList[] = $this->getJsColumn($field, $v['DATA_TYPE']); + if ($inputType && in_array($inputType, ['select', 'checkbox', 'radio'])) + { + $javascriptList[] = $this->getJsColumn($field, $v['DATA_TYPE'], '_text'); + } //排序方式,如果有weigh则按weigh,否则按主键排序 $order = $field == 'weigh' ? 'weigh' : $order; } @@ -434,7 +473,7 @@ class Crud extends Command if ($v['DATA_TYPE'] != 'text') { //构造JS列信息 - $javascriptList[] = $this->getJsColumn($relationField); + $javascriptList[] = $this->getJsColumn($relationField, $v['DATA_TYPE']); } } @@ -450,27 +489,23 @@ class Crud extends Command $tableComment = $tableInfo['Comment']; $tableComment = mb_substr($tableComment, -1) == '表' ? mb_substr($tableComment, 0, -1) . '管理' : $tableComment; - //最终将生成的文件路径 - $controllerFile = $adminPath . 'controller' . DS . $controllerFile; - $javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerUrl . '.js'; - $addFile = $adminPath . 'view' . DS . $controllerUrl . DS . 'add.html'; - $editFile = $adminPath . 'view' . DS . $controllerUrl . DS . 'edit.html'; - $indexFile = $adminPath . 'view' . DS . $controllerUrl . DS . 'index.html'; - $langFile = $adminPath . 'lang' . DS . Lang::detect() . DS . $controllerUrl . '.php'; - $appNamespace = Config::get('app_namespace'); $moduleName = 'admin'; $controllerNamespace = "{$appNamespace}\\{$moduleName}\\controller" . ($controllerDir ? "\\" : "") . str_replace('/', "\\", $controllerDir); $modelNamespace = "{$appNamespace}\\" . ($local ? $moduleName : "common") . "\\model"; - + $validateNamespace = "{$appNamespace}\\" . $moduleName . "\\validate"; + $validateName = $modelName; $data = [ 'controllerNamespace' => $controllerNamespace, 'modelNamespace' => $modelNamespace, + 'validateNamespace' => $validateNamespace, 'controllerUrl' => $controllerUrl, 'controllerDir' => $controllerDir, 'controllerName' => $controllerName, + 'controllerAssignList' => implode("\n", $controllerAssignList), 'modelName' => $modelName, + 'validateName' => $validateName, 'tableComment' => $tableComment, 'iconName' => $iconName, 'pk' => $priKey, @@ -495,6 +530,7 @@ class Crud extends Command 'relationSearch' => $relation ? 'true' : 'false', 'controllerIndex' => '', 'appendAttrList' => implode(",\n", $appendAttrList), + 'getEnumList' => implode("\n\n", $getEnumArr), 'getAttrList' => implode("\n\n", $getAttrArr), 'setAttrList' => implode("\n\n", $setAttrArr), 'modelMethod' => '', @@ -527,6 +563,8 @@ class Crud extends Command // 生成关联模型文件 $result = $this->writeToFile('relationmodel', $data, $relationModelFile); } + // 生成验证文件 + $result = $this->writeToFile('validate', $data, $validateFile); // 生成视图文件 $result = $this->writeToFile('add', $data, $addFile); $result = $this->writeToFile('edit', $data, $editFile); @@ -541,79 +579,56 @@ class Crud extends Command } catch (\think\exception\ErrorException $e) { - print_r($e); + throw new Exception("Code: " . $e->getCode() . "\nLine: " . $e->getLine() . "\nMessage: " . $e->getMessage()); } - $output->writeln("Build Successed"); + $output->info("Build Successed"); } - protected function getAttr(&$getAttr, $field, $itemArr = '', $inputType = '') + protected function getEnum(&$getEnum, &$controllerAssignList, $field, $itemArr = '', $inputType = '') { - if (preg_match("/[_\-]+/", $field)) - { - return; - } if (!in_array($inputType, ['datetime', 'select', 'multiple', 'checkbox', 'radio'])) return; - $attrField = ucfirst($field); - if ($inputType == 'datetime') + $fieldList = $this->getFieldListName($field); + $methodName = 'get' . ucfirst($fieldList); + unset($v); + foreach ($itemArr as $k => &$v) { - $return = <<getArrayString($itemArr); - $return = << \$v) - { - if (isset(\$arr[\$v])) - { - \$resultArr[] = \$arr[\$v]; - } - } - return implode(',', \$resultArr); -EOD; - } - else - { - $itemString = $this->getArrayString($itemArr); - $return = <<getArrayString($itemArr); + $getEnum[] = <<view->assign("{$fieldList}", \$this->model->{$methodName}()); EOD; } - protected function setAttr(&$setAttr, $field, $itemArr = '', $inputType = '') + protected function getAttr(&$getAttr, $field, $inputType = '') { - if (preg_match("/[_\-]+/", $field)) - { + if (!in_array($inputType, ['datetime', 'select', 'multiple', 'checkbox', 'radio'])) return; - } + $attrField = ucfirst($this->getCamelizeName($field)); + $getAttr[] = $this->getReplacedStub("mixins" . DS . $inputType, ['field' => $field, 'methodName' => "get{$attrField}TextAttr", 'listMethodName' => "get{$attrField}List"]); + } + + protected function setAttr(&$setAttr, $field, $inputType = '') + { if ($inputType != 'datetime') return; - $field = ucfirst($field); + $attrField = ucfirst($this->getCamelizeName($field)); if ($inputType == 'datetime') { $return = <<getStub($name)); + $stubname = $this->getStub($name); + if (isset($this->stubList[$stubname])) + { + $stub = $this->stubList[$stubname]; + } + else + { + $this->stubList[$stubname] = $stub = file_get_contents($stubname); + } $content = str_replace($search, $replace, $stub); return $content; } @@ -697,11 +716,29 @@ EOD; protected function getLangItem($field, $content) { - if (!Lang::has($field)) + if ($content || !Lang::has($field)) { - return << '{$content}' -EOD; + $itemArr = []; + if (stripos($content, ':') !== false && stripos($content, ',') && stripos($content, '=') !== false) + { + list($fieldLang, $item) = explode(':', $content); + $itemArr = [$field => $fieldLang]; + foreach (explode(',', $item) as $k => $v) + { + list($key, $value) = explode('=', $v); + $itemArr[$field . ' ' . $key] = $value; + } + } + else + { + $itemArr = [$field => $content]; + } + $resultArr = []; + foreach ($itemArr as $k => $v) + { + $resultArr[] = " '" . ucfirst($k) . "' => '{$v}'"; + } + return implode(",\n", $resultArr); } else { @@ -731,6 +768,8 @@ EOD; */ protected function getArrayString($arr) { + if (!is_array($arr)) + return $arr; $stringArr = []; foreach ($arr as $k => $v) { @@ -740,11 +779,34 @@ EOD; $v = str_replace("'", "\'", $v); $k = str_replace("'", "\'", $k); } - $stringArr[] = "'" . (is_numeric($k) ? $v : $k) . "' => " . (is_numeric($k) ? "__('" . ucfirst($k) . "')" : $is_var ? $v : "'{$v}'"); + $stringArr[] = "'" . $k . "' => " . ($is_var ? $v : "'{$v}'"); } return implode(",", $stringArr); } + protected function getItemArray($item, $field, $comment) + { + $itemArr = []; + if (stripos($comment, ':') !== false && stripos($comment, ',') && stripos($comment, '=') !== false) + { + list($fieldLang, $item) = explode(':', $comment); + $itemArr = []; + foreach (explode(',', $item) as $k => $v) + { + list($key, $value) = explode('=', $v); + $itemArr[$key] = $field . ' ' . $key; + } + } + else + { + foreach ($item as $k => $v) + { + $itemArr[$v] = is_numeric($v) ? $field . ' ' . $v : $v; + } + } + return $itemArr; + } + protected function getFieldType(& $v) { $inputType = 'text'; @@ -848,10 +910,10 @@ EOD; * @param string $field * @return string */ - protected function getJsColumn($field) + protected function getJsColumn($field, $datatype = '', $extend = '') { $lang = ucfirst($field); - $html = str_repeat(" ", 24) . "{field: '{$field}', title: __('{$lang}')"; + $html = str_repeat(" ", 24) . "{field: '{$field}{$extend}', title: __('{$lang}')"; $field = stripos($field, ".") !== false ? substr($field, stripos($field, '.') + 1) : $field; $formatter = ''; if ($field == 'status') @@ -860,17 +922,32 @@ EOD; $formatter = 'icon'; else if ($field == 'flag') $formatter = 'flag'; - else if (substr($field, -4) == 'time') + else if (substr($field, -4) == 'time' && in_array($datatype, ['int', 'timestamp'])) $formatter = 'datetime'; - else if (substr($field, -3) == 'url') + else if (substr($field, -3) == 'url' || substr($field, -4) == 'file') $formatter = 'url'; else if (substr($field, -5) == 'image') $formatter = 'image'; - if ($formatter) + else if (substr($field, -6) == 'images') + $formatter = 'images'; + if ($extend) + $html .= ", operate:false"; + if ($formatter && !$extend) $html .= ", formatter: Table.api.formatter." . $formatter . "}"; else $html .= "}"; return $html; } + protected function getCamelizeName($uncamelized_words, $separator = '_') + { + $uncamelized_words = $separator . str_replace($separator, " ", strtolower($uncamelized_words)); + return ltrim(str_replace(" ", "", ucwords($uncamelized_words)), $separator); + } + + protected function getFieldListName($field) + { + return $this->getCamelizeName($field) . 'List'; + } + } diff --git a/application/admin/command/Crud/stubs/controller.stub b/application/admin/command/Crud/stubs/controller.stub index 530b8629..2c9ca9ec 100644 --- a/application/admin/command/Crud/stubs/controller.stub +++ b/application/admin/command/Crud/stubs/controller.stub @@ -14,13 +14,24 @@ use think\Request; */ class {%controllerName%} extends Backend { - + + /** + * {%modelName%}模型对象 + */ protected $model = null; public function _initialize() { parent::_initialize(); $this->model = model('{%modelName%}'); +{%controllerAssignList%} } + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法 + * 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + {%controllerIndex%} } diff --git a/application/admin/command/Crud/stubs/html/checkbox.stub b/application/admin/command/Crud/stubs/html/checkbox.stub new file mode 100644 index 00000000..3861111a --- /dev/null +++ b/application/admin/command/Crud/stubs/html/checkbox.stub @@ -0,0 +1,4 @@ + + {foreach name="{%fieldList%}" item="vo"} + + {/foreach} diff --git a/application/admin/command/Crud/stubs/html/radio.stub b/application/admin/command/Crud/stubs/html/radio.stub new file mode 100644 index 00000000..54fc57b2 --- /dev/null +++ b/application/admin/command/Crud/stubs/html/radio.stub @@ -0,0 +1,4 @@ + + {foreach name="{%fieldList%}" item="vo"} + + {/foreach} diff --git a/application/admin/command/Crud/stubs/html/select.stub b/application/admin/command/Crud/stubs/html/select.stub new file mode 100644 index 00000000..b55baaaf --- /dev/null +++ b/application/admin/command/Crud/stubs/html/select.stub @@ -0,0 +1,6 @@ + + diff --git a/application/admin/command/Crud/stubs/mixins/checkbox.stub b/application/admin/command/Crud/stubs/mixins/checkbox.stub new file mode 100644 index 00000000..909adfd4 --- /dev/null +++ b/application/admin/command/Crud/stubs/mixins/checkbox.stub @@ -0,0 +1,8 @@ + + public function {%methodName%}($value, $data) + { + $value = $value ? $value : $data['{%field%}']; + $valueArr = explode(',', $value); + $list = $this->{%listMethodName%}(); + return implode(',', array_intersect_key($list, array_flip($valueArr))); + } \ No newline at end of file diff --git a/application/admin/command/Crud/stubs/mixins/datetime.stub b/application/admin/command/Crud/stubs/mixins/datetime.stub new file mode 100644 index 00000000..60da81f3 --- /dev/null +++ b/application/admin/command/Crud/stubs/mixins/datetime.stub @@ -0,0 +1,6 @@ + + public function {%methodName%}($value, $data) + { + $value = $value ? $value : $data['{%field%}']; + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } \ No newline at end of file diff --git a/application/admin/command/Crud/stubs/mixins/enum.stub b/application/admin/command/Crud/stubs/mixins/enum.stub new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/application/admin/command/Crud/stubs/mixins/enum.stub @@ -0,0 +1 @@ + diff --git a/application/admin/command/Crud/stubs/mixins/multiple.stub b/application/admin/command/Crud/stubs/mixins/multiple.stub new file mode 100644 index 00000000..909adfd4 --- /dev/null +++ b/application/admin/command/Crud/stubs/mixins/multiple.stub @@ -0,0 +1,8 @@ + + public function {%methodName%}($value, $data) + { + $value = $value ? $value : $data['{%field%}']; + $valueArr = explode(',', $value); + $list = $this->{%listMethodName%}(); + return implode(',', array_intersect_key($list, array_flip($valueArr))); + } \ No newline at end of file diff --git a/application/admin/command/Crud/stubs/mixins/radio.stub b/application/admin/command/Crud/stubs/mixins/radio.stub new file mode 100644 index 00000000..f5fa6e0d --- /dev/null +++ b/application/admin/command/Crud/stubs/mixins/radio.stub @@ -0,0 +1,7 @@ + + public function {%methodName%}($value, $data) + { + $value = $value ? $value : $data['{%field%}']; + $list = $this->{%listMethodName%}(); + return isset($list[$value]) ? $list[$value] : ''; + } \ No newline at end of file diff --git a/application/admin/command/Crud/stubs/mixins/select.stub b/application/admin/command/Crud/stubs/mixins/select.stub new file mode 100644 index 00000000..f5fa6e0d --- /dev/null +++ b/application/admin/command/Crud/stubs/mixins/select.stub @@ -0,0 +1,7 @@ + + public function {%methodName%}($value, $data) + { + $value = $value ? $value : $data['{%field%}']; + $list = $this->{%listMethodName%}(); + return isset($list[$value]) ? $list[$value] : ''; + } \ No newline at end of file diff --git a/application/admin/command/Crud/stubs/model.stub b/application/admin/command/Crud/stubs/model.stub index e470238b..79ed5074 100644 --- a/application/admin/command/Crud/stubs/model.stub +++ b/application/admin/command/Crud/stubs/model.stub @@ -21,6 +21,9 @@ class {%modelName%} extends Model {%appendAttrList%} ]; + +{%getEnumList%} + {%getAttrList%} {%setAttrList%} diff --git a/application/admin/command/Crud/stubs/validate.stub b/application/admin/command/Crud/stubs/validate.stub new file mode 100644 index 00000000..a2fe3809 --- /dev/null +++ b/application/admin/command/Crud/stubs/validate.stub @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/command/Install/fastadmin.sql b/application/admin/command/Install/fastadmin.sql index b5dc1f9c..1a0004d7 100644 --- a/application/admin/command/Install/fastadmin.sql +++ b/application/admin/command/Install/fastadmin.sql @@ -4,7 +4,7 @@ 官网: http://www.fastadmin.net 演示: http://demo.fastadmin.net - Date: 05/21/2017 14315:20 AM + Date: 06/14/2017 17:12:25 PM */ SET FOREIGN_KEY_CHECKS = 0; @@ -29,13 +29,13 @@ CREATE TABLE `fa_admin` ( `status` varchar(30) NOT NULL DEFAULT 'normal' COMMENT '状态', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='管理员表'; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='管理员表'; -- ---------------------------- -- Records of `fa_admin` -- ---------------------------- BEGIN; -INSERT INTO `fa_admin` VALUES ('1', 'admin', 'Admin', '075eaec83636846f51c152f29b98a2fd', 's4f3', '/assets/img/avatar.png', 'admin@fastadmin.net', '0', '0', '1492186163', '1495347600', '', 'normal'), ('2', 'admin2', 'admin2', '9a28ce07ce875fbd14172a9ca5357d3c', '2dHDmj', '/assets/img/avatar.png', 'admin2@fastadmin.net', '0', '0', '1492186163', '1492186163', '', 'normal'), ('3', 'admin3', 'admin3', '1c11f945dfcd808a130a8c2a8753fe62', 'WOKJEn', '/assets/img/avatar.png', 'admin3@fastadmin.net', '0', '0', '1492186201', '1492186201', '', 'normal'), ('4', 'admin22', 'admin22', '1c1a0aa0c3c56a8c1a908aab94519648', 'Aybcn5', '/assets/img/avatar.png', 'admin22@fastadmin.net', '0', '0', '1492186240', '1492186240', '', 'normal'), ('5', 'admin32', 'admin32', 'ade94d5d7a7033afa7d84ac3066d0a02', 'FvYK0u', '/assets/img/avatar.png', 'admin32@fastadmin.net', '0', '0', '1492186263', '1492186263', '', 'normal'); +INSERT INTO `fa_admin` VALUES ('1', 'admin', 'Admin', '075eaec83636846f51c152f29b98a2fd', 's4f3', '/assets/img/avatar.png', 'admin@fastadmin.net', '0', '1497070325', '1492186163', '1497070325', 'c586728f-0687-4e1a-84c0-c3b9f9003850', 'normal'), ('2', 'admin2', 'admin2', '9a28ce07ce875fbd14172a9ca5357d3c', '2dHDmj', '/assets/img/avatar.png', 'admin2@fastadmin.net', '0', '0', '1492186163', '1492186163', '', 'normal'), ('3', 'admin3', 'admin3', '1c11f945dfcd808a130a8c2a8753fe62', 'WOKJEn', '/assets/img/avatar.png', 'admin3@fastadmin.net', '0', '0', '1492186201', '1492186201', '', 'normal'), ('4', 'admin22', 'admin22', '1c1a0aa0c3c56a8c1a908aab94519648', 'Aybcn5', '/assets/img/avatar.png', 'admin22@fastadmin.net', '0', '0', '1492186240', '1492186240', '', 'normal'), ('5', 'admin32', 'admin32', 'ade94d5d7a7033afa7d84ac3066d0a02', 'FvYK0u', '/assets/img/avatar.png', 'admin32@fastadmin.net', '0', '0', '1492186263', '1492186263', '', 'normal'), ('6', 'test123', 'test', '2a9020e6ef15245399f00d5cda5fb1e6', 'unbBZH', '', 'test@163.com', '0', '1497062737', '1497062728', '1497070313', '', 'normal'); COMMIT; -- ---------------------------- @@ -54,7 +54,7 @@ CREATE TABLE `fa_admin_log` ( `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作时间', PRIMARY KEY (`id`), KEY `name` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='管理员日志表'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='管理员日志表'; -- ---------------------------- -- Table structure for `fa_article` @@ -74,7 +74,7 @@ CREATE TABLE `fa_article` ( `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', - `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', + `status` enum('normal','hidden') NOT NULL DEFAULT 'normal' COMMENT '状态', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='文章表'; @@ -99,7 +99,7 @@ CREATE TABLE `fa_attachment` ( `sha1` varchar(40) NOT NULL DEFAULT '' COMMENT '文件 sha1编码', PRIMARY KEY (`id`), UNIQUE KEY `sha1` (`sha1`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='附件表'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='附件表'; -- ---------------------------- -- Table structure for `fa_auth_group` @@ -120,7 +120,7 @@ CREATE TABLE `fa_auth_group` ( -- Records of `fa_auth_group` -- ---------------------------- BEGIN; -INSERT INTO `fa_auth_group` VALUES ('1', '0', '超级管理员', '*', '1490883540', '1490883540', 'normal'), ('2', '1', '二级管理员', '10400,10401,10402,10403,10404,10405,10406,10407,10408,10409,10410,10411,10412,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422,10423,10424,10425,10426,10427,10428,10429,10430,10431,10432,10433,10434,10435,10436,10437,10438,10439,10440,10441,10442,10443,10444,10445,10446,10447,10448,10449,10450,10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463', '1490883540', '1492186066', 'normal'), ('3', '2', '三级管理员', '10400,10401,10402,10403,10404,10405,10412,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422,10423,10424,10425,10426,10427,10428,10429,10430', '1490883540', '1492186072', 'normal'), ('4', '1', '二级管理员2', '10400,10401,10402,10403,10404,10405,10406,10407,10408,10409,10410,10411,10431,10432,10433,10434,10435,10436,10437,10438,10439,10440,10441,10442,10443,10444,10445,10446,10447,10448,10449,10450,10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466,10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482,10483,10484,10485,10486,10487,10488,10489,10490', '1490883540', '1492186059', 'normal'), ('5', '2', '三级管理员2', '10400,10401,10402,10403,10404,10405', '1490883540', '1492186095', 'normal'); +INSERT INTO `fa_auth_group` VALUES ('1', '0', '超级管理员', '*', '1490883540', '1490883540', 'normal'), ('2', '1', '二级管理员', '11180,11181,11182,11183,11184,11185,11198,11199,11200,11201,11202,11203,11204,11205,11206,11207,11208,11209,11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225,11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241,11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,11252,11253,11254,11255,11256,11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272,11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288,11289', '1490883540', '1497431170', 'normal'), ('3', '2', '三级管理员', '11180,11181,11182,11183,11184,11185,11198,11199,11200,11201,11202,11203,11204,11205,11206,11207,11208,11209,11210,11211,11212,11213,11214,11215,11216,11217', '1490883540', '1497431183', 'normal'), ('4', '1', '二级管理员2', '11174,11175,11176,11177,11178,11179,11180,11181,11182,11183,11184,11185,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304,11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,11315,11316', '1490883540', '1497431177', 'normal'), ('5', '2', '三级管理员2', '11180,11181,11182,11183,11184,11185,11218,11219,11220,11221,11222,11223,11224,11225,11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241,11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,11252,11253,11254,11255,11256,11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272,11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288,11289', '1490883540', '1497431190', 'normal'); COMMIT; -- ---------------------------- @@ -139,7 +139,7 @@ CREATE TABLE `fa_auth_group_access` ( -- Records of `fa_auth_group_access` -- ---------------------------- BEGIN; -INSERT INTO `fa_auth_group_access` VALUES ('1', '1'), ('2', '2'), ('3', '3'), ('4', '5'), ('5', '5'); +INSERT INTO `fa_auth_group_access` VALUES ('1', '1'), ('2', '2'), ('3', '3'), ('4', '5'), ('5', '5'), ('6', '2'); COMMIT; -- ---------------------------- @@ -164,13 +164,13 @@ CREATE TABLE `fa_auth_rule` ( UNIQUE KEY `name` (`name`) USING BTREE, KEY `pid` (`pid`), KEY `weigh` (`weigh`) -) ENGINE=InnoDB AUTO_INCREMENT=10537 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='节点表'; +) ENGINE=InnoDB AUTO_INCREMENT=11317 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='节点表'; -- ---------------------------- -- Records of `fa_auth_rule` -- ---------------------------- BEGIN; -INSERT INTO `fa_auth_rule` VALUES ('10400', 'file', '0', '/admin/dashboard', '控制台', 'fa fa-dashboard', '', '用于展示当前系统中的统计数据、统计报表及重要实时数据\r\n', '1', '1491655325', '1492184975', '137', 'normal'), ('10401', 'file', '10400', '/admin/dashboard/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '136', 'normal'), ('10402', 'file', '10400', '/admin/dashboard/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '135', 'normal'), ('10403', 'file', '10400', '/admin/dashboard/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '134', 'normal'), ('10404', 'file', '10400', '/admin/dashboard/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '133', 'normal'), ('10405', 'file', '10400', '/admin/dashboard/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '132', 'normal'), ('10406', 'file', '0', '/admin/page', '单页管理', 'fa fa-tags', '', '用于管理普通的单页面,通常用于关于我们、联系我们、商务合作等单一页面\r\n', '1', '1491655325', '1494259768', '73', 'normal'), ('10407', 'file', '10406', '/admin/page/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '130', 'normal'), ('10408', 'file', '10406', '/admin/page/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '129', 'normal'), ('10409', 'file', '10406', '/admin/page/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '128', 'normal'), ('10410', 'file', '10406', '/admin/page/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '127', 'normal'), ('10411', 'file', '10406', '/admin/page/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '126', 'normal'), ('10412', 'file', '0', '/admin/auth', '权限管理', 'fa fa-group', '', '', '1', '1491655325', '1494259815', '46', 'normal'), ('10413', 'file', '10412', '/admin/auth/admin', '管理员管理', 'fa fa-users', '', '一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成', '1', '1491655325', '1491655325', '124', 'normal'), ('10414', 'file', '10413', '/admin/auth/admin/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '123', 'normal'), ('10415', 'file', '10413', '/admin/auth/admin/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '122', 'normal'), ('10416', 'file', '10413', '/admin/auth/admin/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '121', 'normal'), ('10417', 'file', '10413', '/admin/auth/admin/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '120', 'normal'), ('10418', 'file', '10413', '/admin/auth/admin/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '119', 'normal'), ('10419', 'file', '10412', '/admin/auth/group', '角色组', 'fa fa-group', '', '角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别下级的角色组或管理员', '1', '1491655325', '1491655325', '118', 'normal'), ('10420', 'file', '10419', '/admin/auth/group/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '117', 'normal'), ('10421', 'file', '10419', '/admin/auth/group/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '116', 'normal'), ('10422', 'file', '10419', '/admin/auth/group/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '115', 'normal'), ('10423', 'file', '10419', '/admin/auth/group/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '114', 'normal'), ('10424', 'file', '10419', '/admin/auth/group/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '113', 'normal'), ('10425', 'file', '10412', '/admin/auth/rule', '规则管理', 'fa fa-list', '', '规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过控制台进行生成规则节点', '1', '1491655325', '1491655325', '112', 'normal'), ('10426', 'file', '10425', '/admin/auth/rule/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '111', 'normal'), ('10427', 'file', '10425', '/admin/auth/rule/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '110', 'normal'), ('10428', 'file', '10425', '/admin/auth/rule/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '109', 'normal'), ('10429', 'file', '10425', '/admin/auth/rule/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '108', 'normal'), ('10430', 'file', '10425', '/admin/auth/rule/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '107', 'normal'), ('10431', 'file', '0', '/admin/general', '常规管理', 'fa fa-cog', '', '', '1', '1491655325', '1494259697', '131', 'normal'), ('10432', 'file', '10431', '/admin/general/attachment', '附件管理', 'fa fa-circle-o\r', '', '主要用于管理上传到又拍云的数据或上传至本服务的上传数据\r', '1', '1491655325', '1491655325', '80', 'normal'), ('10433', 'file', '10432', '/admin/general/attachment/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '104', 'normal'), ('10434', 'file', '10432', '/admin/general/attachment/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '103', 'normal'), ('10435', 'file', '10432', '/admin/general/attachment/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '102', 'normal'), ('10436', 'file', '10432', '/admin/general/attachment/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '101', 'normal'), ('10437', 'file', '10432', '/admin/general/attachment/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '100', 'normal'), ('10438', 'file', '10431', '/admin/general/configvalue', '基本配置', 'fa fa-cog', '', '用于管理一些字典数据,通常以键值格式进行录入,保存的数据格式为JSON', '1', '1491655325', '1491655325', '105', 'normal'), ('10439', 'file', '10438', '/admin/general/configvalue/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '98', 'normal'), ('10440', 'file', '10438', '/admin/general/configvalue/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '97', 'normal'), ('10441', 'file', '10438', '/admin/general/configvalue/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '96', 'normal'), ('10442', 'file', '10438', '/admin/general/configvalue/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '95', 'normal'), ('10443', 'file', '10438', '/admin/general/configvalue/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '94', 'normal'), ('10444', 'file', '10431', '/admin/general/crontab', '定时任务', 'fa fa-tasks', '', '类似于Linux的Crontab定时任务,可以按照设定的时间进行任务的执行,目前仅支持三种任务:请求URL、执行SQL、执行Shell', '1', '1491655325', '1491655325', '99', 'normal'), ('10445', 'file', '10444', '/admin/general/crontab/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '92', 'normal'), ('10446', 'file', '10444', '/admin/general/crontab/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '91', 'normal'), ('10447', 'file', '10444', '/admin/general/crontab/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '90', 'normal'), ('10448', 'file', '10444', '/admin/general/crontab/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '89', 'normal'), ('10449', 'file', '10444', '/admin/general/crontab/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '88', 'normal'), ('10450', 'file', '10431', '/admin/general/database', '数据库管理', 'fa fa-database', '', '可在线进行一些简单的数据库表优化或修复,查看表结构和数据。也可以进行SQL语句的操作', '1', '1491655325', '1491655325', '93', 'normal'), ('10451', 'file', '10450', '/admin/general/database/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '86', 'normal'), ('10452', 'file', '10450', '/admin/general/database/query', 'SQL查询', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '85', 'normal'), ('10453', 'file', '10450', '/admin/general/database/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '84', 'normal'), ('10454', 'file', '10450', '/admin/general/database/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '83', 'normal'), ('10455', 'file', '10450', '/admin/general/database/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '82', 'normal'), ('10456', 'file', '10450', '/admin/general/database/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '81', 'normal'), ('10457', 'file', '10431', '/admin/general/profile', '个人配置', 'fa fa-user\r', '', '', '1', '1491655325', '1491655325', '87', 'normal'), ('10458', 'file', '10457', '/admin/general/profile/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '79', 'normal'), ('10459', 'file', '10457', '/admin/general/profile/update', '更新个人信息', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '78', 'normal'), ('10460', 'file', '10457', '/admin/general/profile/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '77', 'normal'), ('10461', 'file', '10457', '/admin/general/profile/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '76', 'normal'), ('10462', 'file', '10457', '/admin/general/profile/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '75', 'normal'), ('10463', 'file', '10457', '/admin/general/profile/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '74', 'normal'), ('10464', 'file', '0', '/admin/wechat', '微信管理', 'fa fa-wechat', '', '', '1', '1491655325', '1494259718', '40', 'normal'), ('10465', 'file', '10464', '/admin/wechat/autoreply', '微信自动回复管理', 'fa fa-circle-o\r', '', '', '1', '1491655325', '1491655325', '72', 'normal'), ('10466', 'file', '10465', '/admin/wechat/autoreply/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '71', 'normal'), ('10467', 'file', '10465', '/admin/wechat/autoreply/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '70', 'normal'), ('10468', 'file', '10465', '/admin/wechat/autoreply/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '69', 'normal'), ('10469', 'file', '10465', '/admin/wechat/autoreply/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '68', 'normal'), ('10470', 'file', '10465', '/admin/wechat/autoreply/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '67', 'normal'), ('10471', 'file', '10464', '/admin/wechat/config', '配置管理', 'fa fa-list-alt', '', '', '1', '1491655325', '1491655325', '66', 'normal'), ('10472', 'file', '10471', '/admin/wechat/config/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '65', 'normal'), ('10473', 'file', '10471', '/admin/wechat/config/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '64', 'normal'), ('10474', 'file', '10471', '/admin/wechat/config/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '63', 'normal'), ('10475', 'file', '10471', '/admin/wechat/config/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '62', 'normal'), ('10476', 'file', '10471', '/admin/wechat/config/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '61', 'normal'), ('10477', 'file', '10464', '/admin/wechat/menu', '菜单管理', 'fa fa-list-alt', '', '', '1', '1491655325', '1491655325', '60', 'normal'), ('10478', 'file', '10477', '/admin/wechat/menu/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '59', 'normal'), ('10479', 'file', '10477', '/admin/wechat/menu/edit', '修改', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '58', 'normal'), ('10480', 'file', '10477', '/admin/wechat/menu/sync', '同步', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '57', 'normal'), ('10481', 'file', '10477', '/admin/wechat/menu/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '56', 'normal'), ('10482', 'file', '10477', '/admin/wechat/menu/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '55', 'normal'), ('10483', 'file', '10477', '/admin/wechat/menu/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '54', 'normal'), ('10484', 'file', '10464', '/admin/wechat/response', '资源管理', 'fa fa-list-alt', '', '', '1', '1491655325', '1491655325', '53', 'normal'), ('10485', 'file', '10484', '/admin/wechat/response/select', '选择素材', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '52', 'normal'), ('10486', 'file', '10484', '/admin/wechat/response/add', '添加', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '51', 'normal'), ('10487', 'file', '10484', '/admin/wechat/response/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '50', 'normal'), ('10488', 'file', '10484', '/admin/wechat/response/index', '查看', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '49', 'normal'), ('10489', 'file', '10484', '/admin/wechat/response/del', '删除', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '48', 'normal'), ('10490', 'file', '10484', '/admin/wechat/response/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1491655325', '1491655325', '47', 'normal'), ('10491', 'file', '0', '/admin/category', '分类管理', 'fa fa-list\r', '', '用于统一管理网站的所有分类,分类可进行无限级分类\r', '1', '1494259006', '1494259006', '106', 'normal'), ('10492', 'file', '10491', '/admin/category/index', '查看', 'fa fa-circle-o', '', '', '0', '1494259006', '1494259006', '45', 'normal'), ('10493', 'file', '10491', '/admin/category/add', '添加', 'fa fa-circle-o', '', '', '0', '1494259006', '1494259006', '44', 'normal'), ('10494', 'file', '10491', '/admin/category/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1494259006', '1494259006', '43', 'normal'), ('10495', 'file', '10491', '/admin/category/del', '删除', 'fa fa-circle-o', '', '', '0', '1494259006', '1494259006', '42', 'normal'), ('10496', 'file', '10491', '/admin/category/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1494259006', '1494259006', '41', 'normal'), ('10497', 'file', '0', '/admin/example', '示例管理', 'fa fa-magic', '', '', '1', '1495273225', '1495273469', '125', 'normal'), ('10498', 'file', '10497', '/admin/example/bootstraptable', '表格完整示例', 'fa fa-table', '', '在使用Bootstrap-table中的常用方式,更多使用方式可查看:http://bootstrap-table.wenzhixin.net.cn/zh-cn/', '1', '1495273225', '1495273225', '39', 'normal'), ('10499', 'file', '10498', '/admin/example/bootstraptable/index', '查看', 'fa fa-circle-o', '', '', '0', '1495273225', '1495273225', '38', 'normal'), ('10500', 'file', '10498', '/admin/example/bootstraptable/detail', '详情', 'fa fa-circle-o', '', '', '0', '1495273225', '1495273225', '37', 'normal'), ('10501', 'file', '10498', '/admin/example/bootstraptable/add', '添加', 'fa fa-circle-o', '', '', '0', '1495273225', '1495273225', '36', 'normal'), ('10502', 'file', '10498', '/admin/example/bootstraptable/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1495273225', '1495273225', '35', 'normal'), ('10503', 'file', '10498', '/admin/example/bootstraptable/del', '删除', 'fa fa-circle-o', '', '', '0', '1495273225', '1495273225', '34', 'normal'), ('10504', 'file', '10498', '/admin/example/bootstraptable/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1495273225', '1495273225', '33', 'normal'), ('10505', 'file', '10497', '/admin/example/colorbadge', '彩色角标', 'fa fa-table', '', '在JS端控制角标的显示与隐藏,请注意左侧菜单栏角标的数值变化', '1', '1495273229', '1495273229', '32', 'normal'), ('10506', 'file', '10505', '/admin/example/colorbadge/index', '查看', 'fa fa-circle-o', '', '', '0', '1495273229', '1495273229', '31', 'normal'), ('10507', 'file', '10505', '/admin/example/colorbadge/add', '添加', 'fa fa-circle-o', '', '', '0', '1495273229', '1495273229', '30', 'normal'), ('10508', 'file', '10505', '/admin/example/colorbadge/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1495273229', '1495273229', '29', 'normal'), ('10509', 'file', '10505', '/admin/example/colorbadge/del', '删除', 'fa fa-circle-o', '', '', '0', '1495273229', '1495273229', '28', 'normal'), ('10510', 'file', '10505', '/admin/example/colorbadge/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1495273229', '1495273229', '27', 'normal'), ('10511', 'file', '10497', '/admin/example/controllerjump', '控制器间跳转', 'fa fa-table', '', 'FastAdmin支持在控制器间跳转,点击后将切换到另外一个TAB中,无需刷新当前页面', '1', '1495273234', '1495273234', '26', 'normal'), ('10512', 'file', '10511', '/admin/example/controllerjump/index', '查看', 'fa fa-circle-o', '', '', '0', '1495273234', '1495273234', '25', 'normal'), ('10513', 'file', '10511', '/admin/example/controllerjump/add', '添加', 'fa fa-circle-o', '', '', '0', '1495273234', '1495273234', '24', 'normal'), ('10514', 'file', '10511', '/admin/example/controllerjump/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1495273234', '1495273234', '23', 'normal'), ('10515', 'file', '10511', '/admin/example/controllerjump/del', '删除', 'fa fa-circle-o', '', '', '0', '1495273234', '1495273234', '22', 'normal'), ('10516', 'file', '10511', '/admin/example/controllerjump/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1495273234', '1495273234', '21', 'normal'), ('10517', 'file', '10497', '/admin/example/cxselect', '多级联动', 'fa fa-table', '', 'FastAdmin使用了jQuery-cxselect实现多级联动,更多文档请参考https://github.com/karsonzhang/cxSelect
', '1', '1495273239', '1495273239', '20', 'normal'), ('10518', 'file', '10517', '/admin/example/cxselect/index', 'index', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '19', 'normal'), ('10519', 'file', '10517', '/admin/example/cxselect/city', 'city', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '18', 'normal'), ('10520', 'file', '10517', '/admin/example/cxselect/category', 'category', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '17', 'normal'), ('10521', 'file', '10517', '/admin/example/cxselect/add', '添加', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '16', 'normal'), ('10522', 'file', '10517', '/admin/example/cxselect/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '15', 'normal'), ('10523', 'file', '10517', '/admin/example/cxselect/del', '删除', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '14', 'normal'), ('10524', 'file', '10517', '/admin/example/cxselect/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1495273239', '1495273239', '13', 'normal'), ('10525', 'file', '10497', '/admin/example/multitable', '多表格示例', 'fa fa-table', '', '当一个页面上存在多个Bootstrap-table时该如何控制按钮和表格', '1', '1495273245', '1495273245', '12', 'normal'), ('10526', 'file', '10525', '/admin/example/multitable/index', '查看', 'fa fa-circle-o', '', '', '0', '1495273245', '1495273245', '11', 'normal'), ('10527', 'file', '10525', '/admin/example/multitable/add', '添加', 'fa fa-circle-o', '', '', '0', '1495273245', '1495273245', '10', 'normal'), ('10528', 'file', '10525', '/admin/example/multitable/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1495273245', '1495273245', '9', 'normal'), ('10529', 'file', '10525', '/admin/example/multitable/del', '删除', 'fa fa-circle-o', '', '', '0', '1495273245', '1495273245', '8', 'normal'), ('10530', 'file', '10525', '/admin/example/multitable/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1495273245', '1495273245', '7', 'normal'), ('10531', 'file', '10497', '/admin/example/relationmodel', '多模型关联', 'fa fa-table', '', '当使用到关联模型时需要重载index方法', '1', '1495273250', '1495273250', '6', 'normal'), ('10532', 'file', '10531', '/admin/example/relationmodel/index', '查看', 'fa fa-circle-o', '', '', '0', '1495273250', '1495273250', '5', 'normal'), ('10533', 'file', '10531', '/admin/example/relationmodel/add', '添加', 'fa fa-circle-o', '', '', '0', '1495273250', '1495273250', '4', 'normal'), ('10534', 'file', '10531', '/admin/example/relationmodel/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1495273250', '1495273250', '3', 'normal'), ('10535', 'file', '10531', '/admin/example/relationmodel/del', '删除', 'fa fa-circle-o', '', '', '0', '1495273250', '1495273250', '2', 'normal'), ('10536', 'file', '10531', '/admin/example/relationmodel/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1495273250', '1495273250', '1', 'normal'), ('10537', 'file', '10412', '/admin/auth/adminlog', '管理员日志', 'fa fa-users', '', '管理员可以查看自己所拥有的权限的管理员日志', '1', '1497015405', '1497015405', '0', 'normal'), ('10538', 'file', '10537', '/admin/auth/adminlog/index', '查看', 'fa fa-circle-o', '', '', '0', '1497015405', '1497015405', '0', 'normal'), ('10539', 'file', '10537', '/admin/auth/adminlog/detail', '详情', 'fa fa-circle-o', '', '', '0', '1497015405', '1497015405', '0', 'normal'), ('10540', 'file', '10537', '/admin/auth/adminlog/del', '删除', 'fa fa-circle-o', '', '', '0', '1497015405', '1497015405', '0', 'normal'); +INSERT INTO `fa_auth_rule` VALUES ('11174', 'file', '0', '/admin/category', '分类管理', 'fa fa-list\r', '', '用于统一管理网站的所有分类,分类可进行无限级分类\r', '1', '1497429920', '1497429920', '119', 'normal'), ('11175', 'file', '11174', '/admin/category/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '142', 'normal'), ('11176', 'file', '11174', '/admin/category/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '141', 'normal'), ('11177', 'file', '11174', '/admin/category/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '140', 'normal'), ('11178', 'file', '11174', '/admin/category/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '139', 'normal'), ('11179', 'file', '11174', '/admin/category/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '138', 'normal'), ('11180', 'file', '0', '/admin/dashboard', '控制台', 'fa fa-dashboard\r', '', '用于展示当前系统中的统计数据、统计报表及重要实时数据\r', '1', '1497429920', '1497429920', '143', 'normal'), ('11181', 'file', '11180', '/admin/dashboard/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '136', 'normal'), ('11182', 'file', '11180', '/admin/dashboard/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '135', 'normal'), ('11183', 'file', '11180', '/admin/dashboard/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '134', 'normal'), ('11184', 'file', '11180', '/admin/dashboard/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '133', 'normal'), ('11185', 'file', '11180', '/admin/dashboard/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '132', 'normal'), ('11186', 'file', '0', '/admin/page', '单页管理', 'fa fa-tags', '', '用于管理普通的单页面,通常用于关于我们、联系我们、商务合作等单一页面\r\n', '1', '1497429920', '1497430149', '125', 'normal'), ('11187', 'file', '11186', '/admin/page/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '130', 'normal'), ('11188', 'file', '11186', '/admin/page/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '129', 'normal'), ('11189', 'file', '11186', '/admin/page/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '128', 'normal'), ('11190', 'file', '11186', '/admin/page/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '127', 'normal'), ('11191', 'file', '11186', '/admin/page/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '126', 'normal'), ('11192', 'file', '0', '/admin/version', '版本管理', 'fa fa-file-text-o', '', '', '1', '1497429920', '1497430600', '27', 'normal'), ('11193', 'file', '11192', '/admin/version/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '124', 'normal'), ('11194', 'file', '11192', '/admin/version/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '123', 'normal'), ('11195', 'file', '11192', '/admin/version/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '122', 'normal'), ('11196', 'file', '11192', '/admin/version/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '121', 'normal'), ('11197', 'file', '11192', '/admin/version/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '120', 'normal'), ('11198', 'file', '0', '/admin/auth', '权限管理', 'fa fa-group', '', '', '1', '1497429920', '1497430092', '99', 'normal'), ('11199', 'file', '11198', '/admin/auth/admin', '管理员管理', 'fa fa-user', '', '一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成', '1', '1497429920', '1497430320', '118', 'normal'), ('11200', 'file', '11199', '/admin/auth/admin/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '117', 'normal'), ('11201', 'file', '11199', '/admin/auth/admin/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '116', 'normal'), ('11202', 'file', '11199', '/admin/auth/admin/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '115', 'normal'), ('11203', 'file', '11199', '/admin/auth/admin/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '114', 'normal'), ('11204', 'file', '11198', '/admin/auth/adminlog', '管理员日志', 'fa fa-list-alt', '', '管理员可以查看自己所拥有的权限的管理员日志', '1', '1497429920', '1497430307', '113', 'normal'), ('11205', 'file', '11204', '/admin/auth/adminlog/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '112', 'normal'), ('11206', 'file', '11204', '/admin/auth/adminlog/detail', '详情', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '111', 'normal'), ('11207', 'file', '11204', '/admin/auth/adminlog/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '110', 'normal'), ('11208', 'file', '11198', '/admin/auth/group', '角色组', 'fa fa-group', '', '角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别下级的角色组或管理员', '1', '1497429920', '1497429920', '109', 'normal'), ('11209', 'file', '11208', '/admin/auth/group/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '108', 'normal'), ('11210', 'file', '11208', '/admin/auth/group/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '107', 'normal'), ('11211', 'file', '11208', '/admin/auth/group/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '106', 'normal'), ('11212', 'file', '11208', '/admin/auth/group/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '105', 'normal'), ('11213', 'file', '11198', '/admin/auth/rule', '规则管理', 'fa fa-bars', '', '规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过控制台进行生成规则节点', '1', '1497429920', '1497430581', '104', 'normal'), ('11214', 'file', '11213', '/admin/auth/rule/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '103', 'normal'), ('11215', 'file', '11213', '/admin/auth/rule/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '102', 'normal'), ('11216', 'file', '11213', '/admin/auth/rule/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '101', 'normal'), ('11217', 'file', '11213', '/admin/auth/rule/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '100', 'normal'), ('11218', 'file', '0', '/admin/example', '示例管理', 'fa fa-magic', '', '', '1', '1497429920', '1497430123', '131', 'normal'), ('11219', 'file', '11218', '/admin/example/bootstraptable', '表格完整示例', 'fa fa-table', '', '在使用Bootstrap-table中的常用方式,更多使用方式可查看:http://bootstrap-table.wenzhixin.net.cn/zh-cn/', '1', '1497429920', '1497429920', '98', 'normal'), ('11220', 'file', '11219', '/admin/example/bootstraptable/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '97', 'normal'), ('11221', 'file', '11219', '/admin/example/bootstraptable/detail', '详情', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '96', 'normal'), ('11222', 'file', '11219', '/admin/example/bootstraptable/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '95', 'normal'), ('11223', 'file', '11219', '/admin/example/bootstraptable/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '94', 'normal'), ('11224', 'file', '11219', '/admin/example/bootstraptable/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '93', 'normal'), ('11225', 'file', '11219', '/admin/example/bootstraptable/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '92', 'normal'), ('11226', 'file', '11218', '/admin/example/colorbadge', '彩色角标', 'fa fa-table', '', '在JS端控制角标的显示与隐藏,请注意左侧菜单栏角标的数值变化', '1', '1497429920', '1497429920', '91', 'normal'), ('11227', 'file', '11226', '/admin/example/colorbadge/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '90', 'normal'), ('11228', 'file', '11226', '/admin/example/colorbadge/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '89', 'normal'), ('11229', 'file', '11226', '/admin/example/colorbadge/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '88', 'normal'), ('11230', 'file', '11226', '/admin/example/colorbadge/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '87', 'normal'), ('11231', 'file', '11226', '/admin/example/colorbadge/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '86', 'normal'), ('11232', 'file', '11218', '/admin/example/controllerjump', '控制器间跳转', 'fa fa-table', '', 'FastAdmin支持在控制器间跳转,点击后将切换到另外一个TAB中,无需刷新当前页面', '1', '1497429920', '1497429920', '85', 'normal'), ('11233', 'file', '11232', '/admin/example/controllerjump/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '84', 'normal'), ('11234', 'file', '11232', '/admin/example/controllerjump/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '83', 'normal'), ('11235', 'file', '11232', '/admin/example/controllerjump/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '82', 'normal'), ('11236', 'file', '11232', '/admin/example/controllerjump/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '81', 'normal'), ('11237', 'file', '11232', '/admin/example/controllerjump/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '80', 'normal'), ('11238', 'file', '11218', '/admin/example/cxselect', '多级联动', 'fa fa-table', '', 'FastAdmin使用了jQuery-cxselect实现多级联动,更多文档请参考https://github.com/karsonzhang/cxSelect', '1', '1497429920', '1497429920', '79', 'normal'), ('11239', 'file', '11238', '/admin/example/cxselect/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '78', 'normal'), ('11240', 'file', '11238', '/admin/example/cxselect/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '77', 'normal'), ('11241', 'file', '11238', '/admin/example/cxselect/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '76', 'normal'), ('11242', 'file', '11238', '/admin/example/cxselect/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '75', 'normal'), ('11243', 'file', '11238', '/admin/example/cxselect/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '74', 'normal'), ('11244', 'file', '11218', '/admin/example/multitable', '多表格示例', 'fa fa-table', '', '当一个页面上存在多个Bootstrap-table时该如何控制按钮和表格', '1', '1497429920', '1497429920', '73', 'normal'), ('11245', 'file', '11244', '/admin/example/multitable/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '72', 'normal'), ('11246', 'file', '11244', '/admin/example/multitable/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '71', 'normal'), ('11247', 'file', '11244', '/admin/example/multitable/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '70', 'normal'), ('11248', 'file', '11244', '/admin/example/multitable/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '69', 'normal'), ('11249', 'file', '11244', '/admin/example/multitable/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '68', 'normal'), ('11250', 'file', '11218', '/admin/example/relationmodel', '多模型关联', 'fa fa-table', '', '当使用到关联模型时需要重载index方法', '1', '1497429920', '1497429920', '67', 'normal'), ('11251', 'file', '11250', '/admin/example/relationmodel/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '66', 'normal'), ('11252', 'file', '11250', '/admin/example/relationmodel/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '65', 'normal'), ('11253', 'file', '11250', '/admin/example/relationmodel/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '64', 'normal'), ('11254', 'file', '11250', '/admin/example/relationmodel/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '63', 'normal'), ('11255', 'file', '11250', '/admin/example/relationmodel/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '62', 'normal'), ('11256', 'file', '0', '/admin/general', '常规管理', 'fa fa-cogs', '', '', '1', '1497429920', '1497430169', '137', 'normal'), ('11257', 'file', '11256', '/admin/general/attachment', '附件管理', 'fa fa-file-image-o', '', '主要用于管理上传到又拍云的数据或上传至本服务的上传数据\r\n', '1', '1497429920', '1497430699', '53', 'normal'), ('11258', 'file', '11257', '/admin/general/attachment/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '59', 'normal'), ('11259', 'file', '11257', '/admin/general/attachment/select', '选择附件', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '58', 'normal'), ('11260', 'file', '11257', '/admin/general/attachment/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '57', 'normal'), ('11261', 'file', '11257', '/admin/general/attachment/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '56', 'normal'), ('11262', 'file', '11257', '/admin/general/attachment/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '55', 'normal'), ('11263', 'file', '11257', '/admin/general/attachment/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '54', 'normal'), ('11264', 'file', '11256', '/admin/general/config', '系统配置', 'fa fa-cog', '', '', '1', '1497429920', '1497430683', '60', 'normal'), ('11265', 'file', '11264', '/admin/general/config/index', 'index', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '52', 'normal'), ('11266', 'file', '11264', '/admin/general/config/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '51', 'normal'), ('11267', 'file', '11264', '/admin/general/config/edit', 'edit', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '50', 'normal'), ('11268', 'file', '11264', '/admin/general/config/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '49', 'normal'), ('11269', 'file', '11264', '/admin/general/config/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '48', 'normal'), ('11270', 'file', '11256', '/admin/general/crontab', '定时任务', 'fa fa-tasks', '', '类似于Linux的Crontab定时任务,可以按照设定的时间进行任务的执行,目前仅支持三种任务:请求URL、执行SQL、执行Shell', '1', '1497429920', '1497429920', '47', 'normal'), ('11271', 'file', '11270', '/admin/general/crontab/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '46', 'normal'), ('11272', 'file', '11270', '/admin/general/crontab/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '45', 'normal'), ('11273', 'file', '11270', '/admin/general/crontab/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '44', 'normal'), ('11274', 'file', '11270', '/admin/general/crontab/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '43', 'normal'), ('11275', 'file', '11270', '/admin/general/crontab/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '42', 'normal'), ('11276', 'file', '11256', '/admin/general/database', '数据库管理', 'fa fa-database', '', '可在线进行一些简单的数据库表优化或修复,查看表结构和数据。也可以进行SQL语句的操作', '1', '1497429920', '1497429920', '41', 'normal'), ('11277', 'file', '11276', '/admin/general/database/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '40', 'normal'), ('11278', 'file', '11276', '/admin/general/database/query', 'SQL查询', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '39', 'normal'), ('11279', 'file', '11276', '/admin/general/database/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '38', 'normal'), ('11280', 'file', '11276', '/admin/general/database/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '37', 'normal'), ('11281', 'file', '11276', '/admin/general/database/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '36', 'normal'), ('11282', 'file', '11276', '/admin/general/database/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '35', 'normal'), ('11283', 'file', '11256', '/admin/general/profile', '个人配置', 'fa fa-user\r', '', '', '1', '1497429920', '1497429920', '34', 'normal'), ('11284', 'file', '11283', '/admin/general/profile/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '33', 'normal'), ('11285', 'file', '11283', '/admin/general/profile/update', '更新个人信息', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '32', 'normal'), ('11286', 'file', '11283', '/admin/general/profile/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '31', 'normal'), ('11287', 'file', '11283', '/admin/general/profile/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '30', 'normal'), ('11288', 'file', '11283', '/admin/general/profile/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '29', 'normal'), ('11289', 'file', '11283', '/admin/general/profile/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '28', 'normal'), ('11290', 'file', '0', '/admin/wechat', '微信管理', 'fa fa-wechat', '', '', '1', '1497429920', '1497430064', '61', 'normal'), ('11291', 'file', '11290', '/admin/wechat/autoreply', '微信自动回复管理', 'fa fa-reply-all', '', '', '1', '1497429920', '1497430619', '26', 'normal'), ('11292', 'file', '11291', '/admin/wechat/autoreply/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '25', 'normal'), ('11293', 'file', '11291', '/admin/wechat/autoreply/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '24', 'normal'), ('11294', 'file', '11291', '/admin/wechat/autoreply/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '23', 'normal'), ('11295', 'file', '11291', '/admin/wechat/autoreply/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '22', 'normal'), ('11296', 'file', '11291', '/admin/wechat/autoreply/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '21', 'normal'), ('11297', 'file', '11290', '/admin/wechat/config', '微信配置管理', 'fa fa-cog', '', '', '1', '1497429920', '1497430632', '20', 'normal'), ('11298', 'file', '11297', '/admin/wechat/config/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '19', 'normal'), ('11299', 'file', '11297', '/admin/wechat/config/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '18', 'normal'), ('11300', 'file', '11297', '/admin/wechat/config/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '17', 'normal'), ('11301', 'file', '11297', '/admin/wechat/config/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '16', 'normal'), ('11302', 'file', '11297', '/admin/wechat/config/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '15', 'normal'), ('11303', 'file', '11290', '/admin/wechat/menu', '菜单管理', 'fa fa-bars', '', '', '1', '1497429920', '1497430652', '14', 'normal'), ('11304', 'file', '11303', '/admin/wechat/menu/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '13', 'normal'), ('11305', 'file', '11303', '/admin/wechat/menu/edit', '修改', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '12', 'normal'), ('11306', 'file', '11303', '/admin/wechat/menu/sync', '同步', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '11', 'normal'), ('11307', 'file', '11303', '/admin/wechat/menu/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '10', 'normal'), ('11308', 'file', '11303', '/admin/wechat/menu/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '9', 'normal'), ('11309', 'file', '11303', '/admin/wechat/menu/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '8', 'normal'), ('11310', 'file', '11290', '/admin/wechat/response', '资源管理', 'fa fa-list-alt', '', '', '1', '1497429920', '1497429920', '7', 'normal'), ('11311', 'file', '11310', '/admin/wechat/response/select', '选择素材', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '6', 'normal'), ('11312', 'file', '11310', '/admin/wechat/response/add', '添加', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '5', 'normal'), ('11313', 'file', '11310', '/admin/wechat/response/edit', '编辑', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '4', 'normal'), ('11314', 'file', '11310', '/admin/wechat/response/index', '查看', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '3', 'normal'), ('11315', 'file', '11310', '/admin/wechat/response/del', '删除', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '2', 'normal'), ('11316', 'file', '11310', '/admin/wechat/response/multi', '批量更新', 'fa fa-circle-o', '', '', '0', '1497429920', '1497429920', '1', 'normal'); COMMIT; -- ---------------------------- @@ -195,7 +195,7 @@ CREATE TABLE `fa_category` ( PRIMARY KEY (`id`), KEY `weigh` (`weigh`,`id`), KEY `pid` (`pid`) -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='分类表'; +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='分类表'; -- ---------------------------- -- Records of `fa_category` @@ -204,6 +204,32 @@ BEGIN; INSERT INTO `fa_category` VALUES ('1', '0', 'page', '官方新闻', 'news', 'recommend', '', '', '', 'news', '1495262190', '1495262190', '0', 'normal'), ('2', '0', 'page', '移动应用', 'mobileapp', 'hot', '', '', '', 'mobileapp', '1495262244', '1495262244', '0', 'normal'), ('3', '2', 'page', '微信公众号', 'wechatpublic', 'index', '', '', '', 'wechatpublic', '1495262288', '1495262288', '0', 'normal'), ('4', '2', 'page', 'Android开发', 'android', 'recommend', '', '', '', 'android', '1495262317', '1495262317', '0', 'normal'), ('5', '0', 'page', '软件产品', 'software', 'recommend', '', '', '', 'software', '1495262336', '1495262336', '0', 'normal'), ('6', '5', 'page', '网站建站', 'website', 'recommend', '', '', '', 'website', '1495262357', '1495262357', '0', 'normal'), ('7', '5', 'page', '企业管理软件', 'company', 'index', '', '', '', 'company', '1495262391', '1495262391', '0', 'normal'), ('8', '6', 'page', 'PC端', 'website-pc', 'recommend', '', '', '', 'website-pc', '1495262424', '1495262424', '0', 'normal'), ('9', '6', 'page', '移动端', 'website-mobile', 'recommend', '', '', '', 'website-mobile', '1495262456', '1495262456', '0', 'normal'), ('10', '7', 'page', 'CRM系统 ', 'company-crm', 'recommend', '', '', '', 'company-crm', '1495262487', '1495262487', '0', 'normal'), ('11', '7', 'page', 'SASS平台软件', 'company-sass', 'recommend', '', '', '', 'company-sass', '1495262515', '1495262515', '0', 'normal'), ('12', '0', 'test', '测试1', 'test1', 'recommend', '', '', '', '', '1497015727', '1497015727', '0', 'normal'), ('13', '0', 'test', '测试2', 'test2', 'recommend', '', '', '', '', '1497015738', '1497015738', '0', 'normal'); COMMIT; +-- ---------------------------- +-- Table structure for `fa_config` +-- ---------------------------- +DROP TABLE IF EXISTS `fa_config`; +CREATE TABLE `fa_config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) NOT NULL DEFAULT '' COMMENT '变量名', + `group` varchar(30) NOT NULL DEFAULT '' COMMENT '分组', + `title` varchar(100) NOT NULL DEFAULT '' COMMENT '变量标题', + `tip` varchar(100) NOT NULL DEFAULT '' COMMENT '变量描述', + `type` varchar(30) NOT NULL DEFAULT '' COMMENT '类型:string,text,int,bool,array,datetime,date,file', + `value` text NOT NULL COMMENT '变量值', + `content` text NOT NULL COMMENT '变量字典数据', + `rule` varchar(100) NOT NULL DEFAULT '' COMMENT '验证规则', + `extend` varchar(255) NOT NULL DEFAULT '' COMMENT '扩展属性', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='系统配置'; + +-- ---------------------------- +-- Records of `fa_config` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_config` VALUES ('1', 'name', 'basic', '站点名称', '请填写站点名称', 'string', 'FastAdmin', '', 'required', ''), ('2', 'beian', 'basic', '备案号', '', 'string', '', '', '', ''), ('3', 'cdnurl', 'basic', 'CDN地址', '如果使用CDN云储存请配置该值', 'string', '', '', '', ''), ('4', 'version', 'basic', '版本号', '如果静态资源有变动请重新配置该值', 'string', '1.0.1', '', 'required', ''), ('5', 'timezone', 'basic', '时区', '', 'string', 'Asia/Shanghai', '', 'required', ''), ('6', 'forbiddenip', 'basic', '禁止访问IP', '一行一条记录', 'text', '', '', '', ''), ('7', 'languages', 'basic', '模块语言', '', 'array', '{\"backend\":\"zh-cn\",\"frontend\":\"zh-cn\"}', '', 'required', ''), ('8', 'fixedpage', 'basic', '后台默认页', '请尽量输入左侧菜单栏存在的链接', 'string', 'dashboard', '', 'required', ''), ('9', 'categorytype', 'dictionary', '分类类型', '', 'array', '{\"default\":\"默认\",\"page\":\"单页\",\"article\":\"文章\",\"test\":\"测试\"}', '', '', ''), ('10', 'configgroup', 'dictionary', '配置分组', '', 'array', '{\"basic\":\"基础配置\",\"email\":\"邮件配置\",\"dictionary\":\"字典配置\",\"user\":\"会员配置\",\"example\":\"示例分组\"}', '', '', ''); +COMMIT; + -- ---------------------------- -- Table structure for `fa_configvalue` -- ---------------------------- @@ -223,7 +249,7 @@ CREATE TABLE `fa_configvalue` ( -- Records of `fa_configvalue` -- ---------------------------- BEGIN; -INSERT INTO `fa_configvalue` VALUES ('basic', '常规配置', '{\"test\":\"测试\",\"content\":\"内容\",\"weigh\":\"权重\"}', '1493090807', '1493090807', '1', 'normal'), ('qqun', 'QQ群: 636393962', '{\"qqun\":\"636393962\"}', '1493475993', '1493475993', '2', 'normal'), ('service', '客服配置', '{\"onlinetime\":\"09:00-18:00\",\"offlinemsg\":\"请在工作时间联系客服!\",\"nosessionmsg\":\"当前没有客服在线!请稍后重试!\",\"waitformsg\":\"请问有什么可以帮到您?\"}', '1493994362', '1493994362', '3', 'normal'), ('wechat', '微信菜单', '{\"menu\":[{\"name\":\"FastAdmin\",\"sub_button\":[{\"name\":\"官网\",\"type\":\"view\",\"url\":\"http:\\/\\/www.fastadmin.net\"},{\"name\":\"在线演示\",\"type\":\"view\",\"url\":\"http:\\/\\/demo.fastadmin.net\"},{\"name\":\"文档\",\"type\":\"view\",\"url\":\"http:\\/\\/doc.fastadmin.net\"}]},{\"name\":\"在线客服\",\"type\":\"click\",\"key\":\"58cb852984970\"},{\"name\":\"关于我们\",\"type\":\"click\",\"key\":\"58bf944aa0777\"}],\"config\":[{\"id\":\"default.subscribe.message\",\"name\":\"关注后自动推送内容\",\"value\":\"欢迎关注我们!\"}]}', '1491646847', '1494257295', '4', 'locked'); +INSERT INTO `fa_configvalue` VALUES ('qqun', 'QQ群: 636393962', '{\"qqun\":\"636393962\"}', '1493475993', '1493475993', '2', 'normal'); COMMIT; -- ---------------------------- @@ -247,7 +273,101 @@ CREATE TABLE `fa_crontab` ( `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', `status` enum('completed','expired','hidden','normal') NOT NULL DEFAULT 'normal' COMMENT '状态', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='定时任务表'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='定时任务表'; + +-- ---------------------------- +-- Records of `fa_crontab` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_crontab` VALUES ('1', 'url', '', '', '* * * * 0-2', '0', '0', '0', '1497070825', '1497070825', '2017', '2017', '0', '0', 'normal'), ('2', 'url', 'fsfsfds', 'fsdfdsfsdf', '* * * * 0-2', '0', '0', '0', '1497071095', '1497071095', '2017', '2017', '0', '0', 'normal'); +COMMIT; + +-- ---------------------------- +-- Table structure for `fa_func` +-- ---------------------------- +DROP TABLE IF EXISTS `fa_func`; +CREATE TABLE `fa_func` ( + `f_id` int(10) NOT NULL AUTO_INCREMENT, + `f_title` varchar(50) NOT NULL COMMENT '标题', + `createtime` int(10) NOT NULL DEFAULT '0', + `updatetime` int(10) NOT NULL DEFAULT '0', + `status` varchar(30) NOT NULL DEFAULT '', + PRIMARY KEY (`f_id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='函数表'; + +-- ---------------------------- +-- Records of `fa_func` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_func` VALUES ('1', 'test', '1495811783', '1495811783', 'hidden'), ('2', 'test2fff', '1495811787', '1495813304', 'hidden'), ('3', 'fds', '1495813308', '1495813308', 'normal'); +COMMIT; + +-- ---------------------------- +-- Table structure for `fa_main` +-- ---------------------------- +DROP TABLE IF EXISTS `fa_main`; +CREATE TABLE `fa_main` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `title` varchar(100) NOT NULL, + `image` varchar(100) NOT NULL, + `content` text NOT NULL, + `createtime` int(10) NOT NULL, + `updatetime` int(10) NOT NULL, + `status` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='主表'; + +-- ---------------------------- +-- Records of `fa_main` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_main` VALUES ('1', '我是第一条', '/', 'fsdfds', '0', '0', 'normal'), ('2', '我是第二条', '/', 'fdsdsfd', '0', '0', 'normal'); +COMMIT; + +-- ---------------------------- +-- Table structure for `fa_main_multi` +-- ---------------------------- +DROP TABLE IF EXISTS `fa_main_multi`; +CREATE TABLE `fa_main_multi` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `main_id` int(10) NOT NULL, + `title` varchar(100) NOT NULL, + `image` varchar(100) NOT NULL, + `content` text NOT NULL, + `createtime` int(10) NOT NULL, + `updatetime` int(10) NOT NULL, + `status` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='多子表'; + +-- ---------------------------- +-- Records of `fa_main_multi` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_main_multi` VALUES ('1', '1', 't1', 'i1', '', '0', '0', 'test'), ('2', '1', 't2', 'i2', '', '0', '0', ''), ('3', '2', 'tt2', 'i3', '', '0', '0', ' sdfds'); +COMMIT; + +-- ---------------------------- +-- Table structure for `fa_main_single` +-- ---------------------------- +DROP TABLE IF EXISTS `fa_main_single`; +CREATE TABLE `fa_main_single` ( + `main_id` int(10) NOT NULL, + `title` varchar(100) NOT NULL COMMENT '内容', + `image` varchar(100) NOT NULL COMMENT '图片', + `content` text NOT NULL, + `createtime` int(10) NOT NULL, + `updatetime` int(10) NOT NULL, + `status` varchar(50) NOT NULL, + PRIMARY KEY (`main_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='单子表'; + +-- ---------------------------- +-- Records of `fa_main_single` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_main_single` VALUES ('1', '子表title', '//', 'aaaa', '0', '0', 'test'), ('2', '子表', 'fsdfds', 'bbb', '0', '0', 'fsdfds'); +COMMIT; -- ---------------------------- -- Table structure for `fa_page` @@ -302,7 +422,8 @@ CREATE TABLE `fa_test` ( `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', - `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', + `status` enum('normal','hidden') NOT NULL DEFAULT 'normal' COMMENT '状态', + `state` enum('0','1','2') NOT NULL DEFAULT '1' COMMENT '状态值:0=禁用,1=正常,2=推荐', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='测试表'; @@ -427,6 +548,28 @@ BEGIN; INSERT INTO `fa_wechat_autoreply` VALUES ('1', '输入hello', 'hello', '58c7d908c4570', '123', '1493366855', '1493366855', 'normal'), ('2', '输入你好', '你好', '58fdfaa9e1965', 'sad', '1493704976', '1493704976', 'normal'); COMMIT; +-- ---------------------------- +-- Table structure for `fa_wechat_config` +-- ---------------------------- +DROP TABLE IF EXISTS `fa_wechat_config`; +CREATE TABLE `fa_wechat_config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL DEFAULT '' COMMENT '配置名称', + `title` varchar(50) NOT NULL DEFAULT '' COMMENT '配置标题', + `value` text NOT NULL COMMENT '配置值', + `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='微信配置表'; + +-- ---------------------------- +-- Records of `fa_wechat_config` +-- ---------------------------- +BEGIN; +INSERT INTO `fa_wechat_config` VALUES ('1', 'menu', '微信菜单', '[{\"name\":\"FastAdmin\",\"sub_button\":[{\"name\":\"官网\",\"type\":\"view\",\"url\":\"http:\\/\\/www.fastadmin.net\"},{\"name\":\"在线演示\",\"type\":\"view\",\"url\":\"http:\\/\\/demo.fastadmin.net\"},{\"name\":\"文档\",\"type\":\"view\",\"url\":\"http:\\/\\/doc.fastadmin.net\"}]},{\"name\":\"在线客服\",\"type\":\"click\",\"key\":\"58cb852984970\"},{\"name\":\"关于我们\",\"type\":\"click\",\"key\":\"58bf944aa0777\"}]', '1497398820', '1497422985'), ('2', 'service', '客服配置', '{\"onlinetime\":\"09:00-18:00\",\"offlinemsg\":\"请在工作时间联系客服!\",\"nosessionmsg\":\"当前没有客服在线!请稍后重试!\",\"waitformsg\":\"请问有什么可以帮到您?\"}', '1497429674', '1497429674'), ('3', 'signin', '连续登录配置', '{\"s1\":\"100\",\"s2\":\"200\",\"s3\":\"300\",\"sn\":\"500\"}', '1497429711', '1497429711'); +COMMIT; + -- ---------------------------- -- Table structure for `fa_wechat_context` -- ---------------------------- diff --git a/application/admin/command/Menu.php b/application/admin/command/Menu.php index a4319430..340311cc 100644 --- a/application/admin/command/Menu.php +++ b/application/admin/command/Menu.php @@ -23,6 +23,7 @@ class Menu extends Command $this ->setName('menu') ->addOption('controller', 'c', Option::VALUE_REQUIRED, 'controller name,use \'all-controller\' when build all menu', null) + ->addOption('delete', 'd', Option::VALUE_OPTIONAL, 'delete the specified menu', '') ->setDescription('Build auth menu from controller'); } @@ -30,12 +31,45 @@ class Menu extends Command { $this->model = new AuthRule(); $adminPath = dirname(__DIR__) . DS; + $moduleName = 'admin'; //控制器名 $controller = $input->getOption('controller') ?: ''; if (!$controller) { throw new Exception("please input controller name"); } + //是否为删除模式 + $delete = $input->getOption('delete'); + if ($delete) + { + if ($controller == 'all-controller') + { + throw new Exception("could not delete all menu"); + } + $ids = []; + $list = $this->model->where('name', 'like', "/{$moduleName}/" . strtolower($controller) . "%")->select(); + foreach ($list as $k => $v) + { + $output->warning($v->name); + $ids[] = $v->id; + } + if (!$ids) + { + throw new Exception("There is no menu to delete"); + } + $readyMenu = []; + $output->info("Are you sure you want to delete all those menu? Type 'yes' to continue: "); + $line = fgets(STDIN); + if (trim($line) != 'yes') + { + throw new Exception("Operation is aborted!"); + } + AuthRule::destroy($ids); + + Cache::rm("__menu__"); + $output->info("Delete Successed"); + return; + } if ($controller != 'all-controller') { diff --git a/application/admin/common.php b/application/admin/common.php index 3c32be51..ab0190be 100644 --- a/application/admin/common.php +++ b/application/admin/common.php @@ -82,12 +82,12 @@ function build_checkboxs($name, $list = [], $selected = null) * @param array $attr * @return string */ -function build_category_select($name, $type, $selected = null, $attr = []) +function build_category_select($name, $type, $selected = null, $attr = [], $header = []) { $tree = Tree::instance(); $tree->init(Category::getCategoryArray($type), 'pid'); $categorylist = $tree->getTreeList($tree->getTreeArray(0), 'name'); - $categorydata = [0 => __('None')]; + $categorydata = $header ? $header : []; foreach ($categorylist as $k => $v) { $categorydata[$v['id']] = $v['name']; @@ -110,7 +110,7 @@ function build_toolbar($btns = NULL, $attr = []) 'refresh' => ['javascript:;', 'btn btn-primary btn-refresh', 'fa fa-refresh', ''], 'add' => ['javascript:;', 'btn btn-success btn-add', 'fa fa-plus', __('Add')], 'edit' => ['javascript:;', 'btn btn-success btn-edit btn-disabled disabled', 'fa fa-pencil', __('Edit')], - 'delete' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', 'fa fa-trash', __('Delete')], + 'delete' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', 'fa fa-trash', __('Delete')], ]; $btnAttr = array_merge($btnAttr, $attr); $html = []; diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index da7df62d..d6a6c0da 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -33,7 +33,7 @@ class Index extends Backend 'auth/admin' => 12, 'auth/rule' => 4, 'general' => ['18', 'purple'], - ]); + ], $this->view->site['fixedpage']); $this->view->assign('menulist', $menulist); $this->view->assign('title', __('Home')); return $this->view->fetch(); diff --git a/application/admin/controller/general/Config.php b/application/admin/controller/general/Config.php new file mode 100644 index 00000000..7cd41cbb --- /dev/null +++ b/application/admin/controller/general/Config.php @@ -0,0 +1,236 @@ +model = model('Config'); + } + + public function index() + { + $siteList = []; + $groupList = \app\admin\model\Config::getGroupList(); + foreach ($groupList as $k => $v) + { + $siteList[$k]['name'] = $k; + $siteList[$k]['title'] = $v; + $siteList[$k]['list'] = []; + } + + foreach ($this->model->all() as $k => $v) + { + if (!isset($siteList[$v['group']])) + { + continue; + } + $value = $v->toArray(); + if (in_array($value['type'], ['select', 'selects', 'checkbox', 'radio'])) + { + $value['value'] = explode(',', $value['value']); + } + if ($value['type'] == 'array') + { + $value['value'] = (array) json_decode($value['value'], TRUE); + } + $value['content'] = json_decode($value['content'], TRUE); + $siteList[$v['group']]['list'][] = $value; + } + $index = 0; + foreach ($siteList as $k => &$v) + { + $v['active'] = !$index ? true : false; + $index++; + } + $this->view->assign('siteList', $siteList); + $this->view->assign('typeList', \app\admin\model\Config::getTypeList()); + $this->view->assign('groupList', \app\admin\model\Config::getGroupList()); + return $this->view->fetch(); + } + + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) + { + $this->code = -1; + $params = $this->request->post("row/a"); + if ($params) + { + foreach ($params as $k => &$v) + { + $v = is_array($v) ? implode(',', $v) : $v; + } + try + { + if ($params['content'] && in_array($params['type'], ['select', 'selects', 'checkbox', 'radio'])) + { + $content = explode("\r\n", $params['content']); + $arr = []; + foreach ($content as $k => &$v) + { + if (stripos($v, "|") !== false) + { + $item = explode('|', $v); + $arr[$item[0]] = $item[1]; + } + } + $params['content'] = $arr ? json_encode($arr, JSON_UNESCAPED_UNICODE) : ''; + } + else + { + $params['content'] = ''; + } + $result = $this->model->create($params); + if ($result !== false) + { + try + { + $this->refreshFile(); + $this->code = 1; + } + catch (Exception $e) + { + $this->msg = $e->getMessage(); + } + } + else + { + $this->msg = $this->model->getError(); + } + } + catch (think\Exception $e) + { + $this->msg = $e->getMessage(); + } + } + else + { + $this->msg = __('Parameter %s can not be empty', ''); + } + + return; + } + return $this->view->fetch(); + } + + public function edit($ids = NULL) + { + $this->code = -1; + if ($this->request->isPost()) + { + $params = $this->request->post("row/a"); + if ($params) + { + $configList = []; + foreach ($this->model->all() as $k => $v) + { + if (isset($params[$v['name']])) + { + if ($v['type'] == 'array') + { + $fieldarr = $valuearr = []; + $field = $params[$v['name']]['field']; + $value = $params[$v['name']]['value']; + + foreach ($field as $m => $n) + { + if ($n != '') + { + $fieldarr[] = $field[$m]; + $valuearr[] = $value[$m]; + } + } + $params[$v['name']] = array_combine($fieldarr, $valuearr); + $value = json_encode($params[$v['name']], JSON_UNESCAPED_UNICODE); + } + else + { + $value = is_array($params[$v['name']]) ? implode(',', $params[$v['name']]) : $params[$v['name']]; + } + + $configList[] = ['id' => $v['id'], 'value' => $value]; + } + } + $this->model->saveAll($configList); + try + { + $this->refreshFile(); + $this->code = 1; + } + catch (Exception $e) + { + $this->msg = $e->getMessage(); + } + } + else + { + $this->msg = __('Parameter %s can not be empty', ''); + } + + return; + } + } + + protected function refreshFile() + { + $config = []; + foreach ($this->model->all() as $k => $v) + { + + $value = $v->toArray(); + if (in_array($value['type'], ['selects', 'checkbox', 'images', 'files'])) + { + $value['value'] = explode(',', $value['value']); + } + if ($value['type'] == 'array') + { + $value['value'] = (array) json_decode($value['value'], TRUE); + } + $config[$value['name']] = $value['value']; + } + file_put_contents(APP_PATH . 'extra' . DS . 'site.php', 'request->post("row/a"); + if ($params) + { + + $config = $this->model->get($params); + if (!$config) + { + return json(['ok' => '']); + } + else + { + return json(['error' => __('Name already exist')]); + } + } + else + { + return json(['error' => __('Invalid parameters')]); + } + } + +} diff --git a/application/admin/controller/general/Configvalue.php b/application/admin/controller/general/Configvalue.php index b23543ff..1664ba77 100644 --- a/application/admin/controller/general/Configvalue.php +++ b/application/admin/controller/general/Configvalue.php @@ -9,6 +9,7 @@ use app\common\controller\Backend; * * @icon fa fa-cog * @remark 用于管理一些字典数据,通常以键值格式进行录入,保存的数据格式为JSON + * @internal */ class Configvalue extends Backend { diff --git a/application/admin/controller/wechat/Config.php b/application/admin/controller/wechat/Config.php index c7bb8952..bf9af55d 100644 --- a/application/admin/controller/wechat/Config.php +++ b/application/admin/controller/wechat/Config.php @@ -1,127 +1,164 @@ -wechatcfg = Configvalue::get('wechat'); - $this->obj = $this->wechatcfg->content; - } - - /** - * 查看 - */ - public function index() - { - if ($this->request->isAjax()) - { - $configlist = isset($this->obj['config']) ? $this->obj['config'] : []; - $list = array(); - foreach ($configlist as $row) - { - $list[] = $row; - } - $total = count($list); - $result = array("total" => $total, "rows" => $list); - - return json($result); - } - return $this->view->fetch(); - } - - /** - * 添加 - */ - public function add() - { - if ($this->request->isPost()) - { - $this->obj['config'][] = $this->request->post('row/a'); - $this->wechatcfg->content = $this->obj; - $this->wechatcfg->save(); - $this->code = 1; - return; - } - return $this->view->fetch(); - } - - /** - * 编辑 - */ - public function edit($ids = NULL) - { - $row = []; - foreach ($this->obj['config'] as $k => $v) - { - if ($v['id'] == $ids) - { - $row = $v; - break; - } - } - if (!$row) - $this->error(__('No Results were found')); - if ($this->request->isPost()) - { - $params = $this->request->post('row/a'); - $this->obj['config'][$k] = $params; - $this->obj['config'] = array_values($this->obj['config']); - $this->wechatcfg->content = $this->obj; - $this->wechatcfg->save(); - $this->code = 1; - return; - } - $this->view->assign("row", $row); - return $this->view->fetch(); - } - - /** - * 删除 - */ - public function del($ids = "") - { - $this->code = -1; - if ($ids) - { - $ids = is_array($ids) ? $ids : explode(',', $ids); - foreach ($this->obj['config'] as $k => $v) - { - if (in_array($v['id'], $ids)) - { - unset($this->obj['config'][$k]); - } - } - $this->wechatcfg->content = $this->obj; - $this->wechatcfg->save(); - $this->code = 1; - } - - return; - } - - /** - * 批量更新 - */ - public function multi($ids = "") - { - $this->code = -1; - //不支持指操作 - return; - } - -} +model = model('WechatConfig'); + } + + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) + { + $this->code = -1; + $params = $this->request->post("row/a"); + if ($params) + { + foreach ($params as $k => &$v) + { + $v = is_array($v) ? implode(',', $v) : $v; + } + + if ($params['mode'] == 'json') + { + //JSON字段 + $fieldarr = $valuearr = []; + $field = $this->request->post('field/a'); + $value = $this->request->post('value/a'); + foreach ($field as $k => $v) + { + if ($v != '') + { + $fieldarr[] = $field[$k]; + $valuearr[] = $value[$k]; + } + } + $params['value'] = json_encode(array_combine($fieldarr, $valuearr), JSON_UNESCAPED_UNICODE); + } + unset($params['mode']); + try + { + //是否采用模型验证 + if ($this->modelValidate) + { + $name = basename(str_replace('\\', '/', get_class($this->model))); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate; + $this->model->validate($validate); + } + $result = $this->model->save($params); + if ($result !== false) + { + $this->code = 1; + } + else + { + $this->msg = $this->model->getError(); + } + } + catch (\think\exception\PDOException $e) + { + $this->msg = $e->getMessage(); + } + } + else + { + $this->msg = __('Parameter %s can not be empty', ''); + } + + return; + } + return $this->view->fetch(); + } + + /** + * 编辑 + */ + public function edit($ids = NULL) + { + $row = $this->model->get($ids); + if (!$row) + $this->error(__('No Results were found')); + if ($this->request->isPost()) + { + $this->code = -1; + $params = $this->request->post("row/a"); + if ($params) + { + foreach ($params as $k => &$v) + { + $v = is_array($v) ? implode(',', $v) : $v; + } + + if ($params['mode'] == 'json') + { + //JSON字段 + $fieldarr = $valuearr = []; + $field = $this->request->post('field/a'); + $value = $this->request->post('value/a'); + foreach ($field as $k => $v) + { + if ($v != '') + { + $fieldarr[] = $field[$k]; + $valuearr[] = $value[$k]; + } + } + $params['value'] = json_encode(array_combine($fieldarr, $valuearr), JSON_UNESCAPED_UNICODE); + } + unset($params['mode']); + try + { + //是否采用模型验证 + if ($this->modelValidate) + { + $name = basename(str_replace('\\', '/', get_class($this->model))); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate; + $row->validate($validate); + } + $result = $row->save($params); + if ($result !== false) + { + $this->code = 1; + } + else + { + $this->msg = $row->getError(); + } + } + catch (think\exception\PDOException $e) + { + $this->msg = $e->getMessage(); + } + } + else + { + $this->msg = __('Parameter %s can not be empty', ''); + } + + return; + } + $this->view->assign("row", $row); + $this->view->assign("value", (array) json_decode($row->value, true)); + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/wechat/Menu.php b/application/admin/controller/wechat/Menu.php index be7e09b2..5db67282 100644 --- a/application/admin/controller/wechat/Menu.php +++ b/application/admin/controller/wechat/Menu.php @@ -22,7 +22,7 @@ class Menu extends Backend public function _initialize() { parent::_initialize(); - $this->wechatcfg = Configvalue::get('wechat'); + $this->wechatcfg = \app\common\model\WechatConfig::get(['name' => 'menu']); } /** @@ -37,7 +37,7 @@ class Menu extends Backend $responselist[$v['eventkey']] = $v['title']; } $this->view->assign('responselist', $responselist); - $this->view->assign('menu', $this->wechatcfg->content['menu']); + $this->view->assign('menu', (array) json_decode($this->wechatcfg->value, TRUE)); return $this->view->fetch(); } @@ -48,9 +48,7 @@ class Menu extends Backend { $menu = $this->request->post("menu"); $menu = (array) json_decode($menu, TRUE); - $content = $this->wechatcfg->content; - $content['menu'] = $menu; - $this->wechatcfg->content = $content; + $this->wechatcfg->value = json_encode($menu, JSON_UNESCAPED_UNICODE); $this->wechatcfg->save(); $this->code = 1; return; @@ -66,7 +64,7 @@ class Menu extends Backend try { - $ret = $app->menu->add($this->wechatcfg->content['menu']); + $ret = $app->menu->add(json_decode($this->wechatcfg->value, TRUE)); if ($ret->errcode == 0) { $this->code = 1; diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 8328d972..6ca614ce 100644 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -86,7 +86,8 @@ return [ 'Network error' => '网络错误!', 'Auth manager' => '权限管理', 'General manager' => '常规管理', - 'Example manager' => '测试管理', + 'Example manager' => '示例管理', + 'Wechat manager' => '微信管理', 'Common search' => '普通搜索', 'Search %s' => '搜索 %s', '%d second%s ago' => '%d秒前', diff --git a/application/admin/lang/zh-cn/config.php b/application/admin/lang/zh-cn/config.php new file mode 100644 index 00000000..44102ca6 --- /dev/null +++ b/application/admin/lang/zh-cn/config.php @@ -0,0 +1,9 @@ + '变量名称', + 'intro' => '描述', + 'group' => '分组', + 'type' => '类型', + 'value' => '变量值' +]; diff --git a/application/admin/lang/zh-cn/general/attachment.php b/application/admin/lang/zh-cn/general/attachment.php index c49aeb3a..5eb97f9e 100644 --- a/application/admin/lang/zh-cn/general/attachment.php +++ b/application/admin/lang/zh-cn/general/attachment.php @@ -6,8 +6,9 @@ return [ 'Imageheight' => '宽度', 'Imagetype' => '图片类型', 'Imageframes' => '图片帧数', + 'Preview' => '预览', 'Filesize' => '文件大小', - 'Mimetype' => 'mime类型', + 'Mimetype' => 'Mime类型', 'Extparam' => '透传数据', 'Createtime' => '创建日期', 'Uploadtime' => '上传时间', diff --git a/application/admin/lang/zh-cn/general/config.php b/application/admin/lang/zh-cn/general/config.php new file mode 100644 index 00000000..a04a5e48 --- /dev/null +++ b/application/admin/lang/zh-cn/general/config.php @@ -0,0 +1,36 @@ + '变量名', + 'Tip' => '提示信息', + 'Group' => '分组', + 'Type' => '类型', + 'Title' => '变量标题', + 'Value' => '变量值', + 'Basic' => '基础配置', + 'Email' => '邮件配置', + 'Attachment' => '附件配置', + 'User' => '会员配置', + 'Example' => '示例分组', + 'Extend' => '扩展属性', + 'String' => '字符', + 'Text' => '文本', + 'Number' => '数字', + 'Date' => '日期', + 'Time' => '时间', + 'Datetime' => '日期时间', + 'Image' => '图片', + 'Images' => '图片(多)', + 'File' => '文件', + 'Files' => '文件(多)', + 'Select' => '列表', + 'Selects' => '列表(多选)', + 'Checkbox' => '复选', + 'Radio' => '单选', + 'Array' => '数组', + 'Array key' => '键名', + 'Array value' => '键值', + 'Content' => '数据列表', + 'Rule' => '校验规则', + 'Name already exist' => '变量名称已经存在', +]; diff --git a/application/admin/lang/zh-cn/wechat/config.php b/application/admin/lang/zh-cn/wechat/config.php new file mode 100644 index 00000000..fbbd04a1 --- /dev/null +++ b/application/admin/lang/zh-cn/wechat/config.php @@ -0,0 +1,10 @@ + '配置名称', + 'value' => '配置值', + 'Json key' => '键', + 'Json value' => '值', + 'createtime' => '创建时间', + 'updatetime' => '更新时间' +]; diff --git a/application/admin/library/Auth.php b/application/admin/library/Auth.php index 116e3b66..232f64ff 100644 --- a/application/admin/library/Auth.php +++ b/application/admin/library/Auth.php @@ -235,7 +235,7 @@ class Auth extends \fast\Auth * @param array $params URL对应的badge数据 * @return string */ - public function getSidebar($params = []) + public function getSidebar($params = [], $fixedPage = 'dashboard') { $colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple']; $colorNums = count($colorArr); @@ -275,7 +275,7 @@ class Auth extends \fast\Auth // 读取管理员当前拥有的权限节点 $userRule = $this->getRuleList(); $select_id = 0; - $dashboard = '/' . $module . '/dashboard'; + $activeUrl = '/' . $module . '/' . $fixedPage; // 必须将结果集转换为数组 $ruleList = collection(model('AuthRule')->where('ismenu', 1)->order('weigh', 'desc')->cache("__menu__")->select())->toArray(); foreach ($ruleList as $k => &$v) @@ -285,7 +285,7 @@ class Auth extends \fast\Auth unset($ruleList[$k]); continue; } - $select_id = $v['name'] == $dashboard ? $v['id'] : $select_id; + $select_id = $v['name'] == $activeUrl ? $v['id'] : $select_id; $v['url'] = $v['name']; $v['badge'] = isset($badgeList[$v['name']]) ? $badgeList[$v['name']] : ''; } diff --git a/application/admin/library/traits/Backend.php b/application/admin/library/traits/Backend.php index 15b10270..093fa456 100644 --- a/application/admin/library/traits/Backend.php +++ b/application/admin/library/traits/Backend.php @@ -23,7 +23,7 @@ trait Backend ->order($sort, $order) ->limit($offset, $limit) ->select(); - + $result = array("total" => $total, "rows" => $list); return json($result); @@ -48,7 +48,14 @@ trait Backend } try { - $result = $this->model->create($params); + //是否采用模型验证 + if ($this->modelValidate) + { + $name = basename(str_replace('\\', '/', get_class($this->model))); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate; + $this->model->validate($validate); + } + $result = $this->model->save($params); if ($result !== false) { $this->code = 1; @@ -58,7 +65,7 @@ trait Backend $this->msg = $this->model->getError(); } } - catch (think\Exception $e) + catch (\think\exception\PDOException $e) { $this->msg = $e->getMessage(); } @@ -93,6 +100,13 @@ trait Backend } try { + //是否采用模型验证 + if ($this->modelValidate) + { + $name = basename(str_replace('\\', '/', get_class($this->model))); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate; + $row->validate($validate); + } $result = $row->save($params); if ($result !== false) { @@ -103,7 +117,7 @@ trait Backend $this->msg = $row->getError(); } } - catch (think\Exception $e) + catch (think\exception\PDOException $e) { $this->msg = $e->getMessage(); } diff --git a/application/admin/model/Config.php b/application/admin/model/Config.php new file mode 100644 index 00000000..cec8a769 --- /dev/null +++ b/application/admin/model/Config.php @@ -0,0 +1,55 @@ + __('String'), + 'text' => __('Text'), + 'number' => __('Number'), + 'datetime' => __('Datetime'), + 'select' => __('Select'), + 'selects' => __('Selects'), + 'image' => __('Image'), + 'images' => __('Images'), + 'file' => __('File'), + 'files' => __('Files'), + 'checkbox' => __('Checkbox'), + 'radio' => __('Radio'), + 'array' => __('Array'), + ]; + return $typeList; + } + + /** + * 读取分类分组列表 + * @return array + */ + public static function getGroupList() + { + $groupList = config('site.configgroup'); + return $groupList; + } + +} diff --git a/application/admin/view/general/config/index.html b/application/admin/view/general/config/index.html new file mode 100644 index 00000000..ede13e2b --- /dev/null +++ b/application/admin/view/general/config/index.html @@ -0,0 +1,207 @@ +
+
+
系统配置可以在此增改系统的变量和分组,也可以自定义分组和变量,如果需要删除请从数据库中删除
+ +
+ +
+
+ {foreach $siteList as $index=>$vo} +
+
+
+ + + + + + + + + + {foreach $vo.list as $item} + + + + + + {/foreach} + + + + + + + + +
{:__('Title')}{:__('Value')}{:__('Name')}
{$item.title} +
+
+ {switch $item.type} + {case string} + + {/case} + {case text} + + {/case} + {case array} +
+
+ {:__('Array key')} + {:__('Array value')} +
+ {foreach $item.value as $key => $vo} +
+ + + + +
+ {/foreach} +
{:__('Append')}
+
+ {/case} + {case datetime} + + {/case} + {case number} + + {/case} + {case checkbox} + {foreach name="item.content" item="vo"} + + {/foreach} + {/case} + {case radio} + {foreach name="item.content" item="vo"} + + {/foreach} + {/case} + {case value="select" break="0"}{/case} + {case value="selects"} + + {/case} + {case value="image" break="0"}{/case} + {case value="images"} +
+ + + +
    +
    + {/case} + {case value="file" break="0"}{/case} + {case value="files"} +
    + + + +
    + {/case} + {case bool} + + + {/case} + {/switch} +
    +
    +
    + +
    {php}echo "{\$site.". $item['name'] . "}";{/php}
    + + +
    +
    +
    +
    + {/foreach} +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    + +
    + +
    +
    +
    +
    diff --git a/application/admin/view/general/configvalue/add.html b/application/admin/view/general/configvalue/add.html index 49bb3020..5d18915c 100644 --- a/application/admin/view/general/configvalue/add.html +++ b/application/admin/view/general/configvalue/add.html @@ -1,9 +1,3 @@ -
    @@ -20,7 +14,7 @@
    -
    +
    {:__('Key')} {:__('Value')} diff --git a/application/admin/view/general/configvalue/edit.html b/application/admin/view/general/configvalue/edit.html index f89ab92f..b5e63831 100644 --- a/application/admin/view/general/configvalue/edit.html +++ b/application/admin/view/general/configvalue/edit.html @@ -1,9 +1,3 @@ -
    @@ -20,7 +14,7 @@
    -
    +
    {:__('Key')} {:__('Value')} diff --git a/application/admin/view/test/add.html b/application/admin/view/test/add.html deleted file mode 100644 index 77d51854..00000000 --- a/application/admin/view/test/add.html +++ /dev/null @@ -1,154 +0,0 @@ - - -
    - -
    - {:build_category_select('row[category_id]', 'test', '0', ['id' => 'c-category_id'])} -
    -
    -
    - -
    - {:build_category_select('row[category_ids]', 'test', '', ['id' => 'c-category_ids','required' => '','multiple' => ''])} -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - {:build_select('row[week]', ['monday' => __('Monday'),'tuesday' => __('Tuesday'),'wednesday' => __('Wednesday')], '', ['id' => 'c-week','required' => '','class' => 'form-control selectpicker'])} -
    -
    -
    - -
    - {:build_select('row[flag][]', ['hot' => __('Hot'),'index' => __('Index'),'recommend' => __('Recommend')], '', ['id' => 'c-flag','required' => '','class' => 'form-control selectpicker','multiple' => ''])} -
    -
    -
    - -
    - {:build_radios('row[genderdata]', ['male' => __('Male'),'female' => __('Female')], 'male')} -
    -
    -
    - -
    - {:build_checkboxs('row[hobbydata][]', ['music' => __('Music'),'reading' => __('Reading'),'swimming' => __('Swimming')], '')} -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - {:build_radios('row[status]', ['normal' => __('Normal'),'hidden' => __('Hidden')], 'normal')} -
    -
    - -
    diff --git a/application/admin/view/test/edit.html b/application/admin/view/test/edit.html deleted file mode 100644 index 2b8f89b3..00000000 --- a/application/admin/view/test/edit.html +++ /dev/null @@ -1,154 +0,0 @@ -
    - -
    - -
    - {:build_category_select('row[category_id]', 'test', $row.category_id, ['id' => 'c-category_id'])} -
    -
    -
    - -
    - {:build_category_select('row[category_ids]', 'test', $row.category_ids, ['id' => 'c-category_ids','required' => '','multiple' => ''])} -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - {:build_select('row[week]', ['monday' => __('Monday'),'tuesday' => __('Tuesday'),'wednesday' => __('Wednesday')], $row.week, ['id' => 'c-week','required' => '','class' => 'form-control selectpicker'])} -
    -
    -
    - -
    - {:build_select('row[flag][]', ['hot' => __('Hot'),'index' => __('Index'),'recommend' => __('Recommend')], $row.flag, ['id' => 'c-flag','required' => '','class' => 'form-control selectpicker','multiple' => ''])} -
    -
    -
    - -
    - {:build_radios('row[genderdata]', ['male' => __('Male'),'female' => __('Female')], $row.genderdata)} -
    -
    -
    - -
    - {:build_checkboxs('row[hobbydata][]', ['music' => __('Music'),'reading' => __('Reading'),'swimming' => __('Swimming')], $row.hobbydata)} -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - {:build_radios('row[status]', ['normal' => __('Normal'),'hidden' => __('Hidden')], $row.status)} -
    -
    - -
    diff --git a/application/admin/view/test/index.html b/application/admin/view/test/index.html deleted file mode 100644 index d3eefa4f..00000000 --- a/application/admin/view/test/index.html +++ /dev/null @@ -1,25 +0,0 @@ -
    - {:build_heading()} - -
    -
    -
    -
    - - -
    -
    -
    - -
    -
    -
    diff --git a/application/admin/view/wechat/config/add.html b/application/admin/view/wechat/config/add.html index f1715563..aa32d7c7 100644 --- a/application/admin/view/wechat/config/add.html +++ b/application/admin/view/wechat/config/add.html @@ -1,25 +1,42 @@ -
    + +
    - +
    - +
    - +
    - +
    - +
    - - {:__('Insert link')} +

    + {:__('Json editor')} + {:__('Insert link')} +

    + +
    +
    + {:__('Json key')} + {:__('Json value')} +
    +
    + + + + +
    +
    {:__('Append')}
    +
    -