From 23f4fb1b8cf9c26bd2002b3c89592d1f834109df Mon Sep 17 00:00:00 2001 From: Karson <karsonzhang@163.com> Date: Wed, 20 Sep 2017 09:44:41 +0800 Subject: [PATCH] 修复命令行生成菜单的错误。 --- application/admin/command/Crud.php | 12 ++++++------ application/admin/command/Menu.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 08a0bed..30ff57d 100644 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -255,7 +255,7 @@ class Crud extends Command $controller = str_replace('_', '', $controller); $controllerArr = !$controller ? explode('_', strtolower($table)) : explode('/', strtolower($controller)); $controllerUrl = implode('/', $controllerArr); - $controllerName = mb_ucfirst(array_pop($controllerArr)); + $controllerName = ucfirst(array_pop($controllerArr)); $controllerDir = implode(DS, $controllerArr); $controllerFile = ($controllerDir ? $controllerDir . DS : '') . $controllerName . '.php'; $viewDir = $adminPath . 'view' . DS . $controllerUrl . DS; @@ -810,7 +810,7 @@ class Crud extends Command if (!in_array($inputType, ['datetime', 'select', 'multiple', 'checkbox', 'radio'])) return; $fieldList = $this->getFieldListName($field); - $methodName = 'get' . mb_ucfirst($fieldList); + $methodName = 'get' . ucfirst($fieldList); foreach ($itemArr as $k => &$v) { $v = "__('" . mb_ucfirst($v) . "')"; @@ -832,7 +832,7 @@ EOD; { if (!in_array($inputType, ['datetime', 'select', 'multiple', 'checkbox', 'radio'])) return; - $attrField = mb_ucfirst($this->getCamelizeName($field)); + $attrField = ucfirst($this->getCamelizeName($field)); $getAttr[] = $this->getReplacedStub("mixins" . DS . $inputType, ['field' => $field, 'methodName' => "get{$attrField}TextAttr", 'listMethodName' => "get{$attrField}List"]); } @@ -840,7 +840,7 @@ EOD; { if ($inputType != 'datetime') return; - $attrField = mb_ucfirst($this->getCamelizeName($field)); + $attrField = ucfirst($this->getCamelizeName($field)); if ($inputType == 'datetime') { $return = <<<EOD @@ -868,13 +868,13 @@ EOD; { $modelarr = explode('_', strtolower($table)); foreach ($modelarr as $k => &$v) - $v = mb_ucfirst($v); + $v = ucfirst($v); unset($v); $modelName = implode('', $modelarr); } else { - $modelName = mb_ucfirst($model); + $modelName = ucfirst($model); } return $modelName; } diff --git a/application/admin/command/Menu.php b/application/admin/command/Menu.php index 6d49e62..ecf1ebc 100644 --- a/application/admin/command/Menu.php +++ b/application/admin/command/Menu.php @@ -215,7 +215,7 @@ class Menu extends Command //导入中文语言包 \think\Lang::load(dirname(__DIR__) . DS . 'lang/zh-cn.php'); - + //先定入菜单的数据 $pid = 0; foreach ($controllerArr as $k => $v) @@ -225,7 +225,7 @@ class Menu extends Command $title = (!isset($controllerArr[$key]) ? $controllerTitle : ''); $icon = (!isset($controllerArr[$key]) ? $controllerIcon : 'fa fa-list'); $remark = (!isset($controllerArr[$key]) ? $controllerRemark : ''); - $title = $title ? $title : ucfirst($v); + $title = $title ? $title : $v; $rulemodel = $this->model->get(['name' => $name]); if (!$rulemodel) { @@ -263,9 +263,9 @@ class Menu extends Command //过滤掉其它字符 $comment = preg_replace(array('/^\/\*\*(.*)[\n\r\t]/u', '/[\s]+\*\//u', '/\*\s@(.*)/u', '/[\s|\*]+/u'), '', $comment); - $title = $comment ? $comment : $n->name; + $title = $comment ? $comment : ucfirst($n->name); - $ruleArr[] = array('pid' => $pid, 'name' => $name . "/" . strtolower($n->name), 'icon' => 'fa fa-circle-o', 'title' => ucfirst($name), 'ismenu' => 0, 'status' => 'normal'); + $ruleArr[] = array('pid' => $pid, 'name' => $name . "/" . strtolower($n->name), 'icon' => 'fa fa-circle-o', 'title' => $title, 'ismenu' => 0, 'status' => 'normal'); } $this->model->saveAll($ruleArr); } -- libgit2 0.24.0