Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1c065309
authored
Dec 07, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
权限
parent
90dc982d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
app/Admin/Forms/User/AssignUserHandle.php
app/Admin/Forms/User/TransferUserHandle.php
app/Admin/Service/PermService.php
app/Models/Cms/CmsUserPermModel.php
app/Admin/Forms/User/AssignUserHandle.php
View file @
1c065309
...
@@ -45,7 +45,6 @@ class AssignUserHandle extends Form implements LazyRenderable
...
@@ -45,7 +45,6 @@ class AssignUserHandle extends Form implements LazyRenderable
$adminUser
=
"userId"
;
$adminUser
=
"userId"
;
$nowSaleId
=
getAdminUserId
();
$nowSaleId
=
getAdminUserId
();
$role
=
PermService
::
getUserRoles
(
$nowSaleId
);
$role
=
PermService
::
getUserRoles
(
$nowSaleId
);
return
$query
;
if
(
$nowSaleId
==
1000
)
{
if
(
$nowSaleId
==
1000
)
{
return
$query
;
return
$query
;
}
}
...
...
app/Admin/Forms/User/TransferUserHandle.php
View file @
1c065309
...
@@ -45,10 +45,6 @@ class TransferUserHandle extends Form implements LazyRenderable
...
@@ -45,10 +45,6 @@ class TransferUserHandle extends Form implements LazyRenderable
$adminUser
=
"userId"
;
$adminUser
=
"userId"
;
$nowSaleId
=
getAdminUserId
();
$nowSaleId
=
getAdminUserId
();
$role
=
PermService
::
getUserRoles
(
$nowSaleId
);
$role
=
PermService
::
getUserRoles
(
$nowSaleId
);
return
$query
;
if
(
$nowSaleId
==
1000
||
$role
[
0
]
==
PermService
::
ROLE_SALE_DIRECTOR
)
{
if
(
$nowSaleId
==
1000
||
$role
[
0
]
==
PermService
::
ROLE_SALE_DIRECTOR
)
{
return
$query
;
return
$query
;
}
}
...
...
app/Admin/Service/PermService.php
View file @
1c065309
...
@@ -30,14 +30,20 @@ class PermService
...
@@ -30,14 +30,20 @@ class PermService
const
ROLE_NULL
=
0
;
// 未设置角色
const
ROLE_NULL
=
0
;
// 未设置角色
static
$role_name_map
=
[
self
::
ROLE_ADMIN
=>
"管理员"
,
self
::
ROLE_SALE
=>
"销售"
,
self
::
ROLE_SALE_LEADER
=>
"销售经理"
,
self
::
ROLE_SALE_DIRECTOR
=>
"销售总监"
,
self
::
ROLE_NULL
=>
"未设置角色"
,
];
// 获取当前用户角色
// 获取当前用户角色
public
static
function
getUserRoles
(
$uid
=
0
,
$email
=
""
)
public
static
function
getUserRoles
(
$uid
=
0
,
$email
=
""
)
{
{
$admin
=
request
()
->
get
(
"user"
);
$admin
=
request
()
->
get
(
"user"
);
$uid
=
$uid
?:
$admin
->
userId
;
$uid
=
$uid
?:
$admin
->
userId
;
$email
=
$email
?:
$admin
->
email
;
$email
=
$email
?:
$admin
->
email
;
// dump($uid);
// dump($email);
// 如果是管理员邮箱,直接返回管理员角色
// 如果是管理员邮箱,直接返回管理员角色
if
(
$email
==
'admin@ichunt.com'
)
{
if
(
$email
==
'admin@ichunt.com'
)
{
return
[
self
::
ROLE_ADMIN
];
return
[
self
::
ROLE_ADMIN
];
...
@@ -83,6 +89,7 @@ class PermService
...
@@ -83,6 +89,7 @@ class PermService
return
$role_list
;
return
$role_list
;
}
}
// 获取用户所有权限
// 获取用户所有权限
public
static
function
getUserPerms
()
public
static
function
getUserPerms
()
{
{
...
@@ -136,7 +143,6 @@ class PermService
...
@@ -136,7 +143,6 @@ class PermService
}
}
// 获取系统信息
// 获取系统信息
public
static
function
getBusinessInfo
()
public
static
function
getBusinessInfo
()
{
{
...
@@ -144,7 +150,6 @@ class PermService
...
@@ -144,7 +150,6 @@ class PermService
}
}
// 获取指定用户下级所有人员
// 获取指定用户下级所有人员
public
static
function
getSubUserId
(
$userId
)
public
static
function
getSubUserId
(
$userId
)
{
{
...
...
app/Models/Cms/CmsUserPermModel.php
View file @
1c065309
...
@@ -23,8 +23,8 @@ class CmsUserPermModel extends Model
...
@@ -23,8 +23,8 @@ class CmsUserPermModel extends Model
public
static
function
getUserPermByUidAndBid
(
$uid
,
$bid
)
public
static
function
getUserPermByUidAndBid
(
$uid
,
$bid
)
{
{
dump
(
$uid
);
//
dump($uid);
dump
(
$bid
);
//
dump($bid);
$res
=
self
::
where
([
"userId"
=>
$uid
,
"bid"
=>
$bid
])
->
first
();
$res
=
self
::
where
([
"userId"
=>
$uid
,
"bid"
=>
$bid
])
->
first
();
return
(
$res
)
?
$res
->
toArray
()
:
[];
return
(
$res
)
?
$res
->
toArray
()
:
[];
}
}
...
...
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