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
45b622f0
authored
Nov 18, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增权限控制
parent
f052feb7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
app/Admin/Service/UserService.php
app/Models/BaseModel.php
app/Models/Cms/CmsUser.php
app/Admin/Service/UserService.php
View file @
45b622f0
...
...
@@ -58,10 +58,11 @@ class UserService
public
static
function
userListTool
(
Grid
$grid
)
{
$grid
->
tools
([
new
UserTransferAction
(),
new
UserAssignAction
(),
]);
$action
=
[
new
UserTransferAction
()];
if
(
getAdminUserId
()
==
1000
||
checkPerm
(
User
::
SEM_USER_VIEW_SUB
)
||
checkPerm
(
User
::
SEM_USER_VIEW_ALL
))
{
$action
[]
=
new
UserAssignAction
();
}
$grid
->
tools
(
$action
);
}
public
static
function
userListActions
(
Grid
$grid
)
...
...
@@ -187,7 +188,7 @@ class UserService
];
User
::
updateByIdArr
(
$userIds
,
$update
);
InquiryService
::
batchUpdateSalesId
(
$saleId
,
$userIds
);
OrderService
::
changeOrderSales
(
$userIds
,
$saleId
,
$saleInfo
[
"name"
]);
OrderService
::
changeOrderSales
(
$userIds
,
$saleId
,
$saleInfo
[
"name"
]);
DB
::
commit
();
}
catch
(
\Throwable
$throwable
)
{
...
...
app/Models/BaseModel.php
View file @
45b622f0
...
...
@@ -9,12 +9,12 @@ class BaseModel extends Model
{
/*
* 权限
*/
public
function
scopeRule
(
$query
,
$viewList
,
$adminUser
=
"sale_id"
)
public
function
scopeRule
(
$query
,
$viewList
,
$adminUser
=
"sale_id"
)
{
$nowSaleId
=
getAdminUserId
();
//
if ($nowSaleId == 1000) {
//
return $query;
//
}
if
(
$nowSaleId
==
1000
)
{
return
$query
;
}
//查看所有
if
(
checkPerm
(
$viewList
[
0
]))
{
return
$query
;
...
...
app/Models/Cms/CmsUser.php
View file @
45b622f0
...
...
@@ -16,6 +16,11 @@ class CmsUser extends Model
return
(
$res
)
?
$res
->
toArray
()
:
[];
}
public
static
function
getUserList
()
{
return
CmsUser
::
where
([])
->
rule
(
\App\Models\User
::
$ruleViewList
,
'userId'
)
->
pluck
(
'name'
,
'userId'
)
->
toArray
();
}
//根据部门id获取列表
public
static
function
getUserListByDepartmentId
(
$departmentIds
)
{
...
...
@@ -25,7 +30,7 @@ class CmsUser extends Model
// 根据部门ID获取用户
public
static
function
getUserIdsByDepartmentIds
(
$department_ids
=
[],
$field
=
[],
$status
=
''
)
public
static
function
getUserIdsByDepartmentIds
(
$department_ids
=
[],
$field
=
[],
$status
=
''
)
{
$res
=
self
::
whereIn
(
'department_id'
,
$department_ids
);
...
...
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