Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
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
e3dabe64
authored
Oct 23, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp1
parent
8f341c5e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
31 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
config/perm_args.php
app/Http/Controllers/OrderController.php
View file @
e3dabe64
...
...
@@ -355,7 +355,7 @@ Class OrderController extends Controller
// 用户角色
$role
=
$perm
->
getUserRole
(
$request
);
dump
(
$perm
->
getGroupSalesId
(
$request
,
$role
));
// 获取权限菜单
if
(
$role
!=
1
)
{
$menus
=
$perm
->
getPermMenu
(
$menus
,
$request
->
user
->
userId
);
...
...
@@ -426,11 +426,11 @@ dump($perm->getGroupSalesId($request, $role));
// 订单查看权限
if
(
strpos
(
$info
[
'role'
],
','
)
!==
false
)
{
// 多角色情况下
$res
=
$perm
->
checkUserRole
(
$request
,
$info
[
'role'
]);
$res
=
$perm
->
checkUserRole
s
(
$request
,
$info
[
'role'
]);
}
else
{
if
(
in_array
(
$info
[
'role'
],
[
3
,
4
,
7
,
12
,
15
,
17
,
19
]
))
{
// 交易员、联营客服(线销一组、二组、三组客服)、自营客服、自营内部采购
if
(
in_array
(
$info
[
'role'
],
Config
(
'perm_args.kefu_order'
)
))
{
// 交易员、联营客服(线销一组、二组、三组客服)、自营客服、自营内部采购
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
// 筛选自己的订单
}
else
if
(
in_array
(
$info
[
'role'
],
[
14
,
16
,
18
]
))
{
// 线销一组、二组、三组主管(查看自己及其下组员的订单)
}
else
if
(
in_array
(
$info
[
'role'
],
Config
(
'perm_args.manager_order'
)
))
{
// 线销一组、二组、三组主管(查看自己及其下组员的订单)
$map
[
'sale_id'
]
=
$perm
->
getGroupSalesId
(
$request
,
$info
[
'role'
]);
}
}
...
...
app/Http/Controllers/PermController.php
View file @
e3dabe64
...
...
@@ -8,28 +8,6 @@
class
PermController
extends
Controller
{
protected
$roles
=
[
'管理员'
=>
1
,
'经理'
=>
2
,
'交易员'
=>
3
,
'客服'
=>
4
,
'测试'
=>
5
,
'京东自营'
=>
6
,
'自营客服'
=>
7
,
'运营助理'
=>
8
,
'财务'
=>
9
,
'自营客服主管'
=>
10
,
'自营客服主管助理'
=>
11
,
'自营内部采购'
=>
12
,
'尽调'
=>
13
,
'线销一组主管'
=>
14
,
'线销一组客服'
=>
15
,
'线销二组主管'
=>
16
,
'线销二组客服'
=>
17
,
'线销三组主管'
=>
18
,
'线销三组客服'
=>
19
,
];
// 检查用户是否具有系统访问权限
public
function
checkAccess
(
$request
)
{
...
...
@@ -89,7 +67,7 @@
foreach
(
$role
as
$v
)
{
$department
=
DB
::
table
(
't_role_perm'
)
->
where
([
'roleId'
=>
$v
,
'bid'
=>
$bid
])
->
first
();
$user_role
[]
=
in_array
(
$department
->
name
,
array_keys
(
$this
->
roles
))
?
array_get
(
$this
->
roles
,
$department
->
name
)
:
0
;
$user_role
[]
=
in_array
(
$department
->
name
,
array_keys
(
Config
(
'perm_args.roles'
)))
?
array_get
(
Config
(
'perm_args.roles'
)
,
$department
->
name
)
:
0
;
}
return
count
(
$role
)
>
1
?
implode
(
','
,
$user_role
)
:
implode
(
''
,
$user_role
);
// 多角色用逗号拼接
...
...
@@ -230,17 +208,37 @@
}
// 获取主管及其下对应组员的sale_id
public
function
getGroupSalesId
(
$request
,
$role
)
public
function
getGroupSalesId
(
$request
,
$role
_id
)
{
$role_name
=
array_keys
(
$this
->
roles
,
$role
);
dd
(
$role_name
);
$manager_to_kefu
=
Config
(
'perm_args.manager_to_kefu'
);
// 线销主管对应的客服
$sale_id
=
[];
if
(
!
in_array
(
$role_id
,
array_keys
(
$manager_to_kefu
)))
return
0
;
$sub_id
=
$manager_to_kefu
[
$role_id
];
$role_name
=
array_keys
(
Config
(
'perm_args.roles'
),
$sub_id
);
if
(
!
$role_name
)
return
0
;
$sale_id
=
[];
$sale_id
[]
=
$request
->
user
->
userId
;
// 主管ID
$sales
=
$this
->
getRoleUsers
(
$request
,
$role_name
[
0
]);
if
(
$sales
)
{
foreach
(
$sales
as
$v
)
{
$sale_id
[]
=
$v
->
userId
;
}
}
return
$sale_id
;
}
// 多角色情况下
public
function
checkUserRoles
(
$request
,
$role_id
)
{
$roles
=
explode
(
','
,
$role_id
);
}
}
\ No newline at end of file
config/perm_args.php
0 → 100644
View file @
e3dabe64
<?php
return
[
// 用户角色
'roles'
=>
[
'管理员'
=>
1
,
'经理'
=>
2
,
'交易员'
=>
3
,
'客服'
=>
4
,
'测试'
=>
5
,
'京东自营'
=>
6
,
'自营客服'
=>
7
,
'运营助理'
=>
8
,
'财务'
=>
9
,
'自营客服主管'
=>
10
,
'自营客服主管助理'
=>
11
,
'自营内部采购'
=>
12
,
'尽调'
=>
13
,
'线销一组主管'
=>
14
,
'线销一组客服'
=>
15
,
'线销二组主管'
=>
16
,
'线销二组客服'
=>
17
,
'线销三组主管'
=>
18
,
'线销三组客服'
=>
19
,
],
// 线销主管 =》 线销客服
'manager_to_kefu'
=>
[
14
=>
15
,
16
=>
17
,
18
=>
19
,
],
// 筛选自己的订单
'kefu_order'
=>
[
3
,
4
,
7
,
12
,
15
,
17
,
19
],
// 主管角色,查看自己及其组员订单
'manager_order'
=>
[
14
,
16
,
18
],
];
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