From 9e3f1ccf429b3fbfb59b976e23c76d66350ffd6c Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 11 Sep 2018 11:20:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=99=84=E4=BB=B6=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=8C=87=E5=AE=9A=E7=AE=A1=E7=90=86=E5=91=98=E6=88=96?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E4=BC=9A=E5=91=98=E6=95=B0=E6=8D=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20=E6=96=B0=E5=A2=9E=E9=99=84=E4=BB=B6=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=E5=A4=9A=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=89=8D=E5=8F=B0=E4=BC=9A=E5=91=98=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E8=BE=B9=E6=A0=8FHook=20=E6=96=B0=E5=A2=9E=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=B8=AD=E5=BF=83=E6=8E=A7=E5=88=B6=E5=99=A8=E7=A9=BA?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=8D=95=E8=8E=B7=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BC=96=E8=BE=91=E3=80=81=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E3=80=81=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E6=97=A0=E6=B3=95=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=9A=84BUG=20=E4=BF=AE=E5=A4=8D=E4=BC=9A=E5=91=98=E8=A7=84?= =?UTF-8?q?=E5=88=99=E6=8E=92=E5=BA=8FBUG=20=E4=BC=98=E5=8C=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=ADextend=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Menu.php | 9 +- application/admin/controller/Addon.php | 4 +- .../admin/controller/general/Attachment.php | 52 +++--- .../admin/lang/zh-cn/general/attachment.php | 2 + application/admin/model/UserRule.php | 5 +- application/admin/view/addon/config.html | 10 +- application/admin/view/addon/index.html | 3 + .../admin/view/general/config/index.html | 12 +- application/config.php | 2 +- application/index/controller/User.php | 11 ++ application/index/lang/zh-cn.php | 1 + application/index/view/common/meta.html | 2 +- application/index/view/common/sidenav.html | 2 + application/index/view/index/index.html | 4 +- application/index/view/layout/default.html | 1 + bower.json | 2 +- public/assets/css/frontend.css | 2 +- public/assets/css/frontend.min.css | 2 +- public/assets/js/backend.js | 10 - public/assets/js/backend/addon.js | 8 +- .../assets/js/backend/general/attachment.js | 8 +- public/assets/js/require-backend.min.js | 173 +++++++++--------- public/assets/js/require-form.js | 4 +- public/assets/js/require-table.js | 15 +- public/assets/js/require-upload.js | 2 +- public/assets/less/frontend.less | 2 +- 26 files changed, 191 insertions(+), 157 deletions(-) diff --git a/application/admin/command/Menu.php b/application/admin/command/Menu.php index ad18b89c..e65c4123 100755 --- a/application/admin/command/Menu.php +++ b/application/admin/command/Menu.php @@ -27,7 +27,7 @@ class Menu extends Command ->addOption('force', 'f', Option::VALUE_OPTIONAL, 'force delete menu,without tips', null) ->addOption('equal', 'e', Option::VALUE_OPTIONAL, 'the controller must be equal', null) ->setDescription('Build auth menu from controller'); - //要执行的controller必须一样,不适用模糊查询 + //要执行的controller必须一样,不适用模糊查询 } protected function execute(Input $input, Output $output) @@ -44,7 +44,7 @@ class Menu extends Command //是否为删除模式 $delete = $input->getOption('delete'); //是否控制器完全匹配 - $equal= $input->getOption('equal'); + $equal = $input->getOption('equal'); if ($delete) { @@ -54,10 +54,10 @@ class Menu extends Command $ids = []; $list = $this->model->where(function ($query) use ($controller, $equal) { foreach ($controller as $index => $item) { - if($equal) + if ($equal) $query->whereOr('name', 'eq', $item); else - $query->whereOr('name', 'like', strtolower($item) . "%"); + $query->whereOr('name', 'like', strtolower($item) . "%"); } })->select(); foreach ($list as $k => $v) { @@ -156,6 +156,7 @@ class Menu extends Command protected function importRule($controller) { + $controller = str_replace('\\', '/', $controller); $controllerArr = explode('/', $controller); end($controllerArr); $key = key($controllerArr); diff --git a/application/admin/controller/Addon.php b/application/admin/controller/Addon.php index 4e3dd473..560f5138 100644 --- a/application/admin/controller/Addon.php +++ b/application/admin/controller/Addon.php @@ -82,7 +82,9 @@ class Addon extends Backend $this->error(__('Parameter %s can not be empty', '')); } $this->view->assign("addon", ['info' => $info, 'config' => $config]); - return $this->view->fetch(); + $configFile = ADDON_PATH . $name . DS . 'config.html'; + $viewFile = is_file($configFile) ? $configFile : ''; + return $this->view->fetch($viewFile); } /** diff --git a/application/admin/controller/general/Attachment.php b/application/admin/controller/general/Attachment.php index d2ca90a6..80414dfc 100644 --- a/application/admin/controller/general/Attachment.php +++ b/application/admin/controller/general/Attachment.php @@ -31,22 +31,35 @@ class Attachment extends Backend { //设置过滤方法 $this->request->filter(['strip_tags']); - if ($this->request->isAjax()) - { + if ($this->request->isAjax()) { + $mimetypeQuery = []; + $filter = $this->request->request('filter'); + $filterArr = (array)json_decode($filter, TRUE); + if (isset($filterArr['mimetype']) && stripos($filterArr['mimetype'], ',') !== false) { + $this->request->get(['filter' => json_encode(array_merge($filterArr, ['mimetype' => '']))]); + $mimetypeQuery = function ($query) use ($filterArr) { + $mimetypeArr = explode(',', $filterArr['mimetype']); + foreach ($mimetypeArr as $index => $item) { + $query->whereOr('mimetype', 'like', '%' . $item . '%'); + } + }; + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $total = $this->model - ->where($where) - ->order($sort, $order) - ->count(); + ->where($mimetypeQuery) + ->where($where) + ->order($sort, $order) + ->count(); $list = $this->model - ->where($where) - ->order($sort, $order) - ->limit($offset, $limit) - ->select(); + ->where($mimetypeQuery) + ->where($where) + ->order($sort, $order) + ->limit($offset, $limit) + ->select(); $cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root()); - foreach ($list as $k => &$v) - { + foreach ($list as $k => &$v) { $v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url']; } unset($v); @@ -62,8 +75,7 @@ class Attachment extends Backend */ public function select() { - if ($this->request->isAjax()) - { + if ($this->request->isAjax()) { return $this->index(); } return $this->view->fetch(); @@ -74,8 +86,7 @@ class Attachment extends Backend */ public function add() { - if ($this->request->isAjax()) - { + if ($this->request->isAjax()) { $this->error(); } return $this->view->fetch(); @@ -87,18 +98,15 @@ class Attachment extends Backend */ public function del($ids = "") { - if ($ids) - { - \think\Hook::add('upload_delete', function($params) { + if ($ids) { + \think\Hook::add('upload_delete', function ($params) { $attachmentFile = ROOT_PATH . '/public' . $params['url']; - if (is_file($attachmentFile)) - { + if (is_file($attachmentFile)) { @unlink($attachmentFile); } }); $attachmentlist = $this->model->where('id', 'in', $ids)->select(); - foreach ($attachmentlist as $attachment) - { + foreach ($attachmentlist as $attachment) { \think\Hook::listen("upload_delete", $attachment); $attachment->delete(); } diff --git a/application/admin/lang/zh-cn/general/attachment.php b/application/admin/lang/zh-cn/general/attachment.php index b713a4d0..96ea7af7 100644 --- a/application/admin/lang/zh-cn/general/attachment.php +++ b/application/admin/lang/zh-cn/general/attachment.php @@ -2,6 +2,8 @@ return [ 'Id' => 'ID', + 'Admin_id' => '管理员ID', + 'User_id' => '会员ID', 'Url' => '物理路径', 'Imagewidth' => '宽度', 'Imageheight' => '高度', diff --git a/application/admin/model/UserRule.php b/application/admin/model/UserRule.php index 07b64244..641d65b0 100644 --- a/application/admin/model/UserRule.php +++ b/application/admin/model/UserRule.php @@ -41,10 +41,9 @@ class UserRule extends Model public static function getTreeList($selected = []) { - $ruleList = collection(self::where('status', 'normal')->select())->toArray(); + $ruleList = collection(self::where('status', 'normal')->order('weigh desc,id desc')->select())->toArray(); $nodeList = []; - foreach ($ruleList as $k => $v) - { + foreach ($ruleList as $k => $v) { $state = array('selected' => $v['ismenu'] ? false : in_array($v['id'], $selected)); $nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state); } diff --git a/application/admin/view/addon/config.html b/application/admin/view/addon/config.html index ef050c15..327d83c8 100644 --- a/application/admin/view/addon/config.html +++ b/application/admin/view/addon/config.html @@ -15,10 +15,10 @@
{switch $item.type} {case string} - + {/case} {case text} - + {/case} {case array}
@@ -31,10 +31,10 @@
{/case} {case datetime} - + {/case} {case number} - + {/case} {case checkbox} {foreach name="item.content" item="vo"} @@ -48,7 +48,7 @@ {/case} {case value="select" break="0"}{/case} {case value="selects"} - {foreach name="item.content" item="vo"} {/foreach} diff --git a/application/admin/view/addon/index.html b/application/admin/view/addon/index.html index 75dee090..0d5756b1 100644 --- a/application/admin/view/addon/index.html +++ b/application/admin/view/addon/index.html @@ -56,6 +56,9 @@ .form-userinfo .breadcrumb { margin-bottom:10px; } + .btn-toggle { + padding:0; + }
diff --git a/application/admin/view/general/config/index.html b/application/admin/view/general/config/index.html index 44edef96..753a2859 100644 --- a/application/admin/view/general/config/index.html +++ b/application/admin/view/general/config/index.html @@ -45,13 +45,13 @@
{switch $item.type} {case string} - + {/case} {case text} - + {/case} {case editor} - + {/case} {case array}
@@ -64,10 +64,10 @@
{/case} {case datetime} - + {/case} {case number} - + {/case} {case checkbox} {foreach name="item.content" item="vo"} @@ -81,7 +81,7 @@ {/case} {case value="select" break="0"}{/case} {case value="selects"} - {foreach name="item.content" item="vo"} {/foreach} diff --git a/application/config.php b/application/config.php index 2838b036..47b3aac0 100755 --- a/application/config.php +++ b/application/config.php @@ -272,7 +272,7 @@ return [ //自动检测更新 'checkupdate' => false, //版本号 - 'version' => '1.0.0.20180806_beta', + 'version' => '1.0.0.20180911_beta', //API接口地址 'api_url' => 'https://api.fastadmin.net', ], diff --git a/application/index/controller/User.php b/application/index/controller/User.php index fe62e90f..c166476a 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -53,6 +53,17 @@ class User extends Frontend }); } + /** + * 空的请求 + * @param $name + * @return mixed + */ + public function _empty($name) + { + Hook::listen("user_request_empty", $name); + return $this->view->fetch('user/' . $name); + } + /** * 会员中心 */ diff --git a/application/index/lang/zh-cn.php b/application/index/lang/zh-cn.php index a2a5c6ad..c032c8d6 100755 --- a/application/index/lang/zh-cn.php +++ b/application/index/lang/zh-cn.php @@ -104,6 +104,7 @@ return [ 'Features' => '功能特性', 'Home' => '首页', 'Store' => '插件市场', + 'Wxapp' => '小程序', 'Services' => '服务', 'Download' => '下载', 'Demo' => '演示', diff --git a/application/index/view/common/meta.html b/application/index/view/common/meta.html index d75406ff..794db148 100644 --- a/application/index/view/common/meta.html +++ b/application/index/view/common/meta.html @@ -12,7 +12,7 @@ - + diff --git a/application/index/view/common/sidenav.html b/application/index/view/common/sidenav.html index 3902f350..e9b2a850 100644 --- a/application/index/view/common/sidenav.html +++ b/application/index/view/common/sidenav.html @@ -1,4 +1,5 @@
+ {:hook('user_sidenav_before')} + {:hook('user_sidenav_after')}
\ No newline at end of file diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index e7dd9314..0e454f7e 100755 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -41,6 +41,7 @@