Commit 8f341c5e by 朱继来

temp

parent b2060a0b
......@@ -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,10 +422,17 @@ 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']);
}
}
// 自营客服权限
......
......@@ -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;
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();
return in_array($department->name, array_keys($this->roles)) ? array_get($this->roles, $department->name) : 0;
}
$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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment