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
8f341c5e
authored
Oct 22, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp
parent
b2060a0b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
25 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
app/Http/Controllers/OrderController.php
View file @
8f341c5e
...
...
@@ -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
);
...
...
@@ -422,11 +422,18 @@ Class OrderController extends Controller
$map
[
'is_new_order'
]
=
$request
->
input
(
'is_new_order'
,
''
);
$map
[
'business_type'
]
=
$request
->
input
(
'business_type'
,
''
);
// 订单查看权限---交易员、客服、自营客服、自营内部采购
if
(
in_array
(
$info
[
'role'
],
[
3
,
4
,
7
,
12
]))
{
// 筛选自己的订单
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
}
$perm
=
new
PermController
;
// 订单查看权限
if
(
strpos
(
$info
[
'role'
],
','
)
!==
false
)
{
// 多角色情况下
$res
=
$perm
->
checkUserRole
(
$request
,
$info
[
'role'
]);
}
else
{
if
(
in_array
(
$info
[
'role'
],
[
3
,
4
,
7
,
12
,
15
,
17
,
19
]))
{
// 交易员、联营客服(线销一组、二组、三组客服)、自营客服、自营内部采购
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
// 筛选自己的订单
}
else
if
(
in_array
(
$info
[
'role'
],
[
14
,
16
,
18
]))
{
// 线销一组、二组、三组主管(查看自己及其下组员的订单)
$map
[
'sale_id'
]
=
$perm
->
getGroupSalesId
(
$request
,
$info
[
'role'
]);
}
}
// 自营客服权限
if
(
$tid
==
2
&&
$info
[
'role'
]
==
6
)
{
...
...
app/Http/Controllers/PermController.php
View file @
8f341c5e
...
...
@@ -22,6 +22,12 @@
'自营客服主管助理'
=>
11
,
'自营内部采购'
=>
12
,
'尽调'
=>
13
,
'线销一组主管'
=>
14
,
'线销一组客服'
=>
15
,
'线销二组主管'
=>
16
,
'线销二组客服'
=>
17
,
'线销三组主管'
=>
18
,
'线销三组客服'
=>
19
,
];
// 检查用户是否具有系统访问权限
...
...
@@ -56,9 +62,7 @@
$uid
=
$request
->
user
->
userId
;
$email
=
$request
->
user
->
email
;
if
(
$email
==
'admin@ichunt.com'
)
{
return
1
;
}
if
(
$email
==
'admin@ichunt.com'
)
return
1
;
// 根据域名查询系统业务ID
$business
=
$this
->
getBusinessInfo
();
...
...
@@ -69,26 +73,26 @@
// 权限系统配置的管理帐号
$adminAccount
=
json_decode
(
$business
->
admin
,
true
);
if
(
in_array
(
$email
,
$adminAccount
))
{
return
1
;
}
if
(
in_array
(
$email
,
$adminAccount
))
return
1
;
// 根据用户ID和业务ID查看角色
$userPerm
=
DB
::
table
(
't_user_perm'
)
->
where
([
'userId'
=>
$uid
,
'bid'
=>
$bid
])
->
first
();
if
(
empty
(
$userPerm
))
{
return
0
;
}
else
{
if
(
$userPerm
->
roles
==
'null'
)
return
0
;
$role
=
json_decode
(
$userPerm
->
roles
,
true
);
foreach
(
$role
as
$v
)
{
$department
=
DB
::
table
(
't_role_perm'
)
->
where
([
'roleId'
=>
$v
,
'bid'
=>
$bid
])
->
first
();
return
in_array
(
$department
->
name
,
array_keys
(
$this
->
roles
))
?
array_get
(
$this
->
roles
,
$department
->
name
)
:
0
;
}
}
if
(
empty
(
$userPerm
))
return
0
;
if
(
$userPerm
->
roles
==
'null'
)
return
0
;
// 没有选择角色
$role
=
json_decode
(
$userPerm
->
roles
,
true
);
$user_role
=
[];
// 当前用户拥有的角色值
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
;
}
return
count
(
$role
)
>
1
?
implode
(
','
,
$user_role
)
:
implode
(
''
,
$user_role
);
// 多角色用逗号拼接
}
return
0
;
...
...
@@ -224,4 +228,19 @@
return
array_values
(
$menus
);
}
// 获取主管及其下对应组员的sale_id
public
function
getGroupSalesId
(
$request
,
$role
)
{
$role_name
=
array_keys
(
$this
->
roles
,
$role
);
dd
(
$role_name
);
$sale_id
=
[];
$sale_id
[]
=
$request
->
user
->
userId
;
// 主管ID
}
}
\ 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