Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
160e506bfe | ||
![]() |
a859e98207 |
57
README.md
57
README.md
@@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<p align="center"><code>CatchAdmin</code>是一款基于<a href="http://www.thinkphp.cn/" target="_blank">thinkphp framework</a>和
|
<p align="center"><code>CatchAdmin</code>是一款基于<a href="http://www.thinkphp.cn/" target="_blank">thinkphp framework</a>和
|
||||||
<a href="https://github.com/PanJiaChen/vue-element-admin/">element admin</a>二次开发而成后台管理系统。因为 thinkphp 的简单高效,文档齐全。在看了很多 thinkphp 生态中的后台管理系统,发现没有一款合适的前后端分离系统。遂开发了 CatchAdmin。
|
<a href="https://pro.loacg.com/docs/getting-started">ant degisn pro vue</a>二次开发而成的后台管理系统,采用了目前趋势的前后端分离开发模式,后端仅需要提供简洁的 API 数据结构,前端负责呈现数据。目前前端采用数据驱动,大大提高了开发效率。这不仅仅是一个项目,更是后端更新技术栈的一次实践</p>
|
||||||
完全利用了 thinkphp6 的新版本特性 ServiceProvider,将管理系统模块之间的耦合降到了最低限度。每个模块之间都有独立的 controller,路由,模型,数据表`。在开发上尽可能将模块之间的影响降到最低,降低了开发上的难度。基于 CatchAdmin 可以开发 cms,CRM,OA 等
|
|
||||||
等系统。也封装了很多实用的工具,提升开发体验。
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="http://doc.catchadmin.com/">文档</a> |
|
<a href="http://doc.catchadmin.com/">文档</a> |
|
||||||
@@ -31,56 +28,18 @@
|
|||||||
<img src="https://svg.hamm.cn/badge.svg?key=License&value=Apache-2.0"/>
|
<img src="https://svg.hamm.cn/badge.svg?key=License&value=Apache-2.0"/>
|
||||||
</p >
|
</p >
|
||||||
|
|
||||||
## 功能
|
|
||||||
- [x] `用户管理` 后台用户管理
|
|
||||||
- [x] `部门管理` 配置公司的部门结构,支持树形结构
|
|
||||||
- [x] `岗位管理` 配置后台用户的职务
|
|
||||||
- [x] `菜单管理` 配置系统菜单,按钮等等
|
|
||||||
- [x] `角色管理` 配置用户担当的角色,分配权限
|
|
||||||
- [x] `数据字典` 管理后台表结构
|
|
||||||
- [x] `操作日志` 后台用户操作记录
|
|
||||||
- [x] `登录日志` 后台系统用户的登录记录
|
|
||||||
- [x] `代码生成` 生成 API 端的 CURD 操作
|
|
||||||
- [x] `敏感词` 支持敏感词配置
|
|
||||||
- [x] `附件管理` 可管理上传的文件
|
|
||||||
- [ ] `微信管理`
|
|
||||||
|
|
||||||
## 项目地址
|
## 项目地址
|
||||||
- [github 地址](https://github.com/yanwenwu/catch-admin)
|
- [github 地址](https://github.com/yanwenwu/catch-admin)
|
||||||
- [gitee 地址](https://gitee.com/jaguarjack/catchAdmin)
|
- [gitee 地址](https://gitee.com/jaguarjack/catchAdmin)
|
||||||
- [前端 Vue 项目地址](https://github.com/yanwenwu/catch-admin-vue)
|
- [前端 Vue 项目地址](https://github.com/yanwenwu/catch-admin-vue)
|
||||||
- [文档地址](https://github.com/catch-admin/document)[个人精力实在有限,希望可以小伙伴们可以一起维护文档]
|
- [文档地址](https://github.com/catch-admin/document)[个人精力实在有限,希望可以小伙伴们可以一起维护文档]
|
||||||
## 预览
|
## 预览
|
||||||
<table>
|
<p align="center">
|
||||||
<tr>
|
<img src="https://cdn.learnku.com/uploads/images/202005/17/18206/0ECPy72zUZ.png!large">
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucNXq.md.png"></td>
|
</p>
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucm6I.md.png"></td>
|
<p align="center">
|
||||||
</tr>
|
<img src="https://cdn.learnku.com/uploads/images/202005/17/18206/ngzSU0A9SI.png!large">
|
||||||
<tr>
|
</p>
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucZpd.md.png"></td>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wuce1A.md.png"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucnXt.md.png"></td>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucKnP.md.png"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wuc3tg.md.png"></td>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucM0f.md.png"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucQ78.md.png"></td>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wuc1AS.md.png"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wuc8hQ.md.png"></td>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucY1s.md.png"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wucJpj.md.png"></td>
|
|
||||||
<td><img src="https://s1.ax1x.com/2020/09/07/wuctcn.md.png"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
## 环境要求
|
## 环境要求
|
||||||
- php7.1+ (需以下扩展)
|
- php7.1+ (需以下扩展)
|
||||||
@@ -151,7 +110,7 @@ composer create-project jaguarjack/catchadmin:dev-master
|
|||||||
> 排名部分先后
|
> 排名部分先后
|
||||||
|
|
||||||
- [top-think/think](https://github.com/top-think/think)
|
- [top-think/think](https://github.com/top-think/think)
|
||||||
- [element-admin](https://panjiachen.gitee.io/vue-element-admin-site/zh/)
|
- [ant-design-pro-vue](https://github.com/sendya/ant-design-pro-vue)
|
||||||
- [thans/tp-jwt-auth](https://packagist.org/packages/thans/tp-jwt-auth)
|
- [thans/tp-jwt-auth](https://packagist.org/packages/thans/tp-jwt-auth)
|
||||||
- [workerman/workerman](https://github.com/walkor/Workerman)
|
- [workerman/workerman](https://github.com/walkor/Workerman)
|
||||||
- [jaguarjack/think-filesystem-cloud](https://github.com/yanwenwu/think-filesystem-cloud)
|
- [jaguarjack/think-filesystem-cloud](https://github.com/yanwenwu/think-filesystem-cloud)
|
||||||
|
@@ -33,7 +33,7 @@ class Request extends \think\Request
|
|||||||
$user = $this->auth->guard($guard ? : config('catch.auth.default.guard'))->user();
|
$user = $this->auth->guard($guard ? : config('catch.auth.default.guard'))->user();
|
||||||
|
|
||||||
if ($user->status == Users::DISABLE) {
|
if ($user->status == Users::DISABLE) {
|
||||||
throw new LoginFailedException('该用户已被禁用', Code::USER_FORBIDDEN);
|
throw new LoginFailedException('该用户已被禁用');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if ($e instanceof TokenExpiredException) {
|
if ($e instanceof TokenExpiredException) {
|
||||||
@@ -45,7 +45,7 @@ class Request extends \think\Request
|
|||||||
if ($e instanceof TokenInvalidException) {
|
if ($e instanceof TokenInvalidException) {
|
||||||
throw new FailedException('token 不合法', Code::LOST_LOGIN);
|
throw new FailedException('token 不合法', Code::LOST_LOGIN);
|
||||||
}
|
}
|
||||||
throw new FailedException('认证失败: '. $e->getMessage(), $e->getCode());
|
throw new FailedException('认证失败: '. $e->getMessage(), Code::LOST_LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
BIN
catch/.DS_Store
vendored
BIN
catch/.DS_Store
vendored
Binary file not shown.
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace catchAdmin\cms;
|
|
||||||
|
|
||||||
use catcher\ModuleService;
|
|
||||||
|
|
||||||
class CmsService extends ModuleService
|
|
||||||
{
|
|
||||||
public function loadRouteFrom()
|
|
||||||
{
|
|
||||||
// TODO: Implement loadRouteFrom() method.
|
|
||||||
return __DIR__ . DIRECTORY_SEPARATOR . 'route.php';
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace catchAdmin\cms\model;
|
|
||||||
|
|
||||||
use catcher\base\CatchModel as Model;
|
|
||||||
|
|
||||||
class Hello extends Model
|
|
||||||
{
|
|
||||||
protected $name = 'hello';
|
|
||||||
|
|
||||||
protected $field = [
|
|
||||||
'id', //
|
|
||||||
'good', //
|
|
||||||
'creator_id', // 创建人ID
|
|
||||||
'created_at', // 创建时间
|
|
||||||
'updated_at', // 更新时间
|
|
||||||
'deleted_at', // 软删除
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "内容管理",
|
|
||||||
"alias": "cms",
|
|
||||||
"description": "cms,博客,企业站点,内容管理",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"keywords": [],
|
|
||||||
"order": 0,
|
|
||||||
"services": [
|
|
||||||
"\\catchAdmin\\cms\\CmsService"
|
|
||||||
],
|
|
||||||
"aliases": {},
|
|
||||||
"files": [],
|
|
||||||
"requires": [],
|
|
||||||
"enable": true
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// you should user `$router`
|
|
||||||
$router->group(function () use ($router){
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//hello路由
|
|
||||||
$router->resource('hello', '\catchAdmin\cms\controller\Hello')->middleware('auth');
|
|
||||||
|
|
||||||
//hello路由
|
|
||||||
$router->resource('hello', '\catchAdmin\cms\controller\Hello')->middleware('auth');
|
|
@@ -11,13 +11,15 @@ class LoginLogEvent
|
|||||||
{
|
{
|
||||||
$agent = request()->header('user-agent');
|
$agent = request()->header('user-agent');
|
||||||
|
|
||||||
|
$username = Users::where('email', $params['email'])->value('username');
|
||||||
|
|
||||||
app(LoginLog::class)->storeBy([
|
app(LoginLog::class)->storeBy([
|
||||||
'login_name' => $params['login_name'],
|
'login_name' => $username ? : $params['email'],
|
||||||
'login_ip' => request()->ip(),
|
'login_ip' => request()->ip(),
|
||||||
'browser' => $this->getBrowser($agent),
|
'browser' => $this->getBrowser($agent),
|
||||||
'os' => $this->getOs($agent),
|
'os' => $this->getOs($agent),
|
||||||
'login_at' => time(),
|
'login_at' => time(),
|
||||||
'status' => $params['success'],
|
'status' => $params['success'] ? 1 : 2,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,6 @@ use catchAdmin\permissions\model\Users;
|
|||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchAuth;
|
use catcher\CatchAuth;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use catcher\Code;
|
|
||||||
use catcher\exceptions\LoginFailedException;
|
use catcher\exceptions\LoginFailedException;
|
||||||
use thans\jwt\facade\JWTAuth;
|
use thans\jwt\facade\JWTAuth;
|
||||||
|
|
||||||
@@ -22,15 +21,29 @@ class Index extends CatchController
|
|||||||
*/
|
*/
|
||||||
public function login(LoginRequest $request, CatchAuth $auth)
|
public function login(LoginRequest $request, CatchAuth $auth)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$params = $request->param();
|
$params = $request->param();
|
||||||
|
|
||||||
$token = $auth->attempt($params);
|
$token = $auth->attempt($params);
|
||||||
return CatchResponse::success([
|
|
||||||
'token' => $token,
|
$user = $auth->user();
|
||||||
], '登录成功');
|
|
||||||
} catch (\Exception $exception) {
|
if ($user->status == Users::DISABLE) {
|
||||||
return CatchResponse::fail('登录失败', $exception->getCode());
|
throw new LoginFailedException('该用户已被禁用');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 记录用户登录
|
||||||
|
$user->last_login_ip = request()->ip();
|
||||||
|
$user->last_login_time = time();
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
// 登录事件
|
||||||
|
$params['success'] = $token;
|
||||||
|
|
||||||
|
event('loginLog', $params);
|
||||||
|
|
||||||
|
return $token ? CatchResponse::success([
|
||||||
|
'token' => $token,
|
||||||
|
], '登录成功') : CatchResponse::success('', '登录失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5,7 +5,6 @@ use catcher\base\CatchController;
|
|||||||
use catchAdmin\permissions\model\Department as DepartmentModel;
|
use catchAdmin\permissions\model\Department as DepartmentModel;
|
||||||
use catcher\base\CatchRequest;
|
use catcher\base\CatchRequest;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use catcher\exceptions\FailedException;
|
|
||||||
use catcher\Tree;
|
use catcher\Tree;
|
||||||
|
|
||||||
class Department extends CatchController
|
class Department extends CatchController
|
||||||
@@ -64,10 +63,6 @@ class Department extends CatchController
|
|||||||
*/
|
*/
|
||||||
public function delete($id): \think\response\Json
|
public function delete($id): \think\response\Json
|
||||||
{
|
{
|
||||||
if ($this->department->where('parent_id', $id)->find()) {
|
|
||||||
throw new FailedException('存在子部门,无法删除');
|
|
||||||
}
|
|
||||||
|
|
||||||
return CatchResponse::success($this->department->deleteBy($id));
|
return CatchResponse::success($this->department->deleteBy($id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,6 @@ use catcher\exceptions\FailedException;
|
|||||||
use catcher\library\ParseClass;
|
use catcher\library\ParseClass;
|
||||||
use catcher\Tree;
|
use catcher\Tree;
|
||||||
use catchAdmin\permissions\model\Permissions;
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use think\helper\Str;
|
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
|
|
||||||
class Permission extends CatchController
|
class Permission extends CatchController
|
||||||
@@ -67,22 +66,9 @@ class Permission extends CatchController
|
|||||||
|
|
||||||
// 如果是子分类 自动写入父类模块
|
// 如果是子分类 自动写入父类模块
|
||||||
$parentId = $params['parent_id'] ?? 0;
|
$parentId = $params['parent_id'] ?? 0;
|
||||||
// 按钮类型寻找上级
|
if ($parentId) {
|
||||||
if ($params['type'] == Permissions::BTN_TYPE && $parentId) {
|
$parent = $this->permissions->findBy($parentId);
|
||||||
$permissionMark = $params['permission_mark'];
|
$params['module'] = $parent->module;
|
||||||
// 查找父级
|
|
||||||
$parentPermission = $this->permissions->findBy($parentId);
|
|
||||||
// 如果父级是顶级 parent_id = 0
|
|
||||||
if ($parentPermission->parent_id) {
|
|
||||||
if (Str::contains($parentPermission->permission_mark, '@')) {
|
|
||||||
list($controller, $action) = explode('@', $parentPermission->permission_mark);
|
|
||||||
$permissionMark = $controller . '@' . $permissionMark;
|
|
||||||
} else {
|
|
||||||
$permissionMark = $parentPermission->permission_mark .'@'. $permissionMark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$params['permission_mark'] = $permissionMark;
|
|
||||||
$params['module'] = $parentPermission->module;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CatchResponse::success($this->permissions->storeBy($params));
|
return CatchResponse::success($this->permissions->storeBy($params));
|
||||||
@@ -99,33 +85,6 @@ class Permission extends CatchController
|
|||||||
{
|
{
|
||||||
$permission = $this->permissions->findBy($id);
|
$permission = $this->permissions->findBy($id);
|
||||||
|
|
||||||
$params = $request->param();
|
|
||||||
// 按钮类型
|
|
||||||
if ($params['type'] == Permissions::BTN_TYPE && $permission->parent_id) {
|
|
||||||
$parentPermission = $this->permissions->findBy($permission->parent_id);
|
|
||||||
|
|
||||||
$permissionMark = $params['permission_mark'];
|
|
||||||
if ($parentPermission->parent_id) {
|
|
||||||
if (Str::contains($parentPermission->permission_mark, '@')) {
|
|
||||||
list($controller, $action) = explode('@', $parentPermission->permission_mark);
|
|
||||||
$permissionMark = $controller . '@' . $permissionMark;
|
|
||||||
} else {
|
|
||||||
$permissionMark = $parentPermission->permission_mark .'@'. $permissionMark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$params['permission_mark'] = $permissionMark;
|
|
||||||
|
|
||||||
|
|
||||||
$this->permissions->where('id',$id)->update(array_merge($params, [
|
|
||||||
'parent_id' => $permission->parent_id,
|
|
||||||
'level' => $permission->level,
|
|
||||||
'updated_at' => time()
|
|
||||||
]));
|
|
||||||
|
|
||||||
return CatchResponse::success();
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = array_merge($request->param(), [
|
$params = array_merge($request->param(), [
|
||||||
'parent_id' => $permission->parent_id,
|
'parent_id' => $permission->parent_id,
|
||||||
'level' => $permission->level
|
'level' => $permission->level
|
||||||
@@ -175,9 +134,17 @@ class Permission extends CatchController
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$this->permissions->show($id);
|
$permission = $this->permissions->findBy($id);
|
||||||
|
|
||||||
return CatchResponse::success();
|
$permission->status = $permission->status == Permissions::ENABLE ? Permissions::DISABLE : Permissions::ENABLE;
|
||||||
|
|
||||||
|
if ($permission->save()) {
|
||||||
|
$this->permissions->where('parent_id', $id)->update([
|
||||||
|
'status' => $permission->status,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CatchResponse::success($permission->save());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,15 +160,14 @@ class Permission extends CatchController
|
|||||||
public function getMethods($id, ParseClass $parseClass)
|
public function getMethods($id, ParseClass $parseClass)
|
||||||
{
|
{
|
||||||
$permission = Permissions::where('id', $id)->find();
|
$permission = Permissions::where('id', $id)->find();
|
||||||
|
|
||||||
$module = $permission->module;
|
$module = $permission->module;
|
||||||
|
|
||||||
$controller = explode('@', $permission->permission_mark)[0];
|
$controller = explode('@', $permission->permission_mark)[0];
|
||||||
|
|
||||||
try {
|
|
||||||
$methods = $parseClass->setModule('catch')->setRule($module, $controller)->onlySelfMethods();
|
$methods = $parseClass->setModule('catch')->setRule($module, $controller)->onlySelfMethods();
|
||||||
|
|
||||||
return CatchResponse::success($methods);
|
return CatchResponse::success($methods);
|
||||||
}catch (\Exception $e) {
|
|
||||||
return CatchResponse::success([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
namespace catchAdmin\permissions\controller;
|
namespace catchAdmin\permissions\controller;
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Permissions;
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use catchAdmin\permissions\model\Roles;
|
|
||||||
use catcher\base\CatchRequest as Request;
|
use catcher\base\CatchRequest as Request;
|
||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
@@ -39,19 +38,14 @@ class Role extends CatchController
|
|||||||
*/
|
*/
|
||||||
public function save(Request $request)
|
public function save(Request $request)
|
||||||
{
|
{
|
||||||
$params = $request->param();
|
$this->role->storeBy($request->param());
|
||||||
|
|
||||||
if (Roles::where('identify', $params['identify'])->find()) {
|
$permissions = $request->param('permissions');
|
||||||
throw new FailedException('角色标识 [' . $params['identify'] . ']已存在');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->role->storeBy($params);
|
|
||||||
$permissions = $params['permissions'];
|
|
||||||
if (!empty($permissions)) {
|
if (!empty($permissions)) {
|
||||||
$this->role->attachPermissions(array_unique($permissions));
|
$this->role->attachPermissions(array_unique($permissions));
|
||||||
}
|
}
|
||||||
if (!empty($params['permissions'])) {
|
if (!empty($request->param('departments'))) {
|
||||||
$this->role->attachDepartments($params['permissions']);
|
$this->role->attachDepartments($request->param('departments'));
|
||||||
}
|
}
|
||||||
// 添加角色
|
// 添加角色
|
||||||
return CatchResponse::success();
|
return CatchResponse::success();
|
||||||
@@ -75,10 +69,6 @@ class Role extends CatchController
|
|||||||
*/
|
*/
|
||||||
public function update($id, Request $request): Json
|
public function update($id, Request $request): Json
|
||||||
{
|
{
|
||||||
if (Roles::where('identify', $request->param('identify'))->where('id', '<>', $id)->find()) {
|
|
||||||
throw new FailedException('角色标识 [' . $request->param('identify') . ']已存在');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->role->updateBy($id, $request->param());
|
$this->role->updateBy($id, $request->param());
|
||||||
$role = $this->role->findBy($id);
|
$role = $this->role->findBy($id);
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catchAdmin\permissions\controller;
|
namespace catchAdmin\permissions\controller;
|
||||||
|
|
||||||
use catchAdmin\permissions\excel\UserExport;
|
|
||||||
use catcher\base\CatchRequest as Request;
|
use catcher\base\CatchRequest as Request;
|
||||||
use catchAdmin\permissions\model\Permissions;
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use catchAdmin\permissions\model\Roles;
|
use catchAdmin\permissions\model\Roles;
|
||||||
@@ -12,7 +11,6 @@ use catcher\base\CatchController;
|
|||||||
use catcher\CatchAuth;
|
use catcher\CatchAuth;
|
||||||
use catcher\CatchCacheKeys;
|
use catcher\CatchCacheKeys;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use catcher\library\excel\Excel;
|
|
||||||
use catcher\Tree;
|
use catcher\Tree;
|
||||||
use catcher\Utils;
|
use catcher\Utils;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
@@ -51,7 +49,7 @@ class User extends CatchController
|
|||||||
{
|
{
|
||||||
$user = $auth->user();
|
$user = $auth->user();
|
||||||
|
|
||||||
$roles = $user->getRoles()->column('identify');
|
$roles = $user->getRoles();
|
||||||
|
|
||||||
$permissionIds = $user->getPermissionsBy($user->id);
|
$permissionIds = $user->getPermissionsBy($user->id);
|
||||||
// 缓存用户权限
|
// 缓存用户权限
|
||||||
@@ -88,9 +86,7 @@ class User extends CatchController
|
|||||||
|
|
||||||
$this->user->attachRoles($request->param('roles'));
|
$this->user->attachRoles($request->param('roles'));
|
||||||
|
|
||||||
if ($request->param('jobs')) {
|
|
||||||
$this->user->attachJobs($request->param('jobs'));
|
$this->user->attachJobs($request->param('jobs'));
|
||||||
}
|
|
||||||
|
|
||||||
return CatchResponse::success('', '添加成功');
|
return CatchResponse::success('', '添加成功');
|
||||||
}
|
}
|
||||||
@@ -229,18 +225,4 @@ class User extends CatchController
|
|||||||
'hasRoles' => $roleIds,
|
'hasRoles' => $roleIds,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出
|
|
||||||
*
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @param Excel $excel
|
|
||||||
* @param UserExport $userExport
|
|
||||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
|
||||||
* @return \think\response\Json
|
|
||||||
*/
|
|
||||||
public function export(Excel $excel, UserExport $userExport)
|
|
||||||
{
|
|
||||||
return CatchResponse::success($excel->save($userExport, Utils::publicPath('export/users')));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use think\migration\Migrator;
|
|
||||||
use think\migration\db\Column;
|
|
||||||
|
|
||||||
class UpdateRoles extends Migrator
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
|
||||||
*
|
|
||||||
* The following commands can be used in this method and Phinx will
|
|
||||||
* automatically reverse them when rolling back:
|
|
||||||
*
|
|
||||||
* createTable
|
|
||||||
* renameTable
|
|
||||||
* addColumn
|
|
||||||
* renameColumn
|
|
||||||
* addIndex
|
|
||||||
* addForeignKey
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change()
|
|
||||||
{
|
|
||||||
if ($this->hasTable('roles')) {
|
|
||||||
$table = $this->table('roles');
|
|
||||||
|
|
||||||
$table->addColumn('identify', 'string', [
|
|
||||||
'limit' => 20,
|
|
||||||
'default' => 1,
|
|
||||||
'comment' => '角色的标识,用英文表示,用于后台路由权限',
|
|
||||||
'after' => 'role_name'])
|
|
||||||
->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use think\migration\Migrator;
|
|
||||||
use think\migration\db\Column;
|
|
||||||
|
|
||||||
class UpdatePermissions extends Migrator
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
|
||||||
*
|
|
||||||
* The following commands can be used in this method and Phinx will
|
|
||||||
* automatically reverse them when rolling back:
|
|
||||||
*
|
|
||||||
* createTable
|
|
||||||
* renameTable
|
|
||||||
* addColumn
|
|
||||||
* renameColumn
|
|
||||||
* addIndex
|
|
||||||
* addForeignKey
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change()
|
|
||||||
{
|
|
||||||
if ($this->hasTable('permissions')) {
|
|
||||||
$table = $this->table('permissions');
|
|
||||||
|
|
||||||
$table->removeColumn('method')
|
|
||||||
->removeColumn('hide_children_in_menu')
|
|
||||||
->renameColumn('status', 'hidden')
|
|
||||||
->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use think\migration\Seeder;
|
use think\migration\Seeder;
|
||||||
|
|
||||||
class PermissionsMenusSeed extends Seeder
|
class PermissionSeed extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run Method.
|
* Run Method.
|
||||||
@@ -27,18 +27,20 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'parent_id' => 0,
|
'parent_id' => 0,
|
||||||
'level' => '',
|
'level' => '',
|
||||||
'route' => '/permissions',
|
'route' => '/permissions',
|
||||||
'icon' => 'el-icon-cpu',
|
'icon' => 'appstore',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'permission',
|
'method' => 'get',
|
||||||
'component' => 'layout',
|
'permission_mark' => 'permission@index',
|
||||||
'redirect' => '/permissions/users',
|
'component' => 'pageView',
|
||||||
'hidden' => 1,
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 100,
|
'sort' => 100,
|
||||||
'created_at' => 1587461455,
|
'created_at' => 1587461455,
|
||||||
'updated_at' => 1599362429,
|
'updated_at' => 1593044101,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -49,18 +51,20 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'parent_id' => 1,
|
'parent_id' => 1,
|
||||||
'level' => '1',
|
'level' => '1',
|
||||||
'route' => '/permissions/users',
|
'route' => '/permissions/users',
|
||||||
'icon' => 'el-icon-user',
|
'icon' => 'user',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'user',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'user@index',
|
||||||
'component' => 'users',
|
'component' => 'users',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 10,
|
'sort' => 10,
|
||||||
'created_at' => 1587461597,
|
'created_at' => 1587461597,
|
||||||
'updated_at' => 1599362429,
|
'updated_at' => 1592371975,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -74,15 +78,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@index',
|
'permission_mark' => 'user@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461647,
|
'created_at' => 1587461647,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1591316160,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -95,15 +101,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@create',
|
'permission_mark' => 'user@create',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461696,
|
'created_at' => 1587461696,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -116,15 +124,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@save',
|
'permission_mark' => 'user@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461721,
|
'created_at' => 1587461721,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1591345475,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -137,15 +147,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@edit',
|
'permission_mark' => 'user@edit',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461742,
|
'created_at' => 1587461742,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1591345504,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -158,15 +170,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@update',
|
'permission_mark' => 'user@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461762,
|
'created_at' => 1587461762,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
5 =>
|
5 =>
|
||||||
@@ -179,15 +193,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@delete',
|
'permission_mark' => 'user@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461841,
|
'created_at' => 1587461841,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
6 =>
|
6 =>
|
||||||
@@ -200,15 +216,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@switchStatus',
|
'permission_mark' => 'user@switchStatus',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461876,
|
'created_at' => 1587461876,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
7 =>
|
7 =>
|
||||||
@@ -221,15 +239,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'user@recover',
|
'permission_mark' => 'user@recover',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461901,
|
'created_at' => 1587461901,
|
||||||
'updated_at' => 1599030266,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -241,18 +261,20 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'parent_id' => 1,
|
'parent_id' => 1,
|
||||||
'level' => '1',
|
'level' => '1',
|
||||||
'route' => '/permissions/roles',
|
'route' => '/permissions/roles',
|
||||||
'icon' => 'el-icon-s-custom',
|
'icon' => 'usergroup-add',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'role',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'role@index',
|
||||||
'component' => 'roles',
|
'component' => 'roles',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 9,
|
'sort' => 9,
|
||||||
'created_at' => 1587461939,
|
'created_at' => 1587461939,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1592371974,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -266,15 +288,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@index',
|
'permission_mark' => 'role@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587461984,
|
'created_at' => 1587461984,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1591341461,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -287,15 +311,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@create',
|
'permission_mark' => 'role@create',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462007,
|
'created_at' => 1587462007,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -308,15 +334,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@save',
|
'permission_mark' => 'role@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462021,
|
'created_at' => 1587462021,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -329,15 +357,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@edit',
|
'permission_mark' => 'role@edit',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462040,
|
'created_at' => 1587462040,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -350,15 +380,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@update',
|
'permission_mark' => 'role@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462058,
|
'created_at' => 1587462058,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
5 =>
|
5 =>
|
||||||
@@ -371,15 +403,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@delete',
|
'permission_mark' => 'role@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462070,
|
'created_at' => 1587462070,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
6 =>
|
6 =>
|
||||||
@@ -392,15 +426,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'role@getPermissions',
|
'permission_mark' => 'role@getPermissions',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462094,
|
'created_at' => 1587462094,
|
||||||
'updated_at' => 1599362438,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -412,18 +448,20 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'parent_id' => 1,
|
'parent_id' => 1,
|
||||||
'level' => '1',
|
'level' => '1',
|
||||||
'route' => '/permissions/rules',
|
'route' => '/permissions/rules',
|
||||||
'icon' => 'el-icon-collection-tag',
|
'icon' => 'build',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'permission',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'permission@index',
|
||||||
'component' => 'rules',
|
'component' => 'rules',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 8,
|
'sort' => 8,
|
||||||
'created_at' => 1587462147,
|
'created_at' => 1587462147,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1592371979,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -437,15 +475,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'permission@index',
|
'permission_mark' => 'permission@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462205,
|
'created_at' => 1587462205,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -458,15 +498,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'permission@create',
|
'permission_mark' => 'permission@create',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462232,
|
'created_at' => 1587462232,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -479,36 +521,40 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'permission@save',
|
'permission_mark' => 'permission@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462250,
|
'created_at' => 1587462250,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
array (
|
array (
|
||||||
'id' => 23,
|
'id' => 23,
|
||||||
'permission_name' => '禁用/启用',
|
'permission_name' => '查看',
|
||||||
'parent_id' => 19,
|
'parent_id' => 19,
|
||||||
'level' => '1-19',
|
'level' => '1-19',
|
||||||
'route' => '',
|
'route' => '',
|
||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'permission@show',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'permission@edit',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462273,
|
'created_at' => 1587462273,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -521,15 +567,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'permission@update',
|
'permission_mark' => 'permission@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462284,
|
'created_at' => 1587462284,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
5 =>
|
5 =>
|
||||||
@@ -542,36 +590,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'permission@delete',
|
'permission_mark' => 'permission@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462296,
|
'created_at' => 1587462296,
|
||||||
'updated_at' => 1599362475,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
'id' => 106,
|
|
||||||
'permission_name' => '权限方法',
|
|
||||||
'parent_id' => 19,
|
|
||||||
'level' => '1-19',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'permissions',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'permission@getMethods',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1599221913,
|
|
||||||
'updated_at' => 1599362475,
|
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -583,18 +612,20 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'parent_id' => 1,
|
'parent_id' => 1,
|
||||||
'level' => '1',
|
'level' => '1',
|
||||||
'route' => '/permissions/departments',
|
'route' => '/permissions/departments',
|
||||||
'icon' => 'el-icon-monitor',
|
'icon' => 'desktop',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'departments',
|
'permission_mark' => 'departments',
|
||||||
'component' => 'departments',
|
'component' => 'departments',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 7,
|
'sort' => 7,
|
||||||
'created_at' => 1587462488,
|
'created_at' => 1587462488,
|
||||||
'updated_at' => 1599362429,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -608,15 +639,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'department@index',
|
'permission_mark' => 'department@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462529,
|
'created_at' => 1587462529,
|
||||||
'updated_at' => 1599030565,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -629,15 +662,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'department@save',
|
'permission_mark' => 'department@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462548,
|
'created_at' => 1587462548,
|
||||||
'updated_at' => 1599030565,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -650,15 +685,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'department@update',
|
'permission_mark' => 'department@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462579,
|
'created_at' => 1587462579,
|
||||||
'updated_at' => 1599030565,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -671,15 +708,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'department@delete',
|
'permission_mark' => 'department@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462592,
|
'created_at' => 1587462592,
|
||||||
'updated_at' => 1599030565,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -691,18 +730,20 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'parent_id' => 1,
|
'parent_id' => 1,
|
||||||
'level' => '1',
|
'level' => '1',
|
||||||
'route' => '/permissions/jobs',
|
'route' => '/permissions/jobs',
|
||||||
'icon' => 'el-icon-setting',
|
'icon' => 'skin',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'job',
|
'permission_mark' => 'job',
|
||||||
'component' => 'jobs',
|
'component' => 'jobs',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462707,
|
'created_at' => 1587462707,
|
||||||
'updated_at' => 1599362429,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -716,15 +757,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'job@indexs',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'job@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 2,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462757,
|
'created_at' => 1587462757,
|
||||||
'updated_at' => 1598959522,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -737,15 +780,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'job@save',
|
'permission_mark' => 'job@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 2,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462774,
|
'created_at' => 1587462774,
|
||||||
'updated_at' => 1598959522,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -758,15 +803,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'job@update',
|
'permission_mark' => 'job@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 2,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462785,
|
'created_at' => 1587462785,
|
||||||
'updated_at' => 1598959522,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -779,15 +826,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'job@delete',
|
'permission_mark' => 'job@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 2,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462794,
|
'created_at' => 1587462794,
|
||||||
'updated_at' => 1598959522,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -800,15 +849,17 @@ class PermissionsMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'permissions',
|
'module' => 'permissions',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'job@getAll',
|
'permission_mark' => 'job@getAll',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 2,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1587462818,
|
'created_at' => 1587462818,
|
||||||
'updated_at' => 1598959522,
|
'updated_at' => 1587547118,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
@@ -24,9 +24,7 @@ class RolesSeed extends Seeder
|
|||||||
{
|
{
|
||||||
\catchAdmin\permissions\model\Roles::create([
|
\catchAdmin\permissions\model\Roles::create([
|
||||||
'role_name' => '超级管理员',
|
'role_name' => '超级管理员',
|
||||||
'identify' => 'admin',
|
|
||||||
'description' => 'super user',
|
'description' => 'super user',
|
||||||
'data_range' => 1,
|
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
namespace catchAdmin\permissions\excel;
|
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Users;
|
|
||||||
use catcher\library\excel\ExcelContract;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
|
||||||
|
|
||||||
class UserExport implements ExcelContract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置头部
|
|
||||||
*
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @return string[]
|
|
||||||
*/
|
|
||||||
public function headers(): array
|
|
||||||
{
|
|
||||||
// TODO: Implement headers() method.
|
|
||||||
return [
|
|
||||||
'id', '用户名', '邮箱', '状态', '创建日期'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理数据
|
|
||||||
*
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
* @throws \think\db\exception\DbException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @return \think\Collection
|
|
||||||
*/
|
|
||||||
public function sheets()
|
|
||||||
{
|
|
||||||
// TODO: Implement sheets() method.
|
|
||||||
$users = Users::field(['id', 'username', 'email', 'status', 'created_at'])->select();
|
|
||||||
|
|
||||||
foreach ($users as &$user) {
|
|
||||||
$user->status = $user->status == Users::ENABLE ? '启用' : '停用';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $users;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置开始行
|
|
||||||
*
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function setRow()
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置标题
|
|
||||||
*
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function setTitle()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'A1:G1', '导出用户', Alignment::HORIZONTAL_CENTER
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -57,11 +57,6 @@ trait DataRangScopeTrait
|
|||||||
$userIds[] = $user->id;
|
$userIds[] = $user->id;
|
||||||
break;
|
break;
|
||||||
case Roles::DEPARTMENT_DOWN_DATA:
|
case Roles::DEPARTMENT_DOWN_DATA:
|
||||||
// 查一下下级部门
|
|
||||||
$departmentIds = Department::where('parent_id', $user->department_id)->column('id');
|
|
||||||
$departmentIds[] = $user->department_id;
|
|
||||||
$userIds = array_merge([$user->id], $this->getUserIdsByDepartmentId($departmentIds));
|
|
||||||
break;
|
|
||||||
case Roles::DEPARTMENT_DATA:
|
case Roles::DEPARTMENT_DATA:
|
||||||
$userIds = array_merge($userIds, $this->getUserIdsByDepartmentId([$user->department_id]));
|
$userIds = array_merge($userIds, $this->getUserIdsByDepartmentId([$user->department_id]));
|
||||||
break;
|
break;
|
||||||
|
@@ -35,7 +35,9 @@ class Department extends CatchModel
|
|||||||
*/
|
*/
|
||||||
public function getList(): array
|
public function getList(): array
|
||||||
{
|
{
|
||||||
return $this->catchSearch()
|
return $this->withoutField(['department_name'])
|
||||||
|
->addFields(['department_name as title'])
|
||||||
|
->catchSearch()
|
||||||
->catchOrder()
|
->catchOrder()
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
}
|
}
|
||||||
|
@@ -19,10 +19,12 @@ class Permissions extends CatchModel
|
|||||||
'component', // 组件
|
'component', // 组件
|
||||||
'redirect',
|
'redirect',
|
||||||
'keepalive',
|
'keepalive',
|
||||||
|
'hide_children_in_menu',
|
||||||
'creator_id',
|
'creator_id',
|
||||||
'hidden',
|
'status',
|
||||||
'module', // 模块
|
'module', // 模块
|
||||||
'route', // 路由
|
'route', // 路由
|
||||||
|
'method', // 请求方法
|
||||||
'permission_mark', // 权限标识
|
'permission_mark', // 权限标识
|
||||||
'type', // 1 菜单 2 按钮
|
'type', // 1 菜单 2 按钮
|
||||||
'sort', // 排序字段
|
'sort', // 排序字段
|
||||||
@@ -69,7 +71,7 @@ class Permissions extends CatchModel
|
|||||||
return parent::whereIn('id', $permissionIds)
|
return parent::whereIn('id', $permissionIds)
|
||||||
->field(['permission_name as title', 'id', 'parent_id',
|
->field(['permission_name as title', 'id', 'parent_id',
|
||||||
'route', 'icon', 'component', 'redirect', 'module',
|
'route', 'icon', 'component', 'redirect', 'module',
|
||||||
'keepalive as keepAlive', 'type', 'permission_mark', 'hidden'
|
'keepalive as keepAlive', 'hide_children_in_menu', 'type', 'permission_mark', 'status'
|
||||||
])
|
])
|
||||||
->catchOrder()
|
->catchOrder()
|
||||||
->select();
|
->select();
|
||||||
@@ -99,44 +101,4 @@ class Permissions extends CatchModel
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function show($id)
|
|
||||||
{
|
|
||||||
$permission = $this->findBy($id);
|
|
||||||
|
|
||||||
// 不能使用改属性判断,模型有该属性,使用数组方式
|
|
||||||
// $permission->hidden
|
|
||||||
$hidden = $permission['hidden'] == Permissions::ENABLE ? Permissions::DISABLE : Permissions::ENABLE;
|
|
||||||
|
|
||||||
$nextLevelIds = $this->getNextLevel([$id]);
|
|
||||||
|
|
||||||
$nextLevelIds[] = $id;
|
|
||||||
|
|
||||||
return $this->whereIn('id', $nextLevelIds)->update([
|
|
||||||
'hidden' => $hidden,
|
|
||||||
'updated_at' => time(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 level ids
|
|
||||||
*
|
|
||||||
* @time 2020年09月06日
|
|
||||||
* @param array $id
|
|
||||||
* @param array $ids
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function getNextLevel(array $id, &$ids = [])
|
|
||||||
{
|
|
||||||
$_ids = $this->whereIn('parent_id', $id)
|
|
||||||
->where('type', self::MENU_TYPE)
|
|
||||||
->column('id');
|
|
||||||
|
|
||||||
if (count($_ids)) {
|
|
||||||
$ids = array_merge($_ids, $this->getNextLevel($_ids, $ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ids;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,6 @@ class Roles extends CatchModel
|
|||||||
protected $field = [
|
protected $field = [
|
||||||
'id', //
|
'id', //
|
||||||
'role_name', // 角色名
|
'role_name', // 角色名
|
||||||
'identify', // 身份标识
|
|
||||||
'parent_id', // 父级ID
|
'parent_id', // 父级ID
|
||||||
'creator_id', // 创建者
|
'creator_id', // 创建者
|
||||||
'data_range', // 数据范围
|
'data_range', // 数据范围
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catchAdmin\permissions\model\search;
|
namespace catchAdmin\permissions\model\search;
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Department;
|
|
||||||
|
|
||||||
trait UserSearch
|
trait UserSearch
|
||||||
{
|
{
|
||||||
public function searchUsernameAttr($query, $value, $data)
|
public function searchUsernameAttr($query, $value, $data)
|
||||||
@@ -22,8 +20,6 @@ trait UserSearch
|
|||||||
|
|
||||||
public function searchDepartmentIdAttr($query, $value, $data)
|
public function searchDepartmentIdAttr($query, $value, $data)
|
||||||
{
|
{
|
||||||
$departmentIds = Department::where('parent_id', $value)->column('id');
|
return $query->where($this->aliasField('department_id'), $value);
|
||||||
$departmentIds[] = $value;
|
|
||||||
return $query->whereIn($this->aliasField('department_id'), $departmentIds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,5 +23,4 @@ $router->group(function () use ($router){
|
|||||||
$router->put('users/recover/<id>', '\catchAdmin\permissions\controller\User@recover');
|
$router->put('users/recover/<id>', '\catchAdmin\permissions\controller\User@recover');
|
||||||
$router->get('users/get/roles', '\catchAdmin\permissions\controller\User@getRoles');
|
$router->get('users/get/roles', '\catchAdmin\permissions\controller\User@getRoles');
|
||||||
$router->get('user/info', '\catchAdmin\permissions\controller\User@info');
|
$router->get('user/info', '\catchAdmin\permissions\controller\User@info');
|
||||||
$router->get('user/export', '\catchAdmin\permissions\controller\User@export');
|
|
||||||
})->middleware('auth');
|
})->middleware('auth');
|
@@ -5,7 +5,7 @@ use catcher\base\CatchController;
|
|||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use catchAdmin\system\model\Attachments as AttachmentsModel;
|
use catchAdmin\system\model\Attachments as AttachmentsModel;
|
||||||
use catcher\Utils;
|
use catcher\Utils;
|
||||||
use catcher\facade\FileSystem;
|
use think\facade\Filesystem;
|
||||||
|
|
||||||
class Attachments extends CatchController
|
class Attachments extends CatchController
|
||||||
{
|
{
|
||||||
@@ -39,17 +39,9 @@ class Attachments extends CatchController
|
|||||||
|
|
||||||
if ($model->deleteBy($id)) {
|
if ($model->deleteBy($id)) {
|
||||||
foreach ($attachments as $attachment) {
|
foreach ($attachments as $attachment) {
|
||||||
if ($attachment->driver == 'local') {
|
|
||||||
$localPath = config('filesystem.disks.local.root') . DIRECTORY_SEPARATOR;
|
|
||||||
$path = $localPath . str_replace('\\','\/', $attachment->path);
|
|
||||||
if (!FileSystem::exists($path)) {
|
|
||||||
Filesystem::delete($path);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Filesystem::delete($attachment->path);
|
Filesystem::delete($attachment->path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return CatchResponse::success();
|
return CatchResponse::success();
|
||||||
}
|
}
|
||||||
|
@@ -42,10 +42,7 @@ class DataDictionary extends CatchController
|
|||||||
$tables = $tables->where('engine', $engine)->values();
|
$tables = $tables->where('engine', $engine)->values();
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = $request->get('page', 1);
|
return CatchResponse::paginate(Paginator::make($tables->toArray(), $request->get('limit') ?? 10, $request->get('page') ?? 1, $tables->count(), false, []));
|
||||||
$limit = $request->get('limit', 10);
|
|
||||||
|
|
||||||
return CatchResponse::paginate(Paginator::make(array_slice($tables->toArray(), ($page - 1) * $limit, $limit), $limit, $page, $tables->count(), false, []));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -35,7 +35,7 @@ class Developers extends Migrator
|
|||||||
->addColumn('mobile', 'string', ['limit' => 30,'null' => false,'default' => '','signed' => false,'comment' => '手机号',])
|
->addColumn('mobile', 'string', ['limit' => 30,'null' => false,'default' => '','signed' => false,'comment' => '手机号',])
|
||||||
->addColumn('id_card', 'string', ['limit' => 50,'null' => false,'default' => '','signed' => false,'comment' => '身份证',])
|
->addColumn('id_card', 'string', ['limit' => 50,'null' => false,'default' => '','signed' => false,'comment' => '身份证',])
|
||||||
->addColumn('alipay_account', 'string', ['limit' => 100,'null' => false,'default' => '','signed' => false,'comment' => '支付宝账户',])
|
->addColumn('alipay_account', 'string', ['limit' => 100,'null' => false,'default' => '','signed' => false,'comment' => '支付宝账户',])
|
||||||
->addColumn('status', 'boolean', ['null' => false,'default' => 1,'signed' => false,'comment' => '1 待认证 2 已认证',])
|
->addColumn('status', 'boolean', ['null' => false,'default' => 1,'signed' => false,'comment' => '1 待认证 1 已认证',])
|
||||||
->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建时间',])
|
->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建时间',])
|
||||||
->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '更新时间',])
|
->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '更新时间',])
|
||||||
->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '软删除',])
|
->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '软删除',])
|
||||||
|
@@ -18,8 +18,8 @@ class ConfigSeed extends Seeder
|
|||||||
[
|
[
|
||||||
'name' => '基础配置',
|
'name' => '基础配置',
|
||||||
'pid' => 0,
|
'pid' => 0,
|
||||||
'component' => 'basic',
|
'component' => 'basis',
|
||||||
'key' => 'basic',
|
'key' => 'basis',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => '上传配置',
|
'name' => '上传配置',
|
||||||
|
@@ -1,679 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use think\migration\Seeder;
|
|
||||||
|
|
||||||
class SystemMenusSeed extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run Method.
|
|
||||||
*
|
|
||||||
* Write your database seeder using this method.
|
|
||||||
*
|
|
||||||
* More information on writing seeders is available here:
|
|
||||||
* http://docs.phinx.org/en/latest/seeding.html
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
\catcher\Utils::importTreeData($this->getPermissions(), 'permissions', 'parent_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPermissions()
|
|
||||||
{
|
|
||||||
return array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 37,
|
|
||||||
'permission_name' => '系统管理',
|
|
||||||
'parent_id' => 0,
|
|
||||||
'level' => '',
|
|
||||||
'route' => '/system',
|
|
||||||
'icon' => 'el-icon-s-tools',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'system',
|
|
||||||
'component' => 'layout',
|
|
||||||
'redirect' => 'attactments',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 2,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587462349,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 38,
|
|
||||||
'permission_name' => '数据字典',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/database',
|
|
||||||
'icon' => 'el-icon-copy-document',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'dataDictionary',
|
|
||||||
'component' => 'database',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 8,
|
|
||||||
'created_at' => 1587463087,
|
|
||||||
'updated_at' => 1599362678,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 39,
|
|
||||||
'permission_name' => '查看',
|
|
||||||
'parent_id' => 38,
|
|
||||||
'level' => '37-38',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'dataDictionary@view',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587463113,
|
|
||||||
'updated_at' => 1599362691,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 40,
|
|
||||||
'permission_name' => '列表',
|
|
||||||
'parent_id' => 38,
|
|
||||||
'level' => '37-38',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'dataDictionary@tables',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 10,
|
|
||||||
'created_at' => 1587463173,
|
|
||||||
'updated_at' => 1599362678,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'id' => 41,
|
|
||||||
'permission_name' => '优化',
|
|
||||||
'parent_id' => 38,
|
|
||||||
'level' => '37-38',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'dataDictionary@optimize',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587463201,
|
|
||||||
'updated_at' => 1599362678,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'id' => 42,
|
|
||||||
'permission_name' => '备份',
|
|
||||||
'parent_id' => 38,
|
|
||||||
'level' => '37-38',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'optimize@backup',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587463217,
|
|
||||||
'updated_at' => 1599362678,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 43,
|
|
||||||
'permission_name' => '附件管理',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/attactments',
|
|
||||||
'icon' => 'el-icon-folder-opened',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'attactments',
|
|
||||||
'component' => 'attachment',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 10,
|
|
||||||
'created_at' => 1587463302,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 44,
|
|
||||||
'permission_name' => '列表',
|
|
||||||
'parent_id' => 43,
|
|
||||||
'level' => '37-43',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'attachments@index',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587463335,
|
|
||||||
'updated_at' => 1599217559,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 45,
|
|
||||||
'permission_name' => '删除',
|
|
||||||
'parent_id' => 43,
|
|
||||||
'level' => '37-43',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'attachments@delete',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587463355,
|
|
||||||
'updated_at' => 1599217559,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'id' => 46,
|
|
||||||
'permission_name' => '上传图片',
|
|
||||||
'parent_id' => 43,
|
|
||||||
'level' => '37-43',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'upload@image',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587466919,
|
|
||||||
'updated_at' => 1599217559,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'id' => 47,
|
|
||||||
'permission_name' => '上传文件',
|
|
||||||
'parent_id' => 43,
|
|
||||||
'level' => '37-43',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'upload@file',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587466939,
|
|
||||||
'updated_at' => 1599217559,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'id' => 48,
|
|
||||||
'permission_name' => '配置管理',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/config',
|
|
||||||
'icon' => 'el-icon-setting',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'config',
|
|
||||||
'component' => 'config',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 9,
|
|
||||||
'created_at' => 1587466991,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 49,
|
|
||||||
'permission_name' => '父级配置',
|
|
||||||
'parent_id' => 48,
|
|
||||||
'level' => '37-48',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'config@parent',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467036,
|
|
||||||
'updated_at' => 1591345651,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 50,
|
|
||||||
'permission_name' => '存储',
|
|
||||||
'parent_id' => 48,
|
|
||||||
'level' => '37-48',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'config@save',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467052,
|
|
||||||
'updated_at' => 1587547118,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'id' => 51,
|
|
||||||
'permission_name' => '获取',
|
|
||||||
'parent_id' => 48,
|
|
||||||
'level' => '37-48',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'config@read',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467062,
|
|
||||||
'updated_at' => 1587547118,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'id' => 52,
|
|
||||||
'permission_name' => '登陆日志',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/log/operate',
|
|
||||||
'icon' => 'el-icon-coin',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'loginLog',
|
|
||||||
'component' => 'loginLog',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 5,
|
|
||||||
'created_at' => 1587467150,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 53,
|
|
||||||
'permission_name' => '列表',
|
|
||||||
'parent_id' => 52,
|
|
||||||
'level' => '37-52',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'loginlog@list',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467206,
|
|
||||||
'updated_at' => 1587547118,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 54,
|
|
||||||
'permission_name' => '清空',
|
|
||||||
'parent_id' => 52,
|
|
||||||
'level' => '37-52',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'loginlog@empty',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467221,
|
|
||||||
'updated_at' => 1587547118,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
'id' => 55,
|
|
||||||
'permission_name' => '操作日志',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/log/login',
|
|
||||||
'icon' => 'el-icon-house',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'operateLog',
|
|
||||||
'component' => 'operateLog',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467180,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 56,
|
|
||||||
'permission_name' => '列表',
|
|
||||||
'parent_id' => 55,
|
|
||||||
'level' => '37-55',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'operatelog@list',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467246,
|
|
||||||
'updated_at' => 1587547118,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 57,
|
|
||||||
'permission_name' => '清空',
|
|
||||||
'parent_id' => 55,
|
|
||||||
'level' => '37-55',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'operatelog@empty',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587467266,
|
|
||||||
'updated_at' => 1587547118,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
'id' => 58,
|
|
||||||
'permission_name' => '代码生成',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/generate',
|
|
||||||
'icon' => 'el-icon-scissors',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'generate',
|
|
||||||
'component' => 'generate',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1587717452,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 59,
|
|
||||||
'permission_name' => '生成',
|
|
||||||
'parent_id' => 58,
|
|
||||||
'level' => '37-58',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'generate@save',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1588110923,
|
|
||||||
'updated_at' => 1599217574,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 60,
|
|
||||||
'permission_name' => '预览',
|
|
||||||
'parent_id' => 58,
|
|
||||||
'level' => '37-58',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'generate@preview',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1588110962,
|
|
||||||
'updated_at' => 1599217574,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
'id' => 68,
|
|
||||||
'permission_name' => '敏感词库',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/sensitive/word',
|
|
||||||
'icon' => 'el-icon-folder-delete',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'sensitiveWord',
|
|
||||||
'component' => 'sensitiveWord',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1592375865,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 69,
|
|
||||||
'permission_name' => '列表',
|
|
||||||
'parent_id' => 68,
|
|
||||||
'level' => '37-68',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'sensitiveWord@index',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1592382167,
|
|
||||||
'updated_at' => 1593589434,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 70,
|
|
||||||
'permission_name' => '新增',
|
|
||||||
'parent_id' => 68,
|
|
||||||
'level' => '37-68',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'sensitiveWord@save',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1592382179,
|
|
||||||
'updated_at' => 1593589434,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'id' => 71,
|
|
||||||
'permission_name' => '更新',
|
|
||||||
'parent_id' => 68,
|
|
||||||
'level' => '37-68',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'sensitiveWord@update',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1592382192,
|
|
||||||
'updated_at' => 1593589434,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'id' => 72,
|
|
||||||
'permission_name' => '删除',
|
|
||||||
'parent_id' => 68,
|
|
||||||
'level' => '37-68',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'sensitiveWord@delete',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1592382202,
|
|
||||||
'updated_at' => 1593589434,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
'id' => 101,
|
|
||||||
'permission_name' => '开发者',
|
|
||||||
'parent_id' => 37,
|
|
||||||
'level' => '37',
|
|
||||||
'route' => '/system/develop',
|
|
||||||
'icon' => 'el-icon-rank',
|
|
||||||
'module' => 'system',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'develop',
|
|
||||||
'component' => 'develop',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1594626307,
|
|
||||||
'updated_at' => 1599288737,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
621
catch/system/database/seeds/SystemPermissionSeed.php
Normal file
621
catch/system/database/seeds/SystemPermissionSeed.php
Normal file
@@ -0,0 +1,621 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class SystemPermissionSeed extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run Method.
|
||||||
|
*
|
||||||
|
* Write your database seeder using this method.
|
||||||
|
*
|
||||||
|
* More information on writing seeders is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/seeding.html
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
\catcher\Utils::importTreeData($this->getPermissions(), 'permissions', 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getPermissions()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 37,
|
||||||
|
'permission_name' => '系统管理',
|
||||||
|
'parent_id' => 0,
|
||||||
|
'level' => '',
|
||||||
|
'route' => '/system',
|
||||||
|
'icon' => 'bar-chart',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'system',
|
||||||
|
'component' => 'pageView',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 2,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587462349,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 38,
|
||||||
|
'permission_name' => '数据字典',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/system/database',
|
||||||
|
'icon' => 'hdd',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'dataDictionary@index',
|
||||||
|
'component' => 'database',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 8,
|
||||||
|
'created_at' => 1587463087,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 39,
|
||||||
|
'permission_name' => '查看',
|
||||||
|
'parent_id' => 38,
|
||||||
|
'level' => '37-38',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'dataDictionary@view',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587463113,
|
||||||
|
'updated_at' => 1591343449,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 40,
|
||||||
|
'permission_name' => '列表',
|
||||||
|
'parent_id' => 38,
|
||||||
|
'level' => '37-38',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'dataDictionary@tables',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 10,
|
||||||
|
'created_at' => 1587463173,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
2 =>
|
||||||
|
array(
|
||||||
|
'id' => 41,
|
||||||
|
'permission_name' => '优化',
|
||||||
|
'parent_id' => 38,
|
||||||
|
'level' => '37-38',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'dataDictionary@optimize',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587463201,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
3 =>
|
||||||
|
array(
|
||||||
|
'id' => 42,
|
||||||
|
'permission_name' => '备份',
|
||||||
|
'parent_id' => 38,
|
||||||
|
'level' => '37-38',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'optimize@backup',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587463217,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 43,
|
||||||
|
'permission_name' => '附件管理',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/attactments',
|
||||||
|
'icon' => 'folder-open',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'attactments',
|
||||||
|
'component' => 'attachment',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 10,
|
||||||
|
'created_at' => 1587463302,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 44,
|
||||||
|
'permission_name' => '列表',
|
||||||
|
'parent_id' => 43,
|
||||||
|
'level' => '37-43',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'attachments@index',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587463335,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 45,
|
||||||
|
'permission_name' => '删除',
|
||||||
|
'parent_id' => 43,
|
||||||
|
'level' => '37-43',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'attachments@delete',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587463355,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
2 =>
|
||||||
|
array(
|
||||||
|
'id' => 46,
|
||||||
|
'permission_name' => '上传图片',
|
||||||
|
'parent_id' => 43,
|
||||||
|
'level' => '37-43',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'upload@image',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587466919,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
3 =>
|
||||||
|
array(
|
||||||
|
'id' => 47,
|
||||||
|
'permission_name' => '上传文件',
|
||||||
|
'parent_id' => 43,
|
||||||
|
'level' => '37-43',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'upload@file',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587466939,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
2 =>
|
||||||
|
array(
|
||||||
|
'id' => 48,
|
||||||
|
'permission_name' => '配置管理',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/system/config',
|
||||||
|
'icon' => 'setting',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'config',
|
||||||
|
'component' => 'config',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 9,
|
||||||
|
'created_at' => 1587466991,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 49,
|
||||||
|
'permission_name' => '父级配置',
|
||||||
|
'parent_id' => 48,
|
||||||
|
'level' => '37-48',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'config@parent',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467036,
|
||||||
|
'updated_at' => 1591345651,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 50,
|
||||||
|
'permission_name' => '存储',
|
||||||
|
'parent_id' => 48,
|
||||||
|
'level' => '37-48',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'config@save',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467052,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
2 =>
|
||||||
|
array(
|
||||||
|
'id' => 51,
|
||||||
|
'permission_name' => '获取',
|
||||||
|
'parent_id' => 48,
|
||||||
|
'level' => '37-48',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'config@read',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467062,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
3 =>
|
||||||
|
array(
|
||||||
|
'id' => 52,
|
||||||
|
'permission_name' => '登陆日志',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/system/log/login',
|
||||||
|
'icon' => 'export',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'loginLog',
|
||||||
|
'component' => 'loginLog',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 5,
|
||||||
|
'created_at' => 1587467150,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 53,
|
||||||
|
'permission_name' => '列表',
|
||||||
|
'parent_id' => 52,
|
||||||
|
'level' => '37-52',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'loginlog@list',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467206,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 54,
|
||||||
|
'permission_name' => '清空',
|
||||||
|
'parent_id' => 52,
|
||||||
|
'level' => '37-52',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'loginlog@empty',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467221,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
4 =>
|
||||||
|
array(
|
||||||
|
'id' => 55,
|
||||||
|
'permission_name' => '操作日志',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/system/log/operate',
|
||||||
|
'icon' => 'profile',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'operateLog',
|
||||||
|
'component' => 'operateLog',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467180,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 56,
|
||||||
|
'permission_name' => '列表',
|
||||||
|
'parent_id' => 55,
|
||||||
|
'level' => '37-55',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'operatelog@list',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467246,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 57,
|
||||||
|
'permission_name' => '清空',
|
||||||
|
'parent_id' => 55,
|
||||||
|
'level' => '37-55',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'operatelog@empty',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587467266,
|
||||||
|
'updated_at' => 1587547118,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
5 =>
|
||||||
|
array(
|
||||||
|
'id' => 58,
|
||||||
|
'permission_name' => '代码生成',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/generate',
|
||||||
|
'icon' => 'scissor',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'generate',
|
||||||
|
'component' => 'generate',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1587717452,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
'children' =>
|
||||||
|
array(
|
||||||
|
0 =>
|
||||||
|
array(
|
||||||
|
'id' => 59,
|
||||||
|
'permission_name' => '生成',
|
||||||
|
'parent_id' => 58,
|
||||||
|
'level' => '37-58',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'generate@save',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1588110923,
|
||||||
|
'updated_at' => 1588110923,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'id' => 60,
|
||||||
|
'permission_name' => '预览',
|
||||||
|
'parent_id' => 58,
|
||||||
|
'level' => '37-58',
|
||||||
|
'route' => '',
|
||||||
|
'icon' => '',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'generate@preview',
|
||||||
|
'component' => '',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 1,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1588110962,
|
||||||
|
'updated_at' => 1588110962,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
6 =>
|
||||||
|
array(
|
||||||
|
'id' => 68,
|
||||||
|
'permission_name' => '敏感词库',
|
||||||
|
'parent_id' => 37,
|
||||||
|
'level' => '37',
|
||||||
|
'route' => '/sensitive/word',
|
||||||
|
'icon' => 'sliders',
|
||||||
|
'module' => 'system',
|
||||||
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'sensitiveWord',
|
||||||
|
'component' => 'sensitiveWord',
|
||||||
|
'redirect' => '',
|
||||||
|
'hide_children_in_menu' => 2,
|
||||||
|
'keepalive' => 1,
|
||||||
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
|
'created_at' => 1592375865,
|
||||||
|
'updated_at' => 1593044431,
|
||||||
|
'deleted_at' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,15 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catchAdmin\system\model;
|
namespace catchAdmin\system\model;
|
||||||
|
|
||||||
use catchAdmin\system\model\search\AttachmentsSearch;
|
|
||||||
use catcher\base\CatchModel;
|
use catcher\base\CatchModel;
|
||||||
use think\file\UploadedFile;
|
use think\file\UploadedFile;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
class Attachments extends CatchModel
|
class Attachments extends CatchModel
|
||||||
{
|
{
|
||||||
use AttachmentsSearch;
|
|
||||||
|
|
||||||
protected $name = 'attachments';
|
protected $name = 'attachments';
|
||||||
|
|
||||||
protected $field = [
|
protected $field = [
|
||||||
@@ -30,10 +27,24 @@ class Attachments extends CatchModel
|
|||||||
{
|
{
|
||||||
return $this->order('id', 'desc')
|
return $this->order('id', 'desc')
|
||||||
->catchSearch()
|
->catchSearch()
|
||||||
->catchOrder()
|
|
||||||
->paginate();
|
->paginate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function searchFileExtAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->where('file_ext', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchMimeTypesAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->where('mime_type', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchDriver($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->where('driver', $value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
namespace catchAdmin\system\model;
|
namespace catchAdmin\system\model;
|
||||||
|
|
||||||
use catcher\base\CatchModel;
|
use catcher\base\CatchModel;
|
||||||
use catcher\exceptions\FailedException;
|
|
||||||
use thans\jwt\exception\UserNotDefinedException;
|
use thans\jwt\exception\UserNotDefinedException;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
@@ -56,47 +55,94 @@ class Config extends CatchModel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent = $data['parent'] ?? false;
|
// 子配置
|
||||||
if (!$parent) {
|
if ($data['pid'] ?? false) {
|
||||||
throw new FailedException('父配置丢失');
|
$config = \json_decode($data['config'], true);
|
||||||
}
|
$pid = $data['pid'];
|
||||||
unset($data['parent']);
|
unset($data['pid']);
|
||||||
|
/**[
|
||||||
|
'key' => [
|
||||||
|
'k' => 'v'
|
||||||
|
],
|
||||||
|
|
||||||
$parentConfig = $this->where('key', $parent)->find();
|
'k' => 'v'
|
||||||
$config = [];
|
]*/
|
||||||
foreach ($data as $key => $item) {
|
foreach ($config as $key => $value) {
|
||||||
foreach ($item as $k => $value) {
|
if (empty($value)) {
|
||||||
if ($value) {
|
continue;
|
||||||
$config[$key . '.' .$k] = [
|
}
|
||||||
'pid' => $parentConfig['id'],
|
// 如果二级配置存在
|
||||||
'key' => $key . '.' . $k,
|
$secondLevel = $this->isExistConfig($key, $pid);
|
||||||
'value' => $value,
|
if ($secondLevel) {
|
||||||
'created_at' => time(),
|
// value 是字符串
|
||||||
'updated_at' => time(),
|
if (!is_array($value)) {
|
||||||
|
if ($value != $secondLevel->value) {
|
||||||
|
$secondLevel->value = $value;
|
||||||
|
$secondLevel->save();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 数组
|
||||||
|
$thirdLevel = [];
|
||||||
|
$this->subConfig($secondLevel->id, ['id', 'key', 'value'])
|
||||||
|
->each(function ($item, $key) use (&$thirdLevel){
|
||||||
|
$thirdLevel[$item['key']] = $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!empty($value)) {
|
||||||
|
$new = [];
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
if (isset($thirdLevel[$k])) {
|
||||||
|
if ($v != $thirdLevel[$k]->value) {
|
||||||
|
$thirdLevel[$k]->value = $v;
|
||||||
|
$thirdLevel[$k]->save();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$new[] = [
|
||||||
|
'pid' => $secondLevel->id,
|
||||||
|
'key' => $k,
|
||||||
|
'value' => $v,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$this->where('pid', $parentConfig->id)
|
if (!empty($new)) {
|
||||||
->select()
|
parent::insertAllBy($new);
|
||||||
->each(function ($item) use (&$config){
|
}
|
||||||
if (isset($config[$item['key']])) {
|
}
|
||||||
if ($config[$item['key']]['value'] != $item->value) {
|
}
|
||||||
$item['value'] = $config[$item['key']]['value'];
|
} else {
|
||||||
$item->save();
|
if (!is_array($value)) {
|
||||||
|
parent::createBy([
|
||||||
|
'pid' => $pid,
|
||||||
|
'key' => $key,
|
||||||
|
'value' => $value,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$id = parent::createBy([
|
||||||
|
'pid' => $pid,
|
||||||
|
'key' => $key,
|
||||||
|
]);
|
||||||
|
if (!empty($value)) {
|
||||||
|
$newConfig = [];
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
$newConfig[] = [
|
||||||
|
'key' => $k,
|
||||||
|
'value' => $v,
|
||||||
|
'pid' => $id,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
parent::insertAllBy($newConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unset($config[$item['key']]);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (count($config)) {
|
|
||||||
return $this->insertAll($config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parent::storeBy($data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置是否存在
|
* 配置是否存在
|
||||||
*
|
*
|
||||||
@@ -137,26 +183,28 @@ class Config extends CatchModel
|
|||||||
* 获取配置
|
* 获取配置
|
||||||
*
|
*
|
||||||
* @time 2020年04月20日
|
* @time 2020年04月20日
|
||||||
* @param string $component
|
* @param int $pid
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
public function getConfig(string $component)
|
public function getConfig($pid = 0)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$configs = $this->where('pid', $this->where('component', $component)->value('id'))
|
|
||||||
|
$configs = $this->where('pid', $pid)
|
||||||
->field('id,`key` as k,value,pid')
|
->field('id,`key` as k,value,pid')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
foreach ($configs as $config) {
|
foreach ($configs as $config) {
|
||||||
if (strpos($config['k'], '.') !== false) {
|
if ($config->value !== '') {
|
||||||
list($object, $key) = explode('.', $config['k']);
|
$data[$config->k] = $config->value;
|
||||||
$data[$object][$key] = $config['value'];
|
} else {
|
||||||
|
$data[$config->k] = $this->getConfig($config->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return empty($data) ? '' : $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -11,13 +11,10 @@
|
|||||||
|
|
||||||
namespace catchAdmin\system\model;
|
namespace catchAdmin\system\model;
|
||||||
|
|
||||||
use catchAdmin\system\model\search\DeveloperSearch;
|
|
||||||
use catcher\base\CatchModel as Model;
|
use catcher\base\CatchModel as Model;
|
||||||
|
|
||||||
class Developers extends Model
|
class Developers extends Model
|
||||||
{
|
{
|
||||||
use DeveloperSearch;
|
|
||||||
|
|
||||||
protected $name = 'developers';
|
protected $name = 'developers';
|
||||||
|
|
||||||
protected $field = [
|
protected $field = [
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
namespace catchAdmin\system\model\search;
|
|
||||||
|
|
||||||
trait AttachmentsSearch
|
|
||||||
{
|
|
||||||
public function searchFileExtAttr($query, $value, $data)
|
|
||||||
{
|
|
||||||
return $query->where('file_ext', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function searchMimeTypesAttr($query, $value, $data)
|
|
||||||
{
|
|
||||||
return $query->where('mime_type', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function searchDriverAttr($query, $value, $data)
|
|
||||||
{
|
|
||||||
return $query->where('driver', $value);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
namespace catchAdmin\system\model\search;
|
|
||||||
|
|
||||||
trait DeveloperSearch
|
|
||||||
{
|
|
||||||
public function searchUsernameAttr($query, $value, $data)
|
|
||||||
{
|
|
||||||
return $query->whereLike('username', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function searchMobileAttr($query, $value, $data)
|
|
||||||
{
|
|
||||||
return $query->whereLike('mobile', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function searchStatusAttr($query, $value, $data)
|
|
||||||
{
|
|
||||||
return $query->where('driver', $value);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -10,7 +10,7 @@ class CreateRequest extends CatchRequest
|
|||||||
{
|
{
|
||||||
// TODO: Implement rules() method.
|
// TODO: Implement rules() method.
|
||||||
return [
|
return [
|
||||||
'word|词汇' => 'unique:'.SensitiveWord::class.',word',
|
'word|词汇' => 'sensitive_word|unique:'.SensitiveWord::class.',word',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,8 @@ $router->group(function () use ($router) {
|
|||||||
$router->delete('loginLog/empty', '\catchAdmin\system\controller\LoginLog@empty');
|
$router->delete('loginLog/empty', '\catchAdmin\system\controller\LoginLog@empty');
|
||||||
// 操作日志
|
// 操作日志
|
||||||
$router->get('log/operate', '\catchAdmin\system\controller\OperateLog@list');
|
$router->get('log/operate', '\catchAdmin\system\controller\OperateLog@list');
|
||||||
// $router->delete('empty/log/operate', '\catchAdmin\system\controller\OperateLog@empty');
|
$router->delete('operateLog/empty', '\catchAdmin\system\controller\OperateLog@empty');
|
||||||
$router->delete('log/operate/<id>', '\catchAdmin\system\controller\OperateLog@delete');
|
$router->delete('operateLog/delete', '\catchAdmin\system\controller\OperateLog@delete');
|
||||||
|
|
||||||
// 数据字典
|
// 数据字典
|
||||||
$router->get('tables', '\catchAdmin\system\controller\DataDictionary@tables');
|
$router->get('tables', '\catchAdmin\system\controller\DataDictionary@tables');
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use think\migration\Seeder;
|
use think\migration\Seeder;
|
||||||
|
|
||||||
class WechatMenusSeed extends Seeder
|
class WechatPermissionSeed extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run Method.
|
* Run Method.
|
||||||
@@ -30,15 +30,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => 'wechat',
|
'icon' => 'wechat',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'wechat',
|
'permission_mark' => 'wechat',
|
||||||
'component' => 'layout',
|
'component' => 'routeView',
|
||||||
'redirect' => '/wechat/menus',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1591603025,
|
'created_at' => 1591603025,
|
||||||
'updated_at' => 1599371183,
|
'updated_at' => 1593044101,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -52,15 +54,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => 'table',
|
'icon' => 'table',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'menus',
|
'permission_mark' => 'menus',
|
||||||
'component' => 'menus',
|
'component' => 'menus',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'sort' => 18,
|
'status' => 1,
|
||||||
|
'sort' => 1,
|
||||||
'created_at' => 1591603088,
|
'created_at' => 1591603088,
|
||||||
'updated_at' => 1599371183,
|
'updated_at' => 1591603427,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -74,15 +78,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'menus@index',
|
'permission_mark' => 'menus@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304908,
|
'created_at' => 1593304908,
|
||||||
'updated_at' => 1599371167,
|
'updated_at' => 1593304908,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -95,15 +101,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'menus@save',
|
'permission_mark' => 'menus@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304915,
|
'created_at' => 1593304915,
|
||||||
'updated_at' => 1599371167,
|
'updated_at' => 1593304915,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -116,15 +124,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'menus@update',
|
'permission_mark' => 'menus@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304923,
|
'created_at' => 1593304923,
|
||||||
'updated_at' => 1599371167,
|
'updated_at' => 1593304923,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -137,15 +147,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'menus@delete',
|
'permission_mark' => 'menus@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304929,
|
'created_at' => 1593304929,
|
||||||
'updated_at' => 1599371167,
|
'updated_at' => 1593304929,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -158,15 +170,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'menus@sync',
|
'permission_mark' => 'menus@sync',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304938,
|
'created_at' => 1593304938,
|
||||||
'updated_at' => 1599371167,
|
'updated_at' => 1593304938,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -178,18 +192,20 @@ class WechatMenusSeed extends Seeder
|
|||||||
'parent_id' => 66,
|
'parent_id' => 66,
|
||||||
'level' => '66',
|
'level' => '66',
|
||||||
'route' => '/wechat/users',
|
'route' => '/wechat/users',
|
||||||
'icon' => 'el-icon-s-custom',
|
'icon' => 'team',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users',
|
'permission_mark' => 'users',
|
||||||
'component' => 'routerView',
|
'component' => 'pageView',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1592624761,
|
'created_at' => 1592624761,
|
||||||
'updated_at' => 1599371697,
|
'updated_at' => 1592631716,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -199,19 +215,21 @@ class WechatMenusSeed extends Seeder
|
|||||||
'permission_name' => '微信用户',
|
'permission_name' => '微信用户',
|
||||||
'parent_id' => 75,
|
'parent_id' => 75,
|
||||||
'level' => '66-75',
|
'level' => '66-75',
|
||||||
'route' => '/wechat/users/user',
|
'route' => '/wechat/users',
|
||||||
'icon' => 'user',
|
'icon' => 'user',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users',
|
'permission_mark' => 'users',
|
||||||
'component' => 'wechatUsers',
|
'component' => 'wechatUsers',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1592624799,
|
'created_at' => 1592624799,
|
||||||
'updated_at' => 1599376002,
|
'updated_at' => 1592624799,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -225,15 +243,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users@index',
|
'permission_mark' => 'users@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304869,
|
'created_at' => 1593304869,
|
||||||
'updated_at' => 1599376002,
|
'updated_at' => 1593304869,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -246,15 +266,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users@remark',
|
'permission_mark' => 'users@remark',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304876,
|
'created_at' => 1593304876,
|
||||||
'updated_at' => 1599376002,
|
'updated_at' => 1593304876,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -267,15 +289,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users@block',
|
'permission_mark' => 'users@block',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304884,
|
'created_at' => 1593304884,
|
||||||
'updated_at' => 1599376002,
|
'updated_at' => 1593304884,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -288,15 +312,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users@tag',
|
'permission_mark' => 'users@tag',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304892,
|
'created_at' => 1593304892,
|
||||||
'updated_at' => 1599376002,
|
'updated_at' => 1593304892,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -309,15 +335,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'users@sync',
|
'permission_mark' => 'users@sync',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304900,
|
'created_at' => 1593304900,
|
||||||
'updated_at' => 1599376002,
|
'updated_at' => 1593304900,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -328,19 +356,21 @@ class WechatMenusSeed extends Seeder
|
|||||||
'permission_name' => '微信标签',
|
'permission_name' => '微信标签',
|
||||||
'parent_id' => 75,
|
'parent_id' => 75,
|
||||||
'level' => '66-75',
|
'level' => '66-75',
|
||||||
'route' => '/wechat/users/tag',
|
'route' => '/wechat/tags',
|
||||||
'icon' => 'el-icon-paperclip',
|
'icon' => 'tags',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'tags',
|
'permission_mark' => 'tags',
|
||||||
'component' => 'wechatTags',
|
'component' => 'wechatTags',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1592722634,
|
'created_at' => 1592722634,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304802,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -354,15 +384,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'tags@index',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'wechatTags@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304575,
|
'created_at' => 1593304575,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304575,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -375,15 +407,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
'permission_mark' => 'tags@save',
|
'method' => 'get',
|
||||||
|
'permission_mark' => 'wechatTags@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304592,
|
'created_at' => 1593304592,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304592,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -396,15 +430,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'tags@read',
|
'permission_mark' => 'tags@read',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304830,
|
'created_at' => 1593304830,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304830,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -417,15 +453,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'tags@update',
|
'permission_mark' => 'tags@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304837,
|
'created_at' => 1593304837,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304837,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -438,15 +476,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'tags@delete',
|
'permission_mark' => 'tags@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304846,
|
'created_at' => 1593304846,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304846,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
5 =>
|
5 =>
|
||||||
@@ -459,15 +499,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'tags@sync',
|
'permission_mark' => 'tags@sync',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304859,
|
'created_at' => 1593304859,
|
||||||
'updated_at' => 1599376011,
|
'updated_at' => 1593304859,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -481,18 +523,20 @@ class WechatMenusSeed extends Seeder
|
|||||||
'parent_id' => 66,
|
'parent_id' => 66,
|
||||||
'level' => '66',
|
'level' => '66',
|
||||||
'route' => '/wechat/graphic',
|
'route' => '/wechat/graphic',
|
||||||
'icon' => 'el-icon-document-add',
|
'icon' => 'gold',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'graphic',
|
'permission_mark' => 'graphic',
|
||||||
'component' => 'wechatGraphic',
|
'component' => 'wechatGraphic',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 2,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593227704,
|
'created_at' => 1593227704,
|
||||||
'updated_at' => 1599371183,
|
'updated_at' => 1593227704,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
'children' =>
|
'children' =>
|
||||||
array (
|
array (
|
||||||
@@ -506,15 +550,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'graphic@save',
|
'permission_mark' => 'graphic@save',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304490,
|
'created_at' => 1593304490,
|
||||||
'updated_at' => 1595978929,
|
'updated_at' => 1593304490,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
@@ -527,15 +573,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'graphic@read',
|
'permission_mark' => 'graphic@read',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304510,
|
'created_at' => 1593304510,
|
||||||
'updated_at' => 1595978929,
|
'updated_at' => 1593304510,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
2 =>
|
2 =>
|
||||||
@@ -548,15 +596,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'graphic@index',
|
'permission_mark' => 'graphic@index',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 2,
|
'sort' => 2,
|
||||||
'created_at' => 1593304520,
|
'created_at' => 1593304520,
|
||||||
'updated_at' => 1595978929,
|
'updated_at' => 1593304520,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
3 =>
|
3 =>
|
||||||
@@ -569,15 +619,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'graphic@update',
|
'permission_mark' => 'graphic@update',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304530,
|
'created_at' => 1593304530,
|
||||||
'updated_at' => 1595978929,
|
'updated_at' => 1593304530,
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
4 =>
|
4 =>
|
||||||
@@ -590,123 +642,17 @@ class WechatMenusSeed extends Seeder
|
|||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'wechat',
|
'module' => 'wechat',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
'method' => 'get',
|
||||||
'permission_mark' => 'graphic@delete',
|
'permission_mark' => 'graphic@delete',
|
||||||
'component' => '',
|
'component' => '',
|
||||||
'redirect' => '',
|
'redirect' => '',
|
||||||
'hidden' => 1,
|
'hide_children_in_menu' => 1,
|
||||||
'keepalive' => 1,
|
'keepalive' => 1,
|
||||||
'type' => 2,
|
'type' => 2,
|
||||||
|
'status' => 1,
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'created_at' => 1593304537,
|
'created_at' => 1593304537,
|
||||||
'updated_at' => 1595978929,
|
'updated_at' => 1593304537,
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'id' => 100,
|
|
||||||
'permission_name' => '微信回复',
|
|
||||||
'parent_id' => 66,
|
|
||||||
'level' => '66',
|
|
||||||
'route' => '/wechat/reply',
|
|
||||||
'icon' => 'el-icon-chat-line-round',
|
|
||||||
'module' => 'wechat',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'reply',
|
|
||||||
'component' => 'wechatReply',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1593323887,
|
|
||||||
'updated_at' => 1599371183,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
'children' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'id' => 111,
|
|
||||||
'permission_name' => '列表',
|
|
||||||
'parent_id' => 100,
|
|
||||||
'level' => '66-100',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'wechat',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'reply@index',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1599292333,
|
|
||||||
'updated_at' => 1599292373,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'id' => 112,
|
|
||||||
'permission_name' => '新增',
|
|
||||||
'parent_id' => 100,
|
|
||||||
'level' => '66-100',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'wechat',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'reply@save',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1599292344,
|
|
||||||
'updated_at' => 1599292344,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'id' => 113,
|
|
||||||
'permission_name' => '删除',
|
|
||||||
'parent_id' => 100,
|
|
||||||
'level' => '66-100',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'wechat',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'reply@delete',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1599292351,
|
|
||||||
'updated_at' => 1599292351,
|
|
||||||
'deleted_at' => 0,
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'id' => 114,
|
|
||||||
'permission_name' => '禁用/启用',
|
|
||||||
'parent_id' => 100,
|
|
||||||
'level' => '66-100',
|
|
||||||
'route' => '',
|
|
||||||
'icon' => '',
|
|
||||||
'module' => 'wechat',
|
|
||||||
'creator_id' => 1,
|
|
||||||
'permission_mark' => 'reply@disOrEnable',
|
|
||||||
'component' => '',
|
|
||||||
'redirect' => '',
|
|
||||||
'hidden' => 1,
|
|
||||||
'keepalive' => 1,
|
|
||||||
'type' => 2,
|
|
||||||
'sort' => 1,
|
|
||||||
'created_at' => 1599292363,
|
|
||||||
'updated_at' => 1599292363,
|
|
||||||
'deleted_at' => 0,
|
'deleted_at' => 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
@@ -14,5 +14,5 @@
|
|||||||
"aliases": "wechat",
|
"aliases": "wechat",
|
||||||
"files": [],
|
"files": [],
|
||||||
"requires": [],
|
"requires": [],
|
||||||
"enable": false
|
"enable": true
|
||||||
}
|
}
|
@@ -101,8 +101,7 @@ class WechatUsersRepository extends CatchRepository
|
|||||||
*/
|
*/
|
||||||
public function tag($id, $data)
|
public function tag($id, $data)
|
||||||
{
|
{
|
||||||
$tagIds = Utils::stringToArrayBy($data['tag']);
|
$tagIds = WechatTags::whereIn('name', Utils::stringToArrayBy($data['tag']))->column('tag_id');
|
||||||
// WechatTags::whereIn('name', Utils::stringToArrayBy($data['tag']))->column('tag_id');
|
|
||||||
|
|
||||||
$user = $this->findBy($id);
|
$user = $this->findBy($id);
|
||||||
|
|
||||||
@@ -135,10 +134,6 @@ class WechatUsersRepository extends CatchRepository
|
|||||||
$user->hasTags()->saveAll($attachIds);
|
$user->hasTags()->saveAll($attachIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
WechatUsers::where('id', $id)->update([
|
|
||||||
'tagid_list' => $data['tag'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -31,8 +31,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"topthink/think-trace":"^1.0",
|
"topthink/think-trace":"^1.0",
|
||||||
"symfony/var-dumper": "^5.1",
|
"symfony/var-dumper": "^5.1"
|
||||||
"swoole/ide-helper": "^4.5"
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@@ -10,7 +10,7 @@ return [
|
|||||||
'local' => [
|
'local' => [
|
||||||
'type' => 'local',
|
'type' => 'local',
|
||||||
'root' => app()->getRootPath() . 'public'.DIRECTORY_SEPARATOR.'images',
|
'root' => app()->getRootPath() . 'public'.DIRECTORY_SEPARATOR.'images',
|
||||||
'domain' => env('app.domain'),
|
'domain' => env('API_URL'),
|
||||||
],
|
],
|
||||||
'public' => [
|
'public' => [
|
||||||
// 磁盘类型
|
// 磁盘类型
|
||||||
|
@@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Users;
|
|
||||||
use catcher\exceptions\FailedException;
|
use catcher\exceptions\FailedException;
|
||||||
use catcher\exceptions\LoginFailedException;
|
use catcher\exceptions\LoginFailedException;
|
||||||
use thans\jwt\facade\JWTAuth;
|
use thans\jwt\facade\JWTAuth;
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
use think\helper\Str;
|
|
||||||
|
|
||||||
class CatchAuth
|
class CatchAuth
|
||||||
{
|
{
|
||||||
@@ -51,70 +49,22 @@ class CatchAuth
|
|||||||
*/
|
*/
|
||||||
public function attempt($condition)
|
public function attempt($condition)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$user = $this->authenticate($condition);
|
$user = $this->authenticate($condition);
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
throw new LoginFailedException();
|
throw new LoginFailedException();
|
||||||
}
|
}
|
||||||
if ($user->status == Users::DISABLE) {
|
|
||||||
throw new LoginFailedException('该用户已被禁用|' . $user->username, Code::USER_FORBIDDEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!password_verify($condition['password'], $user->password)) {
|
if (!password_verify($condition['password'], $user->password)) {
|
||||||
throw new LoginFailedException('登录失败|' . $user->username);
|
throw new LoginFailedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$token = $this->{$this->getDriver()}($user);
|
return $this->{$this->getDriver()}($user);
|
||||||
$this->afterLoginSuccess($user);
|
|
||||||
// 登录事件
|
|
||||||
$this->loginEvent($user->username);
|
|
||||||
return $token;
|
|
||||||
} catch (\Exception $exception) {
|
|
||||||
$message = $exception->getMessage();
|
|
||||||
if (strpos($message, '|') !== false) {
|
|
||||||
$username = explode('|', $message)[1];
|
|
||||||
} else {
|
|
||||||
$username = $condition['email'];
|
|
||||||
}
|
|
||||||
$this->loginEvent($username, false);
|
|
||||||
throw new LoginFailedException('登录失败', $exception->getCode());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录成功后
|
|
||||||
*
|
*
|
||||||
* @time 2020年09月09日
|
* @time 2020年01月07日
|
||||||
* @param $user
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function afterLoginSuccess($user)
|
|
||||||
{
|
|
||||||
$user->last_login_ip = request()->ip();
|
|
||||||
$user->last_login_time = time();
|
|
||||||
$user->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录事件
|
|
||||||
*
|
|
||||||
* @time 2020年09月09日
|
|
||||||
* @param $name
|
|
||||||
* @param bool $success
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function loginEvent($name, $success = true)
|
|
||||||
{
|
|
||||||
$params['login_name'] = $name;
|
|
||||||
$params['success'] = $success ? 1 : 2;
|
|
||||||
event('loginLog', $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* user
|
|
||||||
*
|
|
||||||
* @time 2020年09月09日
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function user()
|
public function user()
|
||||||
|
@@ -56,6 +56,11 @@ class CatchExceptionHandle extends Handle
|
|||||||
$e = new FailedException($e->getMessage(), 10005, $e);
|
$e = new FailedException($e->getMessage(), 10005, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 类型错误
|
||||||
|
if ($e instanceof \TypeError) {
|
||||||
|
$e = new FailedException($e->getMessage(), 10005, $e);
|
||||||
|
}
|
||||||
|
|
||||||
return parent::render($request, $e);
|
return parent::render($request, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,8 +118,8 @@ class CatchQuery extends Query
|
|||||||
|
|
||||||
foreach ($params as $field => $value) {
|
foreach ($params as $field => $value) {
|
||||||
$method = 'search' . Str::studly($field) . 'Attr';
|
$method = 'search' . Str::studly($field) . 'Attr';
|
||||||
if ($value && method_exists($this->model, $method)) {
|
if (method_exists($this->model, $method)) {
|
||||||
$this->model->$method($this, $value, $params);
|
$this->model->$method($this, $value ?? null, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,11 +45,6 @@ class CatchUpload
|
|||||||
*/
|
*/
|
||||||
protected $path = '';
|
protected $path = '';
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->initDriver();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* upload files
|
* upload files
|
||||||
*
|
*
|
||||||
@@ -82,20 +77,10 @@ class CatchUpload
|
|||||||
throw new FailedException('Upload Failed, Try Again!');
|
throw new FailedException('Upload Failed, Try Again!');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 本地路径
|
|
||||||
*
|
|
||||||
* @time 2020年09月07日
|
|
||||||
* @param $path
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function getLocalPath($path)
|
protected function getLocalPath($path)
|
||||||
{
|
{
|
||||||
if ($this->getDriver() === self::LOCAL) {
|
if ($this->getDriver() === self::LOCAL) {
|
||||||
|
return str_replace(root_path('public'), '', \config('filesystem.disks.local.root')) . DIRECTORY_SEPARATOR .$path;
|
||||||
$path = str_replace(root_path('public'), '', \config('filesystem.disks.local.root')) . DIRECTORY_SEPARATOR .$path;
|
|
||||||
|
|
||||||
return str_replace('\\', '/', $path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $path;
|
return $path;
|
||||||
@@ -262,19 +247,9 @@ class CatchUpload
|
|||||||
$disk = app()->config->get('filesystem.disks');
|
$disk = app()->config->get('filesystem.disks');
|
||||||
|
|
||||||
$uploadConfigs = $configModel->getConfig($upload->id);
|
$uploadConfigs = $configModel->getConfig($upload->id);
|
||||||
|
|
||||||
// 重组
|
|
||||||
$_config = [];
|
|
||||||
if (!empty($uploadConfigs)) {
|
if (!empty($uploadConfigs)) {
|
||||||
foreach ($uploadConfigs as $key => $value) {
|
|
||||||
list($object, $key) = explode('.', $key);
|
|
||||||
$_config[$object][$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_config)) {
|
|
||||||
// 读取上传可配置数据
|
// 读取上传可配置数据
|
||||||
foreach ($_config as $key => &$config) {
|
foreach ($uploadConfigs as $key => &$config) {
|
||||||
// $disk[$key]['type'] = $key;
|
// $disk[$key]['type'] = $key;
|
||||||
// 腾讯云配置处理
|
// 腾讯云配置处理
|
||||||
if (strtolower($key) == 'qcloud') {
|
if (strtolower($key) == 'qcloud') {
|
||||||
@@ -283,21 +258,21 @@ class CatchUpload
|
|||||||
'secretKey' => $config['secret_key'] ?? '',
|
'secretKey' => $config['secret_key'] ?? '',
|
||||||
'secretId' => $config['secret_id'] ?? '',
|
'secretId' => $config['secret_id'] ?? '',
|
||||||
];
|
];
|
||||||
$readFromCdn = $config['read_from_cdn'] ?? 0;
|
$readFromCdn = $config['read_from_cdn'] ?? false;
|
||||||
$config['read_from_cdn'] = intval($readFromCdn) == 1;
|
$config['read_from_cdn'] = $readFromCdn ? true : false;
|
||||||
}
|
}
|
||||||
// OSS 配置
|
// OSS 配置
|
||||||
if (strtolower($key) == 'oss') {
|
if (strtolower($key) == 'oss') {
|
||||||
$isCname = $config['is_cname'] ?? 0;
|
$isCname = $config['is_cname'] ?? false;
|
||||||
$config['is_cname'] = intval($isCname) == 1;
|
$config['is_cname'] = $isCname ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合并数组
|
// 合并数组
|
||||||
array_walk($disk, function (&$item, $key) use ($_config) {
|
array_walk($disk, function (&$item, $key) use ($uploadConfigs) {
|
||||||
if (!in_array($key, ['public', 'local'])) {
|
if (!in_array($key, ['public', 'local'])) {
|
||||||
if ($_config[$key] ?? false) {
|
if ($uploadConfigs[$key] ?? false) {
|
||||||
foreach ($_config[$key] as $k => $value) {
|
foreach ($uploadConfigs[$key] as $k => $value) {
|
||||||
$item[$k] = $value;
|
$item[$k] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,21 +286,6 @@ class CatchUpload
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化
|
|
||||||
*
|
|
||||||
* @time 2020年09月07日
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
protected function initDriver()
|
|
||||||
{
|
|
||||||
if ($driver = Utils::config('site.upload')) {
|
|
||||||
$this->driver = $driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取云存储的域名
|
* 获取云存储的域名
|
||||||
*
|
*
|
||||||
|
@@ -11,7 +11,6 @@ class Code
|
|||||||
public const FAILED = 10005; // 操作失败
|
public const FAILED = 10005; // 操作失败
|
||||||
public const LOGIN_EXPIRED = 10006; // 登录失效
|
public const LOGIN_EXPIRED = 10006; // 登录失效
|
||||||
public const LOGIN_BLACKLIST = 10007; // 黑名单
|
public const LOGIN_BLACKLIST = 10007; // 黑名单
|
||||||
public const USER_FORBIDDEN = 10008; // 账户被禁
|
|
||||||
|
|
||||||
public const WECHAT_RESPONSE_ERROR = 40000;
|
public const WECHAT_RESPONSE_ERROR = 40000;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catchAdmin\system\model\Config;
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\helper\Str;
|
use think\helper\Str;
|
||||||
|
|
||||||
@@ -130,28 +129,4 @@ class Utils
|
|||||||
{
|
{
|
||||||
return request()->user()->id == config('catch.permissions.super_admin_id');
|
return request()->user()->id == config('catch.permissions.super_admin_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取配置
|
|
||||||
*
|
|
||||||
* @time 2020年09月07日
|
|
||||||
* @param $key
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public static function config($key)
|
|
||||||
{
|
|
||||||
return Config::where('key', $key)->value('value');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* public path
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function publicPath($path = '')
|
|
||||||
{
|
|
||||||
return root_path($path ? 'public/'. $path : 'public');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -86,7 +86,7 @@ class CatchRequest extends Request
|
|||||||
// 设置默认参数
|
// 设置默认参数
|
||||||
if ($this->needCreatorId) {
|
if ($this->needCreatorId) {
|
||||||
$this->param['creator_id'] = $this->user()->id;
|
$this->param['creator_id'] = $this->user()->id;
|
||||||
$this->post['creator_id'] = $this->user()->id;
|
$this->post['creator'] = $this->user()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -30,8 +30,7 @@ class ExportDataCommand extends Command
|
|||||||
|
|
||||||
protected function execute(Input $input, Output $output)
|
protected function execute(Input $input, Output $output)
|
||||||
{
|
{
|
||||||
//$table = // Utils::tablePrefix() .
|
$table = Utils::tablePrefix() . $input->getArgument('table');
|
||||||
$table = $input->getArgument('table');
|
|
||||||
$parent = $input->getOption('pid');
|
$parent = $input->getOption('pid');
|
||||||
$module = $input->getOption('module');
|
$module = $input->getOption('module');
|
||||||
|
|
||||||
@@ -40,12 +39,8 @@ class ExportDataCommand extends Command
|
|||||||
->where('module', $module)
|
->where('module', $module)
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$data = Db::name($table)->where('deleted_at', 0)
|
$data = Db::name($table)->where('deleted_at', 0)->select()->toArray();
|
||||||
->select()
|
|
||||||
->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parent) {
|
if ($parent) {
|
||||||
@@ -65,11 +60,7 @@ class ExportDataCommand extends Command
|
|||||||
{
|
{
|
||||||
$stub = file_get_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'permissionSeed.stub');
|
$stub = file_get_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'permissionSeed.stub');
|
||||||
|
|
||||||
$class = ucfirst($module) . 'MenusSeed';
|
file_put_contents(CatchAdmin::moduleSeedsDirectory($module) . 'permissionSeed.php', str_replace('{DATA}', $data, $stub));
|
||||||
|
|
||||||
$stub = str_replace('{CLASS}', $class, $stub);
|
|
||||||
|
|
||||||
file_put_contents(CatchAdmin::moduleSeedsDirectory($module) . $class .'.php', str_replace('{DATA}', $data, $stub));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,6 @@ namespace catcher\command\install;
|
|||||||
|
|
||||||
use catchAdmin\permissions\model\Permissions;
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use catcher\library\InstallLocalModule;
|
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
use think\console\input\Argument;
|
use think\console\input\Argument;
|
||||||
@@ -35,7 +34,10 @@ class DisableModuleCommand extends Command
|
|||||||
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
|
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
|
||||||
$output->error("module [$module] not exist");
|
$output->error("module [$module] not exist");
|
||||||
} else {
|
} else {
|
||||||
(new InstallLocalModule($module))->disableModule();
|
CatchAdmin::disableModule($module);
|
||||||
|
Permissions::destroy(function ($query) use ($module){
|
||||||
|
$query->where('module', trim($module));
|
||||||
|
});
|
||||||
$output->info("module [$module] disabled");
|
$output->info("module [$module] disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,6 @@ namespace catcher\command\install;
|
|||||||
|
|
||||||
use catchAdmin\permissions\model\Permissions;
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use catcher\library\InstallLocalModule;
|
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
use think\console\input\Argument;
|
use think\console\input\Argument;
|
||||||
@@ -34,7 +33,8 @@ class EnableModuleCommand extends Command
|
|||||||
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
|
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
|
||||||
$output->error("module [$module] not exist");
|
$output->error("module [$module] not exist");
|
||||||
} else {
|
} else {
|
||||||
(new InstallLocalModule($module))->enableModule();
|
CatchAdmin::enableModule($module);
|
||||||
|
app(Permissions::class)->restore(['module' => trim($module)]);
|
||||||
$output->info("module [$module] enabled");
|
$output->info("module [$module] enabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
namespace catcher\command\install;
|
|
||||||
|
|
||||||
|
|
||||||
use catcher\library\InstallLocalModule;
|
|
||||||
use think\console\Command;
|
|
||||||
use think\console\Input;
|
|
||||||
use think\console\input\Argument;
|
|
||||||
use think\console\input\Option;
|
|
||||||
use think\console\Output;
|
|
||||||
|
|
||||||
class InstallLocalModuleCommand extends Command
|
|
||||||
{
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->setName('local:install')
|
|
||||||
->addArgument('module', Argument::REQUIRED, 'module name')
|
|
||||||
->setDescription('install catch local module');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(Input $input, Output $output)
|
|
||||||
{
|
|
||||||
$installedModule = $input->getArgument('module');
|
|
||||||
|
|
||||||
$install = new InstallLocalModule($installedModule);
|
|
||||||
|
|
||||||
if (!$install->localModuleExist()) {
|
|
||||||
while (true) {
|
|
||||||
$modules = $install->getLocalModulesInfo(false);
|
|
||||||
if (!count($modules)) {
|
|
||||||
$output->error('Input module not found and All local modules had been enabled');exit;
|
|
||||||
}
|
|
||||||
$choose = '';
|
|
||||||
$i = 1;
|
|
||||||
foreach ($modules as $k => $module) {
|
|
||||||
$choose .= ($i++) . ':' . ($module['name']) . ($module['enable'] ? '(开启)' : '(未开启)') . PHP_EOL;
|
|
||||||
}
|
|
||||||
$answer = $output->ask($input, $choose);
|
|
||||||
if (isset($modules[$answer-1])) {
|
|
||||||
$installedModule = $modules[$answer - 1]['name'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$install = new InstallLocalModule($installedModule);
|
|
||||||
|
|
||||||
if (!$install->isModuleEnabled()) {
|
|
||||||
$output->error($installedModule . ' has been enabled!');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$install->done()) {
|
|
||||||
$output->error(sprintf('module [%s] has been installed, You can use [php think enable:module $module] to start it.', $installedModule));
|
|
||||||
}
|
|
||||||
|
|
||||||
$output->info(sprintf('module [%s] installed successfully', $installedModule));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,7 +2,6 @@
|
|||||||
namespace catcher\command\install;
|
namespace catcher\command\install;
|
||||||
|
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use catcher\library\InstallLocalModule;
|
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
use think\console\input\Option;
|
use think\console\input\Option;
|
||||||
@@ -14,8 +13,6 @@ class InstallProjectCommand extends Command
|
|||||||
|
|
||||||
protected $databaseLink = [];
|
protected $databaseLink = [];
|
||||||
|
|
||||||
protected $defaultModule = ['permissions', 'system'];
|
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('catch:install')
|
$this->setName('catch:install')
|
||||||
@@ -114,12 +111,6 @@ class InstallProjectCommand extends Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置 app domain
|
|
||||||
$appDomain = strtolower($this->output->ask($this->input, '👉 first, you should set app domain: '));
|
|
||||||
if (strpos('http://', $appDomain) === false || strpos('https://', $appDomain) === false) {
|
|
||||||
$appDomain = 'http://' . $appDomain;
|
|
||||||
}
|
|
||||||
|
|
||||||
$answer = strtolower($this->output->ask($this->input, '🤔️ Did You Need to Set Database information? (Y/N): '));
|
$answer = strtolower($this->output->ask($this->input, '🤔️ Did You Need to Set Database information? (Y/N): '));
|
||||||
|
|
||||||
if ($answer === 'y' || $answer === 'yes') {
|
if ($answer === 'y' || $answer === 'yes') {
|
||||||
@@ -151,7 +142,7 @@ class InstallProjectCommand extends Command
|
|||||||
|
|
||||||
$this->databaseLink = [$host, $database, $username, $password, $port, $charset, $prefix];
|
$this->databaseLink = [$host, $database, $username, $password, $port, $charset, $prefix];
|
||||||
|
|
||||||
$this->generateEnvFile($host, $database, $username, $password, $port, $charset, $prefix, $appDomain);
|
$this->generateEnvFile($host, $database, $username, $password, $port, $charset, $prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,27 +191,26 @@ class InstallProjectCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function migrateAndSeeds(): void
|
protected function migrateAndSeeds(): void
|
||||||
{
|
{
|
||||||
|
foreach (CatchAdmin::getModulesDirectory() as $directory) {
|
||||||
|
$moduleInfo = CatchAdmin::getModuleInfo($directory);
|
||||||
|
if (!empty($moduleInfo) && is_dir(CatchAdmin::moduleMigrationsDirectory($moduleInfo['alias']))) {
|
||||||
|
$output = Console::call('catch-migrate:run', [$moduleInfo['alias']]);
|
||||||
|
$this->output->info(sprintf('module [%s] migrations %s', $moduleInfo['alias'], $output->fetch()));
|
||||||
|
|
||||||
foreach ($this->defaultModule as $m) {
|
$seedOut = Console::call('catch-seed:run', [$moduleInfo['alias']]);
|
||||||
$module = new InstallLocalModule($m);
|
$this->output->info(sprintf('module [%s] seeds %s', $moduleInfo['alias'], $seedOut->fetch()));
|
||||||
$module->installModuleTables();
|
}
|
||||||
$module->installModuleSeeds();
|
|
||||||
$this->output->info('🎉 module [' . $m . '] installed successfully');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 回滚数据
|
|
||||||
*
|
|
||||||
* @time 2020年09月07日
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function migrateRollback()
|
protected function migrateRollback()
|
||||||
{
|
{
|
||||||
foreach ($this->defaultModule as $m) {
|
foreach (CatchAdmin::getModulesDirectory() as $directory) {
|
||||||
$module = new InstallLocalModule($m);
|
$moduleInfo = CatchAdmin::getModuleInfo($directory);
|
||||||
$module->rollbackModuleTable();
|
if (!empty($moduleInfo) && is_dir(CatchAdmin::moduleMigrationsDirectory($moduleInfo['alias']))) {
|
||||||
$this->output->info('🎉' . $m . ' tables rollback successfully');
|
$rollbackOut = Console::call('catch-migrate:rollback', [$moduleInfo['alias'], '-f']);
|
||||||
|
// $this->output->info(sprintf('module [%s] [%s] rollback %s', $moduleInfo['alias'], basename($migration), $rollbackOut->fetch()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,15 +251,13 @@ class InstallProjectCommand extends Command
|
|||||||
* @param $port
|
* @param $port
|
||||||
* @param $charset
|
* @param $charset
|
||||||
* @param $prefix
|
* @param $prefix
|
||||||
* @param $appDomain
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function generateEnvFile($host, $database, $username, $password, $port, $charset, $prefix, $appDomain): void
|
protected function generateEnvFile($host, $database, $username, $password, $port, $charset, $prefix): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$env = \parse_ini_file(root_path() . '.example.env', true);
|
$env = \parse_ini_file(root_path() . '.example.env', true);
|
||||||
|
|
||||||
$env['APP']['DOMAIN'] = $appDomain;
|
|
||||||
$env['DATABASE']['HOSTNAME'] = $host;
|
$env['DATABASE']['HOSTNAME'] = $host;
|
||||||
$env['DATABASE']['DATABASE'] = $database;
|
$env['DATABASE']['DATABASE'] = $database;
|
||||||
$env['DATABASE']['USERNAME'] = $username;
|
$env['DATABASE']['USERNAME'] = $username;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use think\migration\Seeder;
|
use think\migration\Seeder;
|
||||||
|
|
||||||
class {CLASS} extends Seeder
|
class PermissionSeed extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run Method.
|
* Run Method.
|
||||||
|
@@ -55,7 +55,7 @@ class Generator
|
|||||||
// 只有最后成功才写入 route
|
// 只有最后成功才写入 route
|
||||||
(new Route())->controller($controller['controller'])
|
(new Route())->controller($controller['controller'])
|
||||||
->restful($controller['restful'])
|
->restful($controller['restful'])
|
||||||
// ->methods((new Controller())->parseOtherMethods($controller['other_function']))
|
->methods((new Controller())->parseOtherMethods($controller['other_function']))
|
||||||
->done();
|
->done();
|
||||||
|
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
@@ -76,10 +76,10 @@ class Generator
|
|||||||
*/
|
*/
|
||||||
public function preview($params)
|
public function preview($params)
|
||||||
{
|
{
|
||||||
$type = $params['type'];
|
|
||||||
|
|
||||||
$params = \json_decode($params['data'], true);
|
$params = \json_decode($params['data'], true);
|
||||||
|
|
||||||
|
$type = $params['type'];
|
||||||
|
|
||||||
[$controller, $model] = $this->parseParams($params);
|
[$controller, $model] = $this->parseParams($params);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@@ -113,7 +113,7 @@ class Generator
|
|||||||
'model' => $params['controller']['model'] ?? '',
|
'model' => $params['controller']['model'] ?? '',
|
||||||
'controller' => $params['controller']['controller'] ?? '',
|
'controller' => $params['controller']['controller'] ?? '',
|
||||||
'restful' => $params['controller']['restful'],
|
'restful' => $params['controller']['restful'],
|
||||||
// 'other_function' => $params['controller']['other_function'],
|
'other_function' => $params['controller']['other_function'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$table = $params['controller']['table'] ?? '';
|
$table = $params['controller']['table'] ?? '';
|
||||||
@@ -124,8 +124,8 @@ class Generator
|
|||||||
$model = [
|
$model = [
|
||||||
'table' => $table,
|
'table' => $table,
|
||||||
'model' => $params['controller']['model'] ?? '',
|
'model' => $params['controller']['model'] ?? '',
|
||||||
'sql' => $params['table_fields'],
|
'sql' => $params['model']['data'],
|
||||||
'extra' => $params['table_extra'],
|
'extra' => $params['model']['extra'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@@ -92,14 +92,13 @@ class Controller extends Factory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
if (!empty($params['other_function'])) {
|
if (!empty($params['other_function'])) {
|
||||||
$others = $this->parseOtherMethods($params['other_function']);
|
$others = $this->parseOtherMethods($params['other_function']);
|
||||||
$this->methods = array_merge($this->methods, $others);
|
$this->methods = array_merge($this->methods, $others);
|
||||||
foreach ($others as $other) {
|
foreach ($others as $other) {
|
||||||
$content .= $template->otherFunction($other[0], $other[1]);
|
$content .= $template->otherFunction($other[0], $other[1]);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
@@ -1,177 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
namespace catcher\library;
|
|
||||||
|
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Permissions;
|
|
||||||
use catcher\CatchAdmin;
|
|
||||||
use think\facade\Console;
|
|
||||||
|
|
||||||
class InstallLocalModule
|
|
||||||
{
|
|
||||||
protected $module;
|
|
||||||
|
|
||||||
public function __construct($module)
|
|
||||||
{
|
|
||||||
$this->module = $module;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查找
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function done()
|
|
||||||
{
|
|
||||||
if ($this->findModuleInPermissions()) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
$this->installModuleTables();
|
|
||||||
$this->installModuleSeeds();
|
|
||||||
$this->enableModule();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 本地模块是否存在
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function localModuleExist()
|
|
||||||
{
|
|
||||||
return in_array($this->module, array_column(CatchAdmin::getModulesInfo(true), 'value'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模块是否开启
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return false|mixed
|
|
||||||
*/
|
|
||||||
public function isModuleEnabled()
|
|
||||||
{
|
|
||||||
return in_array($this->module, array_column($this->getLocalModulesInfo(false), 'name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取本地模块信息
|
|
||||||
*
|
|
||||||
* @param bool $enabled
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getLocalModulesInfo($enabled = true)
|
|
||||||
{
|
|
||||||
$modules = CatchAdmin::getModulesInfo(true);
|
|
||||||
|
|
||||||
$info = [];
|
|
||||||
foreach ($modules as $module) {
|
|
||||||
$moduleInfo = CatchAdmin::getModuleInfo(CatchAdmin::directory() . $module['value']);
|
|
||||||
// 获取全部
|
|
||||||
if ($enabled) {
|
|
||||||
$info[] = [
|
|
||||||
'name' => $module['value'],
|
|
||||||
'title' => $module['title'],
|
|
||||||
'enable' => $moduleInfo['enable'],
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
// 获取未开启的
|
|
||||||
if (!$moduleInfo['enable']) {
|
|
||||||
$info[] = [
|
|
||||||
'name' => $module['value'],
|
|
||||||
'title' => $module['title'],
|
|
||||||
'enable' => $moduleInfo['enable'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查找模块
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
* @throws \think\db\exception\DbException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function findModuleInPermissions()
|
|
||||||
{
|
|
||||||
return Permissions::where('module', $this->module)->find() ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 启用模块
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function enableModule()
|
|
||||||
{
|
|
||||||
CatchAdmin::enableModule($this->module);
|
|
||||||
app(Permissions::class)->restore(['module' => trim($this->module)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 禁用模块
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function disableModule()
|
|
||||||
{
|
|
||||||
CatchAdmin::disableModule($this->module);
|
|
||||||
|
|
||||||
Permissions::destroy(function ($query) {
|
|
||||||
$query->where('module', trim($this->module));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建模块表
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function installModuleTables()
|
|
||||||
{
|
|
||||||
Console::call('catch-migrate:run', [$this->module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化模块数据
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function installModuleSeeds()
|
|
||||||
{
|
|
||||||
Console::call('catch-seed:run', [$this->module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回滚模块表
|
|
||||||
*
|
|
||||||
* @time 2020年09月10日
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function rollbackModuleTable()
|
|
||||||
{
|
|
||||||
Console::call('catch-migrate:rollback', [$this->module, '-f']);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,8 +2,6 @@
|
|||||||
namespace catcher\library;
|
namespace catcher\library;
|
||||||
|
|
||||||
|
|
||||||
use think\exception\ClassNotFoundException;
|
|
||||||
|
|
||||||
class ParseClass
|
class ParseClass
|
||||||
{
|
{
|
||||||
protected $namespace;
|
protected $namespace;
|
||||||
@@ -76,23 +74,18 @@ class ParseClass
|
|||||||
return $methods;
|
return $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取class
|
* 获取 CLASS
|
||||||
*
|
*
|
||||||
* @time 2020年09月06日
|
|
||||||
* @throws \ReflectionException
|
|
||||||
* @return \ReflectionClass
|
* @return \ReflectionClass
|
||||||
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
public function getClass()
|
public function getClass()
|
||||||
{
|
{
|
||||||
$class = $this->namespace . $this->module . '\\controller\\'. ucfirst($this->controller);
|
|
||||||
|
|
||||||
if (class_exists($class)) {
|
return new \ReflectionClass($this->namespace . $this->module . '\\controller\\'.
|
||||||
return new \ReflectionClass($class);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new ClassNotFoundException($this->controller . ' not found');
|
ucfirst($this->controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,12 +3,10 @@ namespace catcher\library\excel;
|
|||||||
|
|
||||||
use catcher\CatchUpload;
|
use catcher\CatchUpload;
|
||||||
use catcher\exceptions\FailedException;
|
use catcher\exceptions\FailedException;
|
||||||
use catcher\Utils;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Exception;
|
use PhpOffice\PhpSpreadsheet\Exception;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
use think\file\UploadedFile;
|
use think\file\UploadedFile;
|
||||||
use think\helper\Str;
|
|
||||||
|
|
||||||
class Excel
|
class Excel
|
||||||
{
|
{
|
||||||
@@ -23,54 +21,35 @@ class Excel
|
|||||||
|
|
||||||
protected $spreadsheet = null;
|
protected $spreadsheet = null;
|
||||||
|
|
||||||
protected $extension = 'xlsx';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* save
|
* save
|
||||||
*
|
*
|
||||||
* @time 2020年05月25日
|
* @time 2020年05月25日
|
||||||
* @param ExcelContract $excel
|
* @param ExcelContract $excel
|
||||||
* @param $path
|
* @param $path
|
||||||
* @param string $disk
|
* @param null $disk
|
||||||
* @return mixed
|
* @return bool
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function save(ExcelContract $excel, $path, $disk = 'local')
|
public function save(ExcelContract $excel, $path, $disk = null)
|
||||||
{
|
{
|
||||||
$this->excel = $excel;
|
$this->excel = $excel;
|
||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
!is_dir($path) && mkdir($path, 0777, true);
|
Factory::make(pathinfo($path, PATHINFO_EXTENSION))
|
||||||
|
|
||||||
$file = $path . date('YmdHis').Str::random(6) . '.' .$this->extension;
|
|
||||||
Factory::make($this->extension)
|
|
||||||
->setSpreadsheet($this->spreadsheet)
|
->setSpreadsheet($this->spreadsheet)
|
||||||
->save($file);
|
->save($path);
|
||||||
|
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($path)) {
|
||||||
throw new FailedException($file . ' generate failed');
|
throw new FailedException($path . ' generate failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($disk) {
|
if ($disk) {
|
||||||
$file = $this->upload($disk, $file);
|
$path = $this->upload($disk, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['url' => $file];
|
return $path;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set extension
|
|
||||||
*
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @param $extension
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setExtension($extension)
|
|
||||||
{
|
|
||||||
$this->extension = $extension;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -240,27 +219,11 @@ class Excel
|
|||||||
*/
|
*/
|
||||||
protected function upload($disk, $path)
|
protected function upload($disk, $path)
|
||||||
{
|
{
|
||||||
if ($disk == 'local') {
|
|
||||||
return $this->local($path);
|
|
||||||
}
|
|
||||||
$upload = new CatchUpload;
|
$upload = new CatchUpload;
|
||||||
|
|
||||||
return ($disk ? $upload->setDriver($disk) : $upload)->upload($this->uploadedFile($path));
|
return ($disk ? $upload->setDriver($disk) : $upload)->upload($this->uploadedFile($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回本地下载地址
|
|
||||||
*
|
|
||||||
* @param $path
|
|
||||||
* @time 2020年09月08日
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
protected function local($path)
|
|
||||||
{
|
|
||||||
return \config('filesystem.disks.local')['domain'] . '/' .
|
|
||||||
|
|
||||||
str_replace('\\', '/', str_replace(Utils::publicPath(), '', $path));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get uploaded file
|
* get uploaded file
|
||||||
|
@@ -1,14 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CatchAdmin [Just Like ~ ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user