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
4c0e2838
authored
Oct 23, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整订单权限
parent
4f73eb15
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
4 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
config/perm_args.php
resources/views/detail/changeOrder.blade.php
app/Http/Controllers/OrderController.php
View file @
4c0e2838
...
...
@@ -427,6 +427,11 @@ Class OrderController extends Controller
// 订单查看权限
if
(
strpos
(
$info
[
'role'
],
','
)
!==
false
)
{
// 多角色情况下
$res
=
$perm
->
checkUserRoles
(
$request
,
$info
[
'role'
]);
if
(
$res
)
{
$info
[
'role'
]
=
$res
[
'role_id'
];
$res
[
'sale_id'
]
&&
$map
[
'sale_id'
]
=
$res
[
'sale_id'
];
}
}
else
{
if
(
in_array
(
$info
[
'role'
],
Config
(
'perm_args.kefu_order'
)))
{
// 交易员、联营客服(线销一组、二组、三组客服)、自营客服、自营内部采购
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
// 筛选自己的订单
...
...
app/Http/Controllers/PermController.php
View file @
4c0e2838
...
...
@@ -233,12 +233,43 @@
return
$sale_id
;
}
// 多角色情况下
/**
* 多角色情况下
* 1.若存在管理员、经理、测试角色,则返回角色
* 2.若存在线销主管,则查询其下客服
* 3.其他情况暂不考虑
* @param [type] $request [description]
* @param [type] $role_id [description]
* @return [type] [description]
*/
public
function
checkUserRoles
(
$request
,
$role_id
)
{
$data
=
[];
$roles
=
explode
(
','
,
$role_id
);
$master
=
array_intersect
(
$roles
,
Config
(
'perm_args.check_all_order'
));
// 交集,是否能查看所有订单
if
(
$master
)
{
$data
[
'role_id'
]
=
min
(
$master
);
// 设置最小值的角色 (因为系统页面都是单角色判断)
$data
[
'sale_id'
]
=
0
;
return
$data
;
}
$intersect
=
array_intersect
(
$roles
,
Config
(
'perm_args.manager_order'
));
// 交集,获取线销主管
if
(
$intersect
)
{
$data
[
'role_id'
]
=
min
(
$intersect
);
// 设置最小值的角色
foreach
(
$intersect
as
$v
)
{
$sale_ids
[]
=
$this
->
getGroupSalesId
(
$request
,
$v
);
}
$arr
=
array_reduce
(
$sale_ids
,
'array_merge'
,
array
());
// 转一维数组
$data
[
'sale_id'
]
=
array_merge
(
array_unique
(
$arr
));
// 去重后,再重新索引
}
return
$data
;
}
}
\ No newline at end of file
config/perm_args.php
View file @
4c0e2838
...
...
@@ -36,6 +36,10 @@ return [
// 主管角色,查看自己及其组员订单
'manager_order'
=>
[
14
,
16
,
18
],
// 查看所有订单角色
'check_all_order'
=>
[
1
,
2
,
5
],
// 审单时权限 (用于调价权限 changeOrder.blade.php)
'is_manager_perm'
=>
[
1
,
2
,
10
,
11
,
14
,
16
,
18
],
];
resources/views/detail/changeOrder.blade.php
View file @
4c0e2838
...
...
@@ -498,8 +498,8 @@
@include('detail.addGoods')
<script>
var
is_manager
=
"{{
$role == 1 || $role == 2 || $role == 10 || $role == 11
? true : false }}"
;
var
is_manager
=
"{{
in_array($role, Config('perm_args.is_manager_perm'))
? true : false }}"
;
var
isNewClient
=
"{{isset($isNewClient) ? $isNewClient : 0}}"
;
// var order_amount = "{{$order_info['order_amount']}}";
var
currency
=
"{{$order_info['currency']}}"
;
// 币种
...
...
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