From 07c1d06340824e86be500f649146f6481eb04e75 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 13:44:39 +0800 Subject: [PATCH 01/28] =?UTF-8?q?=E5=BF=BD=E7=95=A5svn=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fb8818a5a..3f2ebf8ce 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ composer.lock *.css.map !.gitkeep .env +.svn .vscode -- Gitee From d375f0c6fd1dd5929e0639c84dd597f5a63bb896 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:10:18 +0800 Subject: [PATCH 02/28] =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=8C=85=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn.php | 4 ++ .../admin/lang/zh-cn/general/attachment.php | 39 ++++++++++--------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 0c39e952c..a9affe71a 100755 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -113,6 +113,7 @@ return [ '%d year%s ago' => '%d年前', 'Set to normal' => '设为正常', 'Set to hidden' => '设为隐藏', + 'Set to recommend' => '设为推荐', //提示 'Go back' => '返回首页', 'Jump now' => '立即跳转', @@ -172,4 +173,7 @@ return [ 'Admin log tips' => '管理员可以查看自己所拥有的权限的管理员日志', 'Group tips' => '角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别的下级角色组或管理员', 'Rule tips' => '规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过命令行进行生成规则节点', + 'Test' => '测试', + 'Please input' => '请填写', + 'Please select' => '请选择', ]; diff --git a/application/admin/lang/zh-cn/general/attachment.php b/application/admin/lang/zh-cn/general/attachment.php index 96ea7af72..83f0fde2a 100644 --- a/application/admin/lang/zh-cn/general/attachment.php +++ b/application/admin/lang/zh-cn/general/attachment.php @@ -1,22 +1,25 @@ 'ID', - 'Admin_id' => '管理员ID', - 'User_id' => '会员ID', - 'Url' => '物理路径', - 'Imagewidth' => '宽度', - 'Imageheight' => '高度', - 'Imagetype' => '图片类型', - 'Imageframes' => '图片帧数', - 'Preview' => '预览', - 'Filesize' => '文件大小', - 'Mimetype' => 'Mime类型', - 'Extparam' => '透传数据', - 'Createtime' => '创建日期', - 'Uploadtime' => '上传时间', - 'Storage' => '存储引擎', - 'Upload to third' => '上传到第三方', - 'Upload to local' => '上传到本地', - 'Upload from editor' => '从编辑器上传' + 'Id' => 'ID', + 'Admin_id' => '管理员ID', + 'User_id' => '会员ID', + 'Url' => '物理路径', + 'Imagewidth' => '宽度', + 'Imageheight' => '高度', + 'Imagetype' => '图片类型', + 'Imageframes' => '图片帧数', + 'Preview' => '预览', + 'Filesize' => '文件大小', + 'Mimetype' => 'Mime类型', + 'Extparam' => '透传数据', + 'Createtime' => '创建日期', + 'Uploadtime' => '上传时间', + 'Storage' => '存储引擎', + 'Upload to third' => '上传到第三方', + 'Upload to local' => '上传到本地', + 'Upload from editor' => '从编辑器上传', + 'No file upload or server upload limit exceeded' => '未上传文件或超出服务器上传限制', + 'Uploaded file format is limited' => '上传文件格式受限制', + 'Upload successful' => '上传成功', ]; -- Gitee From 308d0082920677e240acda3c62c5eca9a43875b9 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:17:27 +0800 Subject: [PATCH 03/28] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=A7=84=E5=88=99IDS=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common/library/Menu.php b/application/common/library/Menu.php index 4c20818a4..e8206530d 100644 --- a/application/common/library/Menu.php +++ b/application/common/library/Menu.php @@ -134,7 +134,7 @@ class Menu if ($menu) { // 必须将结果集转换为数组 - $ruleList = collection(AuthRule::order('weigh', 'desc')->field('id,pid,name')->select())->toArray(); + $ruleList = collection(AuthRule::order('weigh', 'desc')->order('id', 'asc')->field('id,pid,name')->select())->toArray(); // 构造菜单数据 $ids = Tree::instance()->init($ruleList)->getChildrenIds($menu['id'], true); } -- Gitee From acfd4cf84e7b18e66ecd7b048591cbf088c01c18 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:36:34 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E7=94=9F=E6=88=90CRUD=E6=97=B6admin=5Fids=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E4=B8=8B=E6=8B=89=E6=A1=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index 40c6c8018..d4472025e 100644 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -265,7 +265,7 @@ class Admin extends Backend /** * 下拉搜索 */ - protected function selectpage() + public function selectpage() { $this->dataLimit = 'auth'; $this->dataLimitField = 'id'; -- Gitee From 34fc4fbec3c13ff6dc681e693b8b09fe1d329ec8 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:38:43 +0800 Subject: [PATCH 05/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=20ajax/area=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E4=B8=80=E9=94=AECRUD=E7=94=9F=E6=88=90=E7=9A=84row?= =?UTF-8?q?=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 649cc41de..50c9a7fb4 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -245,8 +245,14 @@ class Ajax extends Backend */ public function area() { - $province = $this->request->get('province'); - $city = $this->request->get('city'); + $params = $this->request->get("row/a"); + if (!empty($params)) { + $province = isset($params['province']) ? $params['province'] : ''; + $city = isset($params['city']) ? $params['city'] : null; + } else { + $province = $this->request->get('province'); + $city = $this->request->get('city'); + } $where = ['pid' => 0, 'level' => 1]; $provincelist = null; if ($province !== '') { -- Gitee From 3c10bb7c5f1577acabafcf7ded52f4c2041b41aa Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:40:14 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95extparam=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 50c9a7fb4..828e228d2 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -54,6 +54,7 @@ class Ajax extends Backend //判断是否已经存在附件 $sha1 = $file->hash(); + $extparam = $this->request->post(); $upload = Config::get('upload'); @@ -118,6 +119,7 @@ class Ajax extends Backend 'uploadtime' => time(), 'storage' => 'local', 'sha1' => $sha1, + 'extparam' => json_encode($extparam), ); $attachment = model("attachment"); $attachment->data(array_filter($params)); -- Gitee From 3725effc52af12f57e7de4d065ea4614c44047bd Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:41:53 +0800 Subject: [PATCH 07/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A7=84=E5=88=99ruleL?= =?UTF-8?q?ist=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Rule.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/auth/Rule.php b/application/admin/controller/auth/Rule.php index 897f66ba9..b221a90cf 100644 --- a/application/admin/controller/auth/Rule.php +++ b/application/admin/controller/auth/Rule.php @@ -27,7 +27,7 @@ class Rule extends Backend parent::_initialize(); $this->model = model('AuthRule'); // 必须将结果集转换为数组 - $ruleList = collection($this->model->order('weigh', 'desc')->select())->toArray(); + $ruleList = collection($this->model->order('weigh', 'desc')->order('id', 'asc')->select())->toArray(); foreach ($ruleList as $k => &$v) { $v['title'] = __($v['title']); @@ -43,6 +43,7 @@ class Rule extends Backend continue; $ruledata[$v['id']] = $v['title']; } + unset($v); $this->view->assign('ruledata', $ruledata); } -- Gitee From 7534d27bad332be42b4455558b0564a4cf25f1ff Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:42:51 +0800 Subject: [PATCH 08/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A0=91=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Group.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/controller/auth/Group.php b/application/admin/controller/auth/Group.php index 1f573b81e..f1d12bf4f 100644 --- a/application/admin/controller/auth/Group.php +++ b/application/admin/controller/auth/Group.php @@ -254,7 +254,7 @@ class Group extends Backend if (($pid || $parentGroupModel) && (!$id || $currentGroupModel)) { $id = $id ? $id : NULL; - $ruleList = collection(model('AuthRule')->order('weigh', 'desc')->select())->toArray(); + $ruleList = collection(model('AuthRule')->order('weigh', 'desc')->order('id', 'asc')->select())->toArray(); //读取父类角色所有节点列表 $parentRuleList = []; if (in_array('*', explode(',', $parentGroupModel->rules))) -- Gitee From 2b4c59b62922833b8d6cd54d972e3ade2a495344 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:48:16 +0800 Subject: [PATCH 09/28] =?UTF-8?q?selectpage=E6=94=AF=E6=8C=81=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=A0=91=E5=BD=A2=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index b8c05b5a9..421d80645 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -8,6 +8,7 @@ use think\Controller; use think\Hook; use think\Lang; use think\Session; +use fast\Tree; /** * 后台控制器基类 @@ -425,6 +426,13 @@ class Backend extends Controller $searchfield = (array)$this->request->request("searchField/a"); //自定义搜索条件 $custom = (array)$this->request->request("custom/a"); + //是否返回树形结构 + $istree = $this->request->request("isTree", 0); + $ishtml = $this->request->request("isHtml", 0); + if($istree) { + $word = []; + $pagesize = 99999; + } $order = []; foreach ($orderby as $k => $v) { $order[$v[0]] = $v[1]; @@ -467,9 +475,21 @@ class Backend extends Controller unset($item['password'], $item['salt']); $list[] = [ $primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '', - $field => isset($item[$field]) ? $item[$field] : '' + $field => isset($item[$field]) ? $item[$field] : '', + 'pid' => isset($item['pid']) ? $item['pid'] : 0 ]; } + if($istree) { + $tree = Tree::instance(); + $tree->init(collection($list)->toArray(), 'pid'); + $list = $tree->getTreeList($tree->getTreeArray(0), $field); + if(!$ishtml){ + foreach ($list as &$item) { + $item = str_replace(' ', ' ', $item); + } + unset($item); + } + } } //这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮 return json(['list' => $list, 'total' => $total]); -- Gitee From ead1f12aab01f15d7666c75d28139a90c900a7a7 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 14:51:16 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E6=97=B6=E4=B8=8D=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BD=AC=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index 421d80645..ab99b3ec2 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -139,6 +139,10 @@ class Backend extends Controller Hook::listen('admin_nologin', $this); $url = Session::get('referer'); $url = $url ? $url : $this->request->url(); + if ($url == '/') { + $this->redirect('index/login', [], 302, ['referer' => $url]); + exit; + } $this->error(__('Please login first'), url('index/login', ['url' => $url])); } // 判断是否需要验证权限 -- Gitee From 5182cf28c9319a0e6e3f4d98cd01ebd4a416f713 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 16 Feb 2019 17:35:24 +0800 Subject: [PATCH 11/28] =?UTF-8?q?=E6=94=B9=E8=BF=9Bbuild=5Ftoolbar?= =?UTF-8?q?=E7=9A=84import=E6=94=AF=E6=8C=81=E6=A8=A1=E7=89=88=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/common.php | 37 +++++++++++++++++++++++++++++++++--- public/template/.gitkeep | 1 + 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 public/template/.gitkeep diff --git a/application/admin/common.php b/application/admin/common.php index 2b61dde68..c3232f8e5 100755 --- a/application/admin/common.php +++ b/application/admin/common.php @@ -113,7 +113,7 @@ if (!function_exists('build_toolbar')) { 'add' => ['javascript:;', 'btn btn-success btn-add', 'fa fa-plus', __('Add'), __('Add')], 'edit' => ['javascript:;', 'btn btn-success btn-edit btn-disabled disabled', 'fa fa-pencil', __('Edit'), __('Edit')], 'del' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', 'fa fa-trash', __('Delete'), __('Delete')], - 'import' => ['javascript:;', 'btn btn-danger btn-import', 'fa fa-upload', __('Import'), __('Import')], + 'import' => ['javascript:;', 'btn btn-info btn-import', 'fa fa-upload', __('Import'), __('Import')], ]; $btnAttr = array_merge($btnAttr, $attr); $html = []; @@ -123,8 +123,39 @@ if (!function_exists('build_toolbar')) { continue; } list($href, $class, $icon, $text, $title) = $btnAttr[$v]; - $extend = $v == 'import' ? 'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"' : ''; - $html[] = ' ' . $text . ''; + //$extend = $v == 'import' ? 'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"' : ''; + //$html[] = ' ' . $text . ''; + if ($v == 'import') { + $template = str_replace('/', '_', $controller); + $download = ''; + if (file_exists("./template/{$template}.xlsx")) { + $download .= "\n