Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oa
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱招明
oa
Commits
29f8e5ab
Commit
29f8e5ab
authored
Oct 30, 2023
by
朱招明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4ad0a7b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
708 additions
and
69 deletions
+708
-69
.gitignore
.gitignore
+1
-0
2023_10_20_092649_create_admin_table.php
...abase/Migrations/2023_10_20_092649_create_admin_table.php
+9
-8
2023_10_28_182533_create_files_table.php
...abase/Migrations/2023_10_28_182533_create_files_table.php
+37
-0
AdminMenu.php
Modules/Admin/Entities/AdminMenu.php
+31
-2
AdminRole.php
Modules/Admin/Entities/AdminRole.php
+5
-1
File.php
Modules/Admin/Entities/File.php
+10
-0
AuthController.php
Modules/Admin/Http/Controllers/AuthController.php
+11
-6
FilesController.php
Modules/Admin/Http/Controllers/FilesController.php
+65
-0
MenuController.php
Modules/Admin/Http/Controllers/MenuController.php
+30
-10
RoleController.php
Modules/Admin/Http/Controllers/RoleController.php
+40
-5
UserController.php
Modules/Admin/Http/Controllers/UserController.php
+1
-1
RoleMenu.php
Modules/Admin/Http/Middleware/RoleMenu.php
+7
-6
FileRequest.php
Modules/Admin/Http/Requests/FileRequest.php
+28
-0
MenuRequest.php
Modules/Admin/Http/Requests/MenuRequest.php
+6
-13
BaseService.php
Modules/Admin/Http/Service/BaseService.php
+32
-0
FileService.php
Modules/Admin/Http/Service/FileService.php
+38
-0
AdminMenuTransformer.php
Modules/Admin/Http/Transformers/AdminMenuTransformer.php
+4
-3
AdminRoleTransformer.php
Modules/Admin/Http/Transformers/AdminRoleTransformer.php
+7
-3
AdminUserTransformer.php
Modules/Admin/Http/Transformers/AdminUserTransformer.php
+17
-5
FileTransformer.php
Modules/Admin/Http/Transformers/FileTransformer.php
+37
-0
Helper.php
Modules/Admin/Http/Utils/Helper.php
+90
-4
api.php
Modules/Admin/Routes/api.php
+7
-2
autoload.php
Modules/Admin/vendor/autoload.php
+25
-0
ClassLoader.php
Modules/Admin/vendor/composer/ClassLoader.php
+0
-0
LICENSE
Modules/Admin/vendor/composer/LICENSE
+21
-0
autoload_classmap.php
Modules/Admin/vendor/composer/autoload_classmap.php
+10
-0
autoload_files.php
Modules/Admin/vendor/composer/autoload_files.php
+10
-0
autoload_namespaces.php
Modules/Admin/vendor/composer/autoload_namespaces.php
+9
-0
autoload_psr4.php
Modules/Admin/vendor/composer/autoload_psr4.php
+10
-0
autoload_real.php
Modules/Admin/vendor/composer/autoload_real.php
+48
-0
autoload_static.php
Modules/Admin/vendor/composer/autoload_static.php
+40
-0
composer.lock
composer.lock
+0
-0
filesystems.php
config/filesystems.php
+6
-0
upload.php
config/upload.php
+16
-0
No files found.
.gitignore
View file @
29f8e5ab
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
/public/build
/public/build
/public/hot
/public/hot
/public/storage
/public/storage
/public/uploads
/storage/*.key
/storage/*.key
/vendor
/vendor
.env
.env
...
...
Modules/Admin/Database/Migrations/2023_10_20_092649_create_admin_table.php
View file @
29f8e5ab
...
@@ -26,18 +26,19 @@ return new class extends Migration
...
@@ -26,18 +26,19 @@ return new class extends Migration
Schema
::
create
(
'admin_roles'
,
function
(
Blueprint
$table
)
{
Schema
::
create
(
'admin_roles'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
increments
(
'id'
);
$table
->
string
(
'name'
,
50
)
->
unique
()
;
$table
->
string
(
'name'
,
50
);
$table
->
string
(
'slug'
,
50
)
->
unique
()
;
$table
->
string
(
'slug'
,
50
);
$table
->
timestamps
();
$table
->
timestamps
();
});
});
Schema
::
create
(
'admin_menus'
,
function
(
Blueprint
$table
)
{
Schema
::
create
(
'admin_menus'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
increments
(
'id'
);
$table
->
integer
(
'parent_id'
)
->
default
(
0
);
$table
->
integer
(
'parent_id'
)
->
default
(
0
);
$table
->
integer
(
'order'
)
->
default
(
0
);
$table
->
string
(
'key'
,
50
)
->
comment
(
'前端路由标识'
);
$table
->
string
(
'title'
,
50
);
$table
->
string
(
'title'
,
50
)
->
comment
(
'标题'
)
;
$table
->
string
(
'icon'
,
50
)
->
nullable
();
$table
->
string
(
'icon'
,
50
)
->
nullable
();
$table
->
string
(
'uri'
)
->
nullable
();
$table
->
string
(
'api'
)
->
nullable
()
->
comment
(
'api接口地址'
);
$table
->
boolean
(
'is_menu'
)
->
default
(
1
)
->
comment
(
'是否菜单 0否 1是'
);
$table
->
timestamps
();
$table
->
timestamps
();
});
});
...
@@ -95,9 +96,9 @@ return new class extends Migration
...
@@ -95,9 +96,9 @@ return new class extends Migration
{
{
Schema
::
dropIfExists
(
'admin_users'
);
Schema
::
dropIfExists
(
'admin_users'
);
Schema
::
dropIfExists
(
'admin_roles'
);
Schema
::
dropIfExists
(
'admin_roles'
);
Schema
::
dropIfExists
(
'admin_menu'
);
Schema
::
dropIfExists
(
'admin_menu
s
'
);
Schema
::
dropIfExists
(
'admin_role_users'
);
Schema
::
dropIfExists
(
'admin_role_users'
);
Schema
::
dropIfExists
(
'admin_role_menu'
);
Schema
::
dropIfExists
(
'admin_role_menu
s
'
);
Schema
::
dropIfExists
(
'admin_operation_log'
);
Schema
::
dropIfExists
(
'admin_operation_log
s
'
);
}
}
};
};
Modules/Admin/Database/Migrations/2023_10_28_182533_create_files_table.php
0 → 100644
View file @
29f8e5ab
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'files'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
integer
(
'user_id'
)
->
index
()
->
comment
(
'用户ID'
);
$table
->
string
(
'type'
)
->
index
()
->
comment
(
'文件类型'
);
$table
->
string
(
'path'
)
->
comment
(
'文件路径'
);
$table
->
integer
(
'size'
)
->
default
(
0
)
->
comment
(
'文件大小'
);
$table
->
string
(
'mime'
)
->
enablenull
()
->
comment
(
'文件类型'
);
$table
->
string
(
'name'
)
->
comment
(
'文件名称'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'files'
);
}
};
Modules/Admin/Entities/AdminMenu.php
View file @
29f8e5ab
...
@@ -16,15 +16,43 @@ use Modules\Admin\Http\Utils\Helper;
...
@@ -16,15 +16,43 @@ use Modules\Admin\Http\Utils\Helper;
class
AdminMenu
extends
Model
class
AdminMenu
extends
Model
{
{
protected
$fillable
=
[
protected
$fillable
=
[
'title'
,
'
uri'
,
'parent_id'
,
'icon
'
'title'
,
'
key'
,
'api'
,
'parent_id'
,
'icon'
,
'is_menu
'
];
];
public
static
function
boot
()
public
static
function
boot
()
{
{
parent
::
boot
();
parent
::
boot
();
static
::
sav
ing
(
function
(
$model
)
{
static
::
sav
ed
(
function
(
$model
)
{
Helper
::
getAllMenu
(
true
);
Helper
::
getAllMenu
(
true
);
Helper
::
getAllApi
(
true
);
});
});
}
}
public
function
child
()
{
return
$this
->
hasMany
(
AdminMenu
::
class
,
'parent_id'
,
'id'
);
}
public
function
childrenIds
(){
return
$this
->
child
->
pluck
(
'id'
);
}
public
function
descendantsIds
(){
$ids
=
[];
$this
->
getChildrenIds
(
$this
,
$ids
);
return
$ids
;
}
public
function
getChildrenIds
(
AdminMenu
$menu
,
&
$ids
){
$child
=
$menu
->
child
;
if
(
$child
){
$child
->
each
(
function
(
$item
)
use
(
&
$ids
){
$ids
[]
=
$item
->
id
;
$ids
=
self
::
getChildrenIds
(
$item
,
$ids
);
});
}
return
$ids
;
}
}
}
\ No newline at end of file
Modules/Admin/Entities/AdminRole.php
View file @
29f8e5ab
...
@@ -11,13 +11,17 @@ namespace Modules\Admin\Entities;
...
@@ -11,13 +11,17 @@ namespace Modules\Admin\Entities;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Relations\BelongsToMany
;
use
Illuminate\Database\Eloquent\Relations\BelongsToMany
;
use
Illuminate\Database\Eloquent\Relations\HasMany
;
use
Illuminate\Database\Eloquent\Relations\HasMany
;
use
Modules\Admin\Http\Utils\Helper
;
class
AdminRole
extends
Model
class
AdminRole
extends
Model
{
{
protected
$fillable
=
[
protected
$fillable
=
[
'name'
,
'slug'
,
'name'
,
'slug'
,
];
];
public
static
function
boot
()
{
parent
::
boot
();
}
public
function
menu
()
:
BelongsToMany
public
function
menu
()
:
BelongsToMany
{
{
return
$this
->
belongsToMany
(
AdminMenu
::
class
,
'admin_role_menus'
,
'role_id'
,
'menu_id'
);
return
$this
->
belongsToMany
(
AdminMenu
::
class
,
'admin_role_menus'
,
'role_id'
,
'menu_id'
);
...
...
Modules/Admin/Entities/File.php
0 → 100644
View file @
29f8e5ab
<?php
namespace
Modules\Admin\Entities
;
use
Illuminate\Database\Eloquent\Model
;
class
File
extends
Model
{
protected
$fillable
=
[
'user_id'
,
'type'
,
'path'
,
'size'
,
'mime'
,
'name'
];
}
Modules/Admin/Http/Controllers/AuthController.php
View file @
29f8e5ab
...
@@ -11,6 +11,7 @@ use Illuminate\Support\Facades\DB;
...
@@ -11,6 +11,7 @@ use Illuminate\Support\Facades\DB;
use
Modules\Admin\Entities\AdminMenu
;
use
Modules\Admin\Entities\AdminMenu
;
use
Modules\Admin\Entities\AdminUser
;
use
Modules\Admin\Entities\AdminUser
;
use
Modules\Admin\Http\Transformers\AccessTokenTransformer
;
use
Modules\Admin\Http\Transformers\AccessTokenTransformer
;
use
Modules\Admin\Http\Transformers\AdminUserTransformer
;
use
Modules\Admin\Http\Transformers\BaseTransformer
;
use
Modules\Admin\Http\Transformers\BaseTransformer
;
use
Modules\Admin\Http\Utils\Helper
;
use
Modules\Admin\Http\Utils\Helper
;
...
@@ -54,7 +55,7 @@ class AuthController extends BaseController
...
@@ -54,7 +55,7 @@ class AuthController extends BaseController
*/
*/
public
function
login
(
Request
$request
)
public
function
login
(
Request
$request
)
{
{
$req
=
$request
->
all
();
$req
=
$request
->
all
(
[
'username'
,
'password'
]
);
$username
=
$req
[
"username"
];
$username
=
$req
[
"username"
];
$password
=
$req
[
"password"
];
$password
=
$req
[
"password"
];
if
(
$username
==
""
||
$password
==
""
)
if
(
$username
==
""
||
$password
==
""
)
...
@@ -118,10 +119,16 @@ class AuthController extends BaseController
...
@@ -118,10 +119,16 @@ class AuthController extends BaseController
*
*
*/
*/
public
function
loginOut
(){
public
function
loginOut
(){
auth
(
'api'
)
->
logout
(
true
);
if
(
$this
->
user
){
auth
(
'api'
)
->
logout
(
true
);
}
return
$this
->
response
->
noContent
()
->
statusCode
(
'204'
);
return
$this
->
response
->
noContent
()
->
statusCode
(
'204'
);
}
}
public
function
userInfo
(){
return
$this
->
response
->
item
(
$this
->
user
,
new
AdminUserTransformer
());
}
/**
/**
*
*
* @OA\Put(
* @OA\Put(
...
@@ -150,11 +157,9 @@ class AuthController extends BaseController
...
@@ -150,11 +157,9 @@ class AuthController extends BaseController
$user
=
$this
->
user
;
$user
=
$this
->
user
;
$role
=
$user
->
roles
()
->
first
();
$role
=
$user
->
roles
()
->
first
();
$menu
=
Helper
::
getRoleMenu
(
$role
,
true
);
$menu
=
Helper
::
makeTree
(
$menu
);
$data
=
[
$data
=
[
"menus"
=>
$menu
,
"menus"
=>
Helper
::
getRoleMenu
(
$role
,
true
),
"apis"
=>
Helper
::
getRoleApi
(
$role
,
true
),
];
];
return
$this
->
response
->
array
([
'data'
=>
$data
]);
return
$this
->
response
->
array
([
'data'
=>
$data
]);
...
...
Modules/Admin/Http/Controllers/FilesController.php
0 → 100644
View file @
29f8e5ab
<?php
namespace
Modules\Admin\Http\Controllers
;
use
Modules\Admin\Http\Requests\FileRequest
;
use
Modules\Admin\Http\Service\FileService
;
use
Modules\Admin\Http\Transformers\FileTransformer
;
class
FilesController
extends
BaseController
{
/**
* Store a newly created resource in storage.
*
* @param FileRequest $request
* @param FileService $file
*
* @return \Dingo\Api\Http\Response $response
*
* @OA\Post(
* tags={"基础接口"},
* summary="上传文件",
* path="/api/files",
* security={
* {"jwt_auth": {}}
* },
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* type="object",
* required={"type","file"},
* @OA\Property(
* property="type",
* type="string",
* enum={"avatar"}
* ),
* @OA\Property(
* property="file",
* type="string",
* format="binary"
* ),
* )
* )
* ),
* @OA\Response(
* response="201",
* description="成功",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(type="object",
* @OA\Property(property="data", type="object", ref="#/components/schemas/File")
* )
* )
* )
* )
*/
public
function
store
(
FileRequest
$request
,
FileService
$file
)
{
$info
=
$file
->
process
(
$request
->
file
,
$request
->
input
(
'type'
));
return
$this
->
response
->
item
(
$info
,
new
FileTransformer
())
->
setStatusCode
(
201
);
}
}
Modules/Admin/Http/Controllers/MenuController.php
View file @
29f8e5ab
...
@@ -66,15 +66,28 @@ class MenuController extends BaseController
...
@@ -66,15 +66,28 @@ class MenuController extends BaseController
* required={"title"},
* required={"title"},
* @OA\Property(
* @OA\Property(
* property="title",
* property="title",
* type="string"
* type="string",
* description="标题"
* ),
* ),
* @OA\Property(
* @OA\Property(
* property="uri",
* property="icon",
* type="string"
* type="string",
* description="图标"
* ),
* @OA\Property(
* property="key",
* type="string",
* description="标识"
* ),
* @OA\Property(
* property="api",
* type="string",
* description="api地址"
* ),
* ),
* @OA\Property(
* @OA\Property(
* property="parent_id",
* property="parent_id",
* type="string"
* type="string",
* description="父级菜单id"
* ),
* ),
* )
* )
* )
* )
...
@@ -87,7 +100,7 @@ class MenuController extends BaseController
...
@@ -87,7 +100,7 @@ class MenuController extends BaseController
*
*
*/
*/
public
function
add
(
MenuRequest
$request
){
public
function
add
(
MenuRequest
$request
){
$params
=
$request
->
all
([
'title'
,
'
uri
'
,
'parent_id'
]);
$params
=
$request
->
all
([
'title'
,
'
key'
,
'icon'
,
'api'
,
'is_menu
'
,
'parent_id'
]);
AdminMenu
::
create
(
$params
);
AdminMenu
::
create
(
$params
);
...
@@ -163,15 +176,19 @@ class MenuController extends BaseController
...
@@ -163,15 +176,19 @@ class MenuController extends BaseController
*
*
*/
*/
public
function
edit
(
MenuRequest
$request
,
$id
){
public
function
edit
(
MenuRequest
$request
,
$id
){
$params
=
$request
->
all
([
'title'
,
'
uri
'
,
'parent_id'
]);
$params
=
$request
->
all
([
'title'
,
'
key'
,
'icon'
,
'api'
,
'is_menu
'
,
'parent_id'
]);
$menu
=
AdminMenu
::
where
(
'id'
,
$id
)
->
first
();
$menu
=
AdminMenu
::
where
(
'id'
,
$id
)
->
first
();
if
(
!
$menu
){
if
(
!
$menu
){
abort
(
500
,
'菜单不存在'
);
abort
(
500
,
'菜单不存在'
);
}
}
if
(
$params
[
'uri'
]
&&
$menu
->
uri
!=
$params
[
'uri'
]
&&
AdminMenu
::
where
(
'uri'
,
$params
[
'uri'
])
->
first
()){
if
(
$menu
->
key
!=
$params
[
'key'
]
&&
AdminMenu
::
where
(
'key'
,
$params
[
'key'
])
->
first
()){
abort
(
500
,
'uri重复'
);
abort
(
500
,
'路由标识重复'
);
}
if
(
$menu
->
id
===
$params
[
'parent_id'
]){
abort
(
500
,
'父级菜单不能选择自己'
);
}
}
$menu
->
update
(
$params
);
$menu
->
update
(
$params
);
...
@@ -196,12 +213,15 @@ class MenuController extends BaseController
...
@@ -196,12 +213,15 @@ class MenuController extends BaseController
*/
*/
public
function
delete
(
$id
){
public
function
delete
(
$id
){
$menu
=
AdminMenu
::
where
(
'id'
,
$id
)
->
first
();
$menu
=
AdminMenu
::
where
(
'id'
,
$id
)
->
first
();
if
(
$menu
){
if
(
$menu
){
DB
::
transaction
(
function
()
use
(
$menu
){
DB
::
transaction
(
function
()
use
(
$menu
){
$menu
->
delete
();
$menu
->
delete
();
AdminRoleMenu
::
where
(
'menu_id'
,
$menu
->
id
)
->
delete
();
AdminRoleMenu
::
where
(
'menu_id'
,
$menu
->
id
)
->
delete
();
#子菜单删除
$descendantsIds
=
$menu
->
descendantsIds
();
AdminMenu
::
whereIn
(
'id'
,
$descendantsIds
)
->
delete
();
AdminRoleMenu
::
whereIn
(
'menu_id'
,
$descendantsIds
)
->
delete
();
});
});
}
}
return
$this
->
response
->
noContent
()
->
statusCode
(
204
);
return
$this
->
response
->
noContent
()
->
statusCode
(
204
);
...
...
Modules/Admin/Http/Controllers/RoleController.php
View file @
29f8e5ab
...
@@ -16,6 +16,7 @@ use Modules\Admin\Entities\AdminRoleMenu;
...
@@ -16,6 +16,7 @@ use Modules\Admin\Entities\AdminRoleMenu;
use
Modules\Admin\Entities\AdminRoleUser
;
use
Modules\Admin\Entities\AdminRoleUser
;
use
Modules\Admin\Http\Requests\RoleRequest
;
use
Modules\Admin\Http\Requests\RoleRequest
;
use
Modules\Admin\Http\Transformers\AdminRoleTransformer
;
use
Modules\Admin\Http\Transformers\AdminRoleTransformer
;
use
Modules\Admin\Http\Utils\Helper
;
class
RoleController
extends
BaseController
class
RoleController
extends
BaseController
{
{
...
@@ -84,11 +85,38 @@ class RoleController extends BaseController
...
@@ -84,11 +85,38 @@ class RoleController extends BaseController
*
*
*/
*/
public
function
add
(
RoleRequest
$request
){
public
function
add
(
RoleRequest
$request
){
$params
=
$request
->
all
([
'name'
,
'slug'
]);
$params
=
$request
->
all
([
'name'
,
'slug'
,
'menus'
]);
AdminRole
::
create
(
$params
);
logger
(
$params
);
if
(
!
is_array
(
$params
[
'menus'
])){
abort
(
422
,
'菜单格式错误'
);
}
$menus
=
AdminMenu
::
all
()
->
toArray
();
if
(
$error
=
$this
->
checkMenu
(
$menus
,
$params
[
'menus'
])){
abort
(
500
,
$error
);
}
$role
=
DB
::
transaction
(
function
()
use
(
$params
){
$role
=
AdminRole
::
create
(
$params
);
$insert
=
[];
foreach
(
$params
[
'menus'
]
as
$item
){
$insert
[]
=
[
'role_id'
=>
$role
->
id
,
'menu_id'
=>
(
int
)
$item
,
];
}
if
(
$insert
){
AdminRoleMenu
::
insert
(
$insert
);
}
return
$role
;
});
return
$this
->
response
->
item
(
$role
,
new
AdminRoleTransformer
());
return
$this
->
response
->
noContent
()
->
statusCode
(
201
);
}
}
/**
/**
...
@@ -166,7 +194,7 @@ class RoleController extends BaseController
...
@@ -166,7 +194,7 @@ class RoleController extends BaseController
abort
(
422
,
'菜单格式错误'
);
abort
(
422
,
'菜单格式错误'
);
}
}
if
(
$role_id
==
1
){
if
(
Helper
::
isAdministrator
(
$role_id
)
){
abort
(
500
,
'超级管理员不可编辑权限'
);
abort
(
500
,
'超级管理员不可编辑权限'
);
}
}
...
@@ -192,6 +220,10 @@ class RoleController extends BaseController
...
@@ -192,6 +220,10 @@ class RoleController extends BaseController
if
(
$insert
){
if
(
$insert
){
AdminRoleMenu
::
insert
(
$insert
);
AdminRoleMenu
::
insert
(
$insert
);
}
}
Helper
::
getRoleMenu
(
$role
,
true
);
Helper
::
getRoleApi
(
$role
,
true
);
});
});
return
$this
->
response
->
noContent
()
->
statusCode
(
204
);
return
$this
->
response
->
noContent
()
->
statusCode
(
204
);
}
}
...
@@ -214,8 +246,11 @@ class RoleController extends BaseController
...
@@ -214,8 +246,11 @@ class RoleController extends BaseController
public
function
delete
(
$role_id
){
public
function
delete
(
$role_id
){
$role
=
AdminRole
::
where
(
'id'
,
$role_id
)
->
first
();
$role
=
AdminRole
::
where
(
'id'
,
$role_id
)
->
first
();
if
(
$role
){
if
(
$role
){
if
(
Helper
::
isAdministrator
(
$role_id
)){
abort
(
500
,
'超级管理员不可删除'
);
}
if
(
AdminRoleUser
::
where
(
'role_id'
,
$role
->
id
)
->
count
()
>
0
){
if
(
AdminRoleUser
::
where
(
'role_id'
,
$role
->
id
)
->
count
()
>
0
){
abort
(
"此角色还有关联的用户,无法删除"
);
abort
(
"此角色还有关联的用户,无法删除"
);
}
}
...
...
Modules/Admin/Http/Controllers/UserController.php
View file @
29f8e5ab
...
@@ -122,7 +122,7 @@ class UserController extends BaseController
...
@@ -122,7 +122,7 @@ class UserController extends BaseController
return
$user
;
return
$user
;
});
});
return
$this
->
response
->
item
(
$user
,
new
AdminUserTransformer
());
return
$this
->
response
->
item
(
$user
,
new
AdminUserTransformer
(
true
));
}
}
/**
/**
...
...
Modules/Admin/Http/Middleware/RoleMenu.php
View file @
29f8e5ab
...
@@ -21,17 +21,18 @@ class RoleMenu
...
@@ -21,17 +21,18 @@ class RoleMenu
$user
=
auth
()
->
user
();
$user
=
auth
()
->
user
();
#角色
#角色
$role
=
$user
->
roles
()
->
first
();
$role
=
$user
->
roles
()
->
first
();
$menus
=
Helper
::
getRoleMenu
(
$role
);
$role_apis
=
array_filter
(
array_column
(
Helper
::
getRoleApi
(
$role
),
'api'
));
$role_uris
=
array_filter
(
array_column
(
$menus
,
'uri'
));
$apis
=
array_filter
(
array_column
(
Helper
::
getAllApi
(),
'api'
));
$uris
=
array_filter
(
array_column
(
Helper
::
getAllMenu
(),
'uri'
));
$route
=
str_replace
(
"."
,
"/"
,
Route
::
currentRouteName
());
$route
=
str_replace
(
"."
,
"/"
,
Route
::
currentRouteName
());
logger
(
$route
);
logger
(
$role_apis
);
logger
(
$apis
);
#验证菜单权限
#验证菜单权限
if
(
if
(
!
Helper
::
isAdministrator
(
$role
->
id
)
!
Helper
::
isAdministrator
(
$role
->
id
)
&&
in_array
(
$route
,
$
ur
is
)
&&
in_array
(
$route
,
$
ap
is
)
&&
!
in_array
(
$route
,
$role_
ur
is
)
&&
!
in_array
(
$route
,
$role_
ap
is
)
){
){
abort
(
403
,
'没有权限'
);
abort
(
403
,
'没有权限'
);
}
}
...
...
Modules/Admin/Http/Requests/FileRequest.php
0 → 100644
View file @
29f8e5ab
<?php
namespace
Modules\Admin\Http\Requests
;
class
FileRequest
extends
BaseRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
$upload
=
config
(
'upload'
,
[]);
$types
=
implode
(
','
,
array_keys
(
$upload
));
$validate
=
isset
(
$upload
[
$this
->
type
])
?
'required|file|'
.
$upload
[
$this
->
type
][
'validate'
]
:
'required|file'
;
return
[
'type'
=>
'required|in:'
.
$types
,
'file'
=>
$validate
,
];
}
public
function
messages
()
{
return
config
(
'upload.'
.
$this
->
type
.
'.validate_msg'
,
[]);
}
}
Modules/Admin/Http/Requests/MenuRequest.php
View file @
29f8e5ab
...
@@ -4,11 +4,6 @@ namespace Modules\Admin\Http\Requests;
...
@@ -4,11 +4,6 @@ namespace Modules\Admin\Http\Requests;
class
MenuRequest
extends
BaseRequest
class
MenuRequest
extends
BaseRequest
{
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
postRules
()
public
function
postRules
()
{
{
if
(
empty
(
$this
->
parent_id
)){
if
(
empty
(
$this
->
parent_id
)){
...
@@ -18,16 +13,11 @@ class MenuRequest extends BaseRequest
...
@@ -18,16 +13,11 @@ class MenuRequest extends BaseRequest
$parent_id_rule
=
[
'exists:admin_menus,id'
];
$parent_id_rule
=
[
'exists:admin_menus,id'
];
}
}
if
(
empty
(
$this
->
uri
)){
$uri_rule
=
[];
}
else
{
$uri_rule
=
[
'unique:admin_menus,uri'
];
}
return
[
return
[
'parent_id'
=>
$parent_id_rule
,
'parent_id'
=>
$parent_id_rule
,
'title'
=>
'bail|required'
,
'title'
=>
'bail|required'
,
'uri'
=>
$uri_rule
,
//'path' => ['required'],
'key'
=>
[
'required'
,
'unique:admin_menus,key'
],
];
];
}
}
...
@@ -43,6 +33,7 @@ class MenuRequest extends BaseRequest
...
@@ -43,6 +33,7 @@ class MenuRequest extends BaseRequest
return
[
return
[
'parent_id'
=>
$parent_id_rule
,
'parent_id'
=>
$parent_id_rule
,
'title'
=>
'bail|required'
,
'title'
=>
'bail|required'
,
'key'
=>
[
'required'
],
];
];
}
}
...
@@ -51,7 +42,9 @@ class MenuRequest extends BaseRequest
...
@@ -51,7 +42,9 @@ class MenuRequest extends BaseRequest
return
[
return
[
'title.required'
=>
'菜单名称必须'
,
'title.required'
=>
'菜单名称必须'
,
'parent_id.exists'
=>
'父菜单不存在'
,
'parent_id.exists'
=>
'父菜单不存在'
,
'uri.unique'
=>
'uri重复'
,
//'api.unique' => '接口地址重复',
'key.required'
=>
'路由标识必填'
,
'key.unique'
=>
'路由标识重复'
,
];
];
}
}
}
}
Modules/Admin/Http/Service/BaseService.php
0 → 100644
View file @
29f8e5ab
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/6/13
* Time: 9:52
*/
namespace
Modules\Admin\Http\Service
;
class
BaseService
{
protected
$model
;
public
function
create
(
$data
)
{
return
$this
->
model
=
$this
->
model
->
create
(
$data
)
->
refresh
();
}
public
function
update
(
$id
,
$data
)
{
$this
->
model
=
$this
->
model
->
find
(
$id
);
$this
->
model
->
fill
(
$data
);
return
$this
->
model
->
save
();
}
public
function
getModel
()
{
return
$this
->
model
;
}
}
Modules/Admin/Http/Service/FileService.php
0 → 100644
View file @
29f8e5ab
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/6/14
* Time: 14:47
*/
namespace
Modules\Admin\Http\Service
;
use
Modules\Admin\Entities\File
;
class
FileService
extends
BaseService
{
public
function
__construct
(
File
$file
)
{
$this
->
model
=
$file
;
}
public
function
process
(
$file
,
$type
)
{
$config
=
config
(
'upload'
,
[]);
$folder
=
$config
[
$type
][
'folder'
];
$folder_name
=
"
$folder
/"
.
date
(
'Ym'
,
time
())
.
'/'
.
date
(
'd'
,
time
());
$path
=
$file
->
store
(
$folder_name
,
$config
[
$type
][
'filesystem'
]);
$info
=
[];
$info
[
'user_id'
]
=
\Auth
::
id
();
$info
[
'type'
]
=
$type
;
$info
[
'path'
]
=
$path
;
$info
[
'size'
]
=
$file
->
getSize
();
$info
[
'mime'
]
=
$file
->
getMimeType
();
$info
[
'name'
]
=
$file
->
getClientOriginalName
();
$this
->
create
(
$info
);
return
$this
->
model
;
}
}
Modules/Admin/Http/Transformers/AdminMenuTransformer.php
View file @
29f8e5ab
...
@@ -29,15 +29,16 @@ class AdminMenuTransformer extends BaseTransformer
...
@@ -29,15 +29,16 @@ class AdminMenuTransformer extends BaseTransformer
* @OA\Property(property="id", type="integer", description="ID"),
* @OA\Property(property="id", type="integer", description="ID"),
* @OA\Property(property="parent_id", type="string", description="上级ID"),
* @OA\Property(property="parent_id", type="string", description="上级ID"),
* @OA\Property(property="title", type="string", description="标题"),
* @OA\Property(property="title", type="string", description="标题"),
* @OA\Property(property="uri", type="string", description="uri"),
* @OA\Property(property="icon", type="string", description="图标"),
* @OA\Property(property="key", type="string", description="路由标识"),
* @OA\Property(property="is_menu", type="integer", description="是否菜单"),
* @OA\Property(property="created_at", type="string", description="创建时间"),
* @OA\Property(property="created_at", type="string", description="创建时间"),
* )
* )
*/
*/
public
function
transform
(
AdminMenu
$menu
)
public
function
transform
(
AdminMenu
$menu
)
{
{
$return
=
[
'id'
,
'parent_id'
,
'title'
,
'
uri
'
,
'created_at'
];
$return
=
[
'id'
,
'parent_id'
,
'title'
,
'
key'
,
'icon'
,
'is_menu
'
,
'created_at'
];
return
Helper
::
mapAttr
(
$menu
,
$return
);
return
Helper
::
mapAttr
(
$menu
,
$return
);
}
}
...
...
Modules/Admin/Http/Transformers/AdminRoleTransformer.php
View file @
29f8e5ab
...
@@ -16,7 +16,7 @@ class AdminRoleTransformer extends BaseTransformer
...
@@ -16,7 +16,7 @@ class AdminRoleTransformer extends BaseTransformer
{
{
use
Macroable
;
use
Macroable
;
protected
$show_menu
;
protected
$show_menu
;
public
function
__construct
(
$show_menu
=
fals
e
)
public
function
__construct
(
$show_menu
=
tru
e
)
{
{
$this
->
show_menu
=
$show_menu
;
$this
->
show_menu
=
$show_menu
;
parent
::
__construct
();
parent
::
__construct
();
...
@@ -29,17 +29,21 @@ class AdminRoleTransformer extends BaseTransformer
...
@@ -29,17 +29,21 @@ class AdminRoleTransformer extends BaseTransformer
* schema="Role",
* schema="Role",
* @OA\Property(property="name", type="integer", description="名称"),
* @OA\Property(property="name", type="integer", description="名称"),
* @OA\Property(property="slug", type="string", description="描述"),
* @OA\Property(property="slug", type="string", description="描述"),
* @OA\Property(property="is_admin", type="string", description="是否超级管理员"),
* @OA\Property(property="menus", type="string", description="菜单id列表"),
* @OA\Property(property="created_at", type="string", description="创建时间"),
* @OA\Property(property="created_at", type="string", description="创建时间"),
* )
* )
*/
*/
public
function
transform
(
AdminRole
$role
)
public
function
transform
(
AdminRole
$role
)
{
{
$return
=
[
'name'
,
'slug'
,
'created_at'
];
$return
=
[
'
id'
,
'
name'
,
'slug'
,
'created_at'
];
$return
=
Helper
::
mapAttr
(
$role
,
$return
);
$return
=
Helper
::
mapAttr
(
$role
,
$return
);
$return
[
'is_admin'
]
=
Helper
::
isAdministrator
(
$return
[
'id'
]);
if
(
$this
->
show_menu
){
if
(
$this
->
show_menu
){
$return
[
'menu
_id
s'
]
=
array_column
(
$role
->
menu
->
toArray
(),
'id'
);
$return
[
'menus'
]
=
array_column
(
$role
->
menu
->
toArray
(),
'id'
);
}
}
return
$return
;
return
$return
;
}
}
}
}
Modules/Admin/Http/Transformers/AdminUserTransformer.php
View file @
29f8e5ab
...
@@ -15,11 +15,13 @@ class AdminUserTransformer extends BaseTransformer
...
@@ -15,11 +15,13 @@ class AdminUserTransformer extends BaseTransformer
{
{
use
Macroable
;
use
Macroable
;
protected
$hideDetail
=
false
;
protected
array
$availableIncludes
=
[
'roles'
]
;
public
function
__construct
(
$hideDetail
=
false
)
protected
$show_role
=
false
;
public
function
__construct
(
$show_role
=
false
)
{
{
$this
->
hideDetail
=
$hideDetail
;
$this
->
show_role
=
$show_role
;
parent
::
__construct
();
parent
::
__construct
();
}
}
...
@@ -38,8 +40,18 @@ class AdminUserTransformer extends BaseTransformer
...
@@ -38,8 +40,18 @@ class AdminUserTransformer extends BaseTransformer
*/
*/
public
function
transform
(
AdminUser
$user
)
public
function
transform
(
AdminUser
$user
)
{
{
$return
=
[
'id'
,
'username'
,
'avatar'
,
'name'
,
'created_at'
,
'updated_at'
];
$return
=
[
'id'
,
'username'
,
'avatar'
,
'avatar_full_url'
,
'name'
,
'created_at'
,
'updated_at'
];
$return
=
Helper
::
mapAttr
(
$user
,
$return
);
$return
[
'is_admin'
]
=
Helper
::
isAdministrator
(
$return
[
'id'
]);
if
(
$this
->
show_role
){
$return
[
'role'
]
=
$user
->
roles
()
->
first
();
}
return
$return
;
}
return
Helper
::
mapAttr
(
$user
,
$return
);
public
function
includeRoles
(
$user
)
{
return
$user
->
roles
()
?
$this
->
item
(
$user
->
roles
()
->
first
(),
new
AdminRoleTransformer
(
false
))
:
null
;
}
}
}
}
Modules/Admin/Http/Transformers/FileTransformer.php
0 → 100644
View file @
29f8e5ab
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/6/15
* Time: 9:47
*/
namespace
Modules\Admin\Http\Transformers
;
use
Modules\Admin\Entities\File
;
use
Modules\Admin\Http\Utils\Helper
;
class
FileTransformer
extends
BaseTransformer
{
/**
* @OA\Schema(
* description="文件信息",
* type="object",
* schema="File",
* @OA\Property(property="id", type="integer", description="ID"),
* @OA\Property(property="name", type="string", description="文件名"),
* @OA\Property(property="path", type="string", description="文件路径"),
* @OA\Property(property="mime", type="string", description="MIME类型"),
* @OA\Property(property="type", type="string", description="文件类型"),
* @OA\Property(property="url", type="string", description="访问URL"),
* @OA\Property(property="created_at", type="string", description="注册时间"),
* @OA\Property(property="updated_at", type="string", description="更新时间")
* )
*/
public
function
transform
(
File
$file
)
{
return
Helper
::
mapAttr
(
$file
,
[
'id'
,
'name'
,
'path'
,
'type'
,
'mime'
,
'created_at'
,
'updated_at'
,
'url'
=>
Helper
::
getFileUrl
(
$file
->
path
,
$file
->
type
),
]);
}
}
Modules/Admin/Http/Utils/Helper.php
View file @
29f8e5ab
...
@@ -21,7 +21,7 @@ class Helper {
...
@@ -21,7 +21,7 @@ class Helper {
if
(
!
$refresh
&&
$menu
=
Cache
::
get
(
"ALL_MENU"
)){
if
(
!
$refresh
&&
$menu
=
Cache
::
get
(
"ALL_MENU"
)){
return
json_decode
(
$menu
,
true
);
return
json_decode
(
$menu
,
true
);
}
}
$menu
=
AdminMenu
::
all
()
->
toArray
();
$menu
=
AdminMenu
::
where
(
'is_menu'
,
1
)
->
get
()
->
toArray
();
if
(
$menu
){
if
(
$menu
){
Cache
::
put
(
"ALL_MENU"
,
json_encode
(
$menu
));
Cache
::
put
(
"ALL_MENU"
,
json_encode
(
$menu
));
}
}
...
@@ -29,6 +29,28 @@ class Helper {
...
@@ -29,6 +29,28 @@ class Helper {
}
}
/**
/**
* 获取全部接口地址
* @desc
*
* @param false $refresh
*
* @return mixed|mixed[]
* @author [ZZM]
* @since 2023/10/30
* @modify
*/
static
function
getAllApi
(
$refresh
=
false
){
if
(
!
$refresh
&&
$apis
=
Cache
::
get
(
"ALL_API"
)){
return
json_decode
(
$apis
,
true
);
}
$apis
=
AdminMenu
::
all
()
->
toArray
();
if
(
$apis
){
Cache
::
put
(
"ALL_API"
,
json_encode
(
$apis
));
}
return
$apis
;
}
/**
* 获取角色菜单
* 获取角色菜单
* @desc
* @desc
*
*
...
@@ -42,14 +64,14 @@ class Helper {
...
@@ -42,14 +64,14 @@ class Helper {
static
function
getRoleMenu
(
$role
,
$refresh
=
false
){
static
function
getRoleMenu
(
$role
,
$refresh
=
false
){
if
(
Helper
::
isAdministrator
(
$role
->
id
)){
if
(
Helper
::
isAdministrator
(
$role
->
id
)){
#超级管理员默认获取全部菜单
#超级管理员默认获取全部菜单
return
self
::
getAllMenu
();
return
self
::
getAllMenu
(
true
);
}
}
if
(
!
$refresh
&&
$menu
=
Cache
::
get
(
"ROLE_MENU_
{
$role
->
id
}
"
)){
if
(
!
$refresh
&&
$menu
=
Cache
::
get
(
"ROLE_MENU_
{
$role
->
id
}
"
)){
return
json_decode
(
$menu
,
true
);
return
json_decode
(
$menu
,
true
);
}
}
$menu
=
$role
->
menu
;
$menu
=
$role
->
menu
()
->
where
(
'is_menu'
,
1
)
->
get
()
;
$menu
=
$menu
->
toArray
();
$menu
=
$menu
->
toArray
();
if
(
$menu
){
if
(
$menu
){
...
@@ -60,6 +82,38 @@ class Helper {
...
@@ -60,6 +82,38 @@ class Helper {
}
}
/**
/**
* 获取角色接口地址
* @desc
*
* @param $role
* @param false $refresh
*
* @return mixed|mixed[]
* @since 2023/10/30
* @modify
* @author [ZZM]
*/
static
function
getRoleApi
(
$role
,
$refresh
=
false
){
if
(
Helper
::
isAdministrator
(
$role
->
id
)){
#超级管理员默认获取全部菜单
return
self
::
getAllApi
(
$refresh
);
}
if
(
!
$refresh
&&
$apis
=
Cache
::
get
(
"ROLE_API_
{
$role
->
id
}
"
)){
return
json_decode
(
$apis
,
true
);
}
$apis
=
$role
->
menu
()
->
get
();
$apis
=
$apis
->
toArray
();
if
(
$apis
){
Cache
::
put
(
"ROLE_API_
{
$role
->
id
}
"
,
json_encode
(
$apis
));
}
return
$apis
;
}
/**
* 是否超级管理员
* 是否超级管理员
* @desc
* @desc
*
*
...
@@ -147,7 +201,7 @@ class Helper {
...
@@ -147,7 +201,7 @@ class Helper {
if
(
is_string
(
$key
)
&&
\Illuminate\Support\Str
::
endsWith
(
$key
,
'_full_url'
))
{
if
(
is_string
(
$key
)
&&
\Illuminate\Support\Str
::
endsWith
(
$key
,
'_full_url'
))
{
$key2
=
substr
(
$key
,
0
,
-
9
);
$key2
=
substr
(
$key
,
0
,
-
9
);
$temp
[
$key
]
=
$obj
->
$key
??
file_u
rl
(
$obj
->
$key2
);
$temp
[
$key
]
=
$obj
->
$key
??
self
::
fileU
rl
(
$obj
->
$key2
);
}
else
{
}
else
{
$temp
[
$key
]
=
(
is_object
(
$obj
->
$key
)
&&
(
$obj
->
$key
instanceof
Carbon
))
?
$obj
->
$key
->
toDateTimeString
()
:
$obj
->
$key
;
$temp
[
$key
]
=
(
is_object
(
$obj
->
$key
)
&&
(
$obj
->
$key
instanceof
Carbon
))
?
$obj
->
$key
->
toDateTimeString
()
:
$obj
->
$key
;
}
}
...
@@ -156,4 +210,36 @@ class Helper {
...
@@ -156,4 +210,36 @@ class Helper {
}
}
return
$temp
;
return
$temp
;
}
}
static
function
getFileUrl
(
$path
,
$type
)
{
$file_config
=
config
(
'upload.'
.
$type
,
[]);
$key
=
'fileststems.disks.'
.
$file_config
[
'filesystem'
]
.
'.url'
;
$prefix
=
$file_config
[
'url'
]
??
config
(
$key
,
null
);
return
$prefix
?
$prefix
.
$path
:
null
;
}
static
function
fileUrl
(
$file_path
)
{
if
(
$file_path
==
null
)
{
return
null
;
}
if
(
is_array
(
$file_path
))
{
return
array_map
(
'Helper::fileUrl'
,
$file_path
);
}
if
(
substr
(
$file_path
,
0
,
4
)
==
'http'
)
{
return
$file_path
;
}
$host_prefix
=
config
(
'app.file_url'
,
config
(
'app.url'
,
''
));
if
(
substr
(
$file_path
,
0
,
1
)
==
'/'
)
{
return
$host_prefix
.
$file_path
;
}
return
$host_prefix
.
config
(
'app.file_prefix'
,
'/uploads/'
)
.
$file_path
;
}
}
}
Modules/Admin/Routes/api.php
View file @
29f8e5ab
...
@@ -21,13 +21,18 @@ $api->version('v1', [
...
@@ -21,13 +21,18 @@ $api->version('v1', [
],
function
(
$api
)
{
],
function
(
$api
)
{
#登录
#登录
$api
->
post
(
'auth/login'
,
'AuthController@login'
);
$api
->
post
(
'auth/login'
,
'AuthController@login'
);
#登出
$api
->
put
(
'auth/login_out'
,
'AuthController@loginOut'
);
$api
->
group
([
'middleware'
=>
'api.auth'
],
function
(
$api
)
{
$api
->
group
([
'middleware'
=>
'api.auth'
],
function
(
$api
)
{
#刷新token
#刷新token
$api
->
put
(
'auth/refresh'
,
'AuthController@refreshToken'
);
$api
->
put
(
'auth/refresh'
,
'AuthController@refreshToken'
);
#
登出
#
用户信息
$api
->
put
(
'auth/login_out'
,
'AuthController@loginOut
'
);
$api
->
get
(
'auth/info'
,
'AuthController@userInfo
'
);
#配置
#配置
$api
->
get
(
'configs'
,
'AuthController@apiConfig'
);
$api
->
get
(
'configs'
,
'AuthController@apiConfig'
);
#上传文件
$api
->
post
(
'files'
,
'FilesController@store'
);
$api
->
group
([
'middleware'
=>
'role_menu'
],
function
(
$api
){
$api
->
group
([
'middleware'
=>
'role_menu'
],
function
(
$api
){
#菜单
#菜单
...
...
Modules/Admin/vendor/autoload.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload.php @generated by Composer
if
(
PHP_VERSION_ID
<
50600
)
{
if
(
!
headers_sent
())
{
header
(
'HTTP/1.1 500 Internal Server Error'
);
}
$err
=
'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '
.
PHP_VERSION
.
', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'
.
PHP_EOL
;
if
(
!
ini_get
(
'display_errors'
))
{
if
(
PHP_SAPI
===
'cli'
||
PHP_SAPI
===
'phpdbg'
)
{
fwrite
(
STDERR
,
$err
);
}
elseif
(
!
headers_sent
())
{
echo
$err
;
}
}
trigger_error
(
$err
,
E_USER_ERROR
);
}
require_once
__DIR__
.
'/composer/autoload_real.php'
;
return
ComposerAutoloaderInita0dc2b1cb3bf0cf97958da9a77dfb137
::
getLoader
();
Modules/Admin/vendor/composer/ClassLoader.php
0 → 100644
View file @
29f8e5ab
This diff is collapsed.
Click to expand it.
Modules/Admin/vendor/composer/LICENSE
0 → 100644
View file @
29f8e5ab
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Modules/Admin/vendor/composer/autoload_classmap.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload_classmap.php @generated by Composer
$vendorDir
=
dirname
(
__DIR__
);
$baseDir
=
dirname
(
$vendorDir
);
return
array
(
'Composer\\InstalledVersions'
=>
$vendorDir
.
'/composer/InstalledVersions.php'
,
);
Modules/Admin/vendor/composer/autoload_files.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload_files.php @generated by Composer
$vendorDir
=
dirname
(
__DIR__
);
$baseDir
=
dirname
(
$vendorDir
);
return
array
(
'0be7e9e0829558786ef70afd7f14439f'
=>
$baseDir
.
'/Utils/helpers.php'
,
);
Modules/Admin/vendor/composer/autoload_namespaces.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir
=
dirname
(
__DIR__
);
$baseDir
=
dirname
(
$vendorDir
);
return
array
(
);
Modules/Admin/vendor/composer/autoload_psr4.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload_psr4.php @generated by Composer
$vendorDir
=
dirname
(
__DIR__
);
$baseDir
=
dirname
(
$vendorDir
);
return
array
(
'Modules\\Admin\\'
=>
array
(
$baseDir
.
'/'
),
);
Modules/Admin/vendor/composer/autoload_real.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload_real.php @generated by Composer
class
ComposerAutoloaderInita0dc2b1cb3bf0cf97958da9a77dfb137
{
private
static
$loader
;
public
static
function
loadClassLoader
(
$class
)
{
if
(
'Composer\Autoload\ClassLoader'
===
$class
)
{
require
__DIR__
.
'/ClassLoader.php'
;
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public
static
function
getLoader
()
{
if
(
null
!==
self
::
$loader
)
{
return
self
::
$loader
;
}
spl_autoload_register
(
array
(
'ComposerAutoloaderInita0dc2b1cb3bf0cf97958da9a77dfb137'
,
'loadClassLoader'
),
true
,
true
);
self
::
$loader
=
$loader
=
new
\Composer\Autoload\ClassLoader
(
\dirname
(
__DIR__
));
spl_autoload_unregister
(
array
(
'ComposerAutoloaderInita0dc2b1cb3bf0cf97958da9a77dfb137'
,
'loadClassLoader'
));
require
__DIR__
.
'/autoload_static.php'
;
call_user_func
(
\Composer\Autoload\ComposerStaticInita0dc2b1cb3bf0cf97958da9a77dfb137
::
getInitializer
(
$loader
));
$loader
->
register
(
true
);
$filesToLoad
=
\Composer\Autoload\ComposerStaticInita0dc2b1cb3bf0cf97958da9a77dfb137
::
$files
;
$requireFile
=
\Closure
::
bind
(
static
function
(
$fileIdentifier
,
$file
)
{
if
(
empty
(
$GLOBALS
[
'__composer_autoload_files'
][
$fileIdentifier
]))
{
$GLOBALS
[
'__composer_autoload_files'
][
$fileIdentifier
]
=
true
;
require
$file
;
}
},
null
,
null
);
foreach
(
$filesToLoad
as
$fileIdentifier
=>
$file
)
{
$requireFile
(
$fileIdentifier
,
$file
);
}
return
$loader
;
}
}
Modules/Admin/vendor/composer/autoload_static.php
0 → 100644
View file @
29f8e5ab
<?php
// autoload_static.php @generated by Composer
namespace
Composer\Autoload
;
class
ComposerStaticInita0dc2b1cb3bf0cf97958da9a77dfb137
{
public
static
$files
=
array
(
'0be7e9e0829558786ef70afd7f14439f'
=>
__DIR__
.
'/../..'
.
'/Utils/helpers.php'
,
);
public
static
$prefixLengthsPsr4
=
array
(
'M'
=>
array
(
'Modules\\Admin\\'
=>
14
,
),
);
public
static
$prefixDirsPsr4
=
array
(
'Modules\\Admin\\'
=>
array
(
0
=>
__DIR__
.
'/../..'
.
'/'
,
),
);
public
static
$classMap
=
array
(
'Composer\\InstalledVersions'
=>
__DIR__
.
'/..'
.
'/composer/InstalledVersions.php'
,
);
public
static
function
getInitializer
(
ClassLoader
$loader
)
{
return
\Closure
::
bind
(
function
()
use
(
$loader
)
{
$loader
->
prefixLengthsPsr4
=
ComposerStaticInita0dc2b1cb3bf0cf97958da9a77dfb137
::
$prefixLengthsPsr4
;
$loader
->
prefixDirsPsr4
=
ComposerStaticInita0dc2b1cb3bf0cf97958da9a77dfb137
::
$prefixDirsPsr4
;
$loader
->
classMap
=
ComposerStaticInita0dc2b1cb3bf0cf97958da9a77dfb137
::
$classMap
;
},
null
,
ClassLoader
::
class
);
}
}
composer.lock
View file @
29f8e5ab
This diff is collapsed.
Click to expand it.
config/filesystems.php
View file @
29f8e5ab
...
@@ -29,6 +29,12 @@ return [
...
@@ -29,6 +29,12 @@ return [
*/
*/
'disks'
=>
[
'disks'
=>
[
'admin'
=>
[
'driver'
=>
'local'
,
'root'
=>
public_path
(
'uploads'
),
'visibility'
=>
'public'
,
'url'
=>
env
(
'APP_URL'
)
.
'/uploads'
,
],
'local'
=>
[
'local'
=>
[
'driver'
=>
'local'
,
'driver'
=>
'local'
,
...
...
config/upload.php
0 → 100644
View file @
29f8e5ab
<?php
$default_filesystem
=
"admin"
;
$url
=
"/uploads/"
;
return
[
'avatar'
=>
[
"validate"
=>
'mimes:jpeg,jpg,bmp,png,gif|dimensions:min_width=200,min_height=200'
,
"validate_msg"
=>
[],
"folder"
=>
"avatar"
,
"filesystem"
=>
$default_filesystem
,
//使用的储存系统
"url"
=>
$url
,
'image_processor'
=>
'resize:200,null,constraint=aspectRatio&upsize|crop:200,200'
,
],
];
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment