|
@@ -6,6 +6,7 @@
|
|
|
// +----------------------------------------------------------------------
|
|
// +----------------------------------------------------------------------
|
|
|
namespace plugin\saiadmin\basic;
|
|
namespace plugin\saiadmin\basic;
|
|
|
|
|
|
|
|
|
|
+use plugin\saiadmin\app\cache\UserInfoCache;
|
|
|
use plugin\saiadmin\exception\ApiException;
|
|
use plugin\saiadmin\exception\ApiException;
|
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
|
|
|
|
|
@@ -203,13 +204,20 @@ class BaseLogic
|
|
|
|
|
|
|
|
// 广告数据权限-自己以及下面组员
|
|
// 广告数据权限-自己以及下面组员
|
|
|
if($authAdPermission==2){
|
|
if($authAdPermission==2){
|
|
|
- // 如果没有传入负责人ID, 则取当前用户以及下面组员
|
|
|
|
|
- $current_user_id = $this->adminInfo['id'];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 根据用户id获取用户权限
|
|
|
|
|
+ $token = getCurrentInfo();
|
|
|
|
|
+ // 用户权限缓存
|
|
|
|
|
+ $userAuthCache = new UserInfoCache($token['id']);
|
|
|
|
|
+ $user_info = $userAuthCache->getUserInfo();
|
|
|
|
|
+ $current_user_id = $user_info['id'];
|
|
|
$result = Db::connect('db_system')->table('sa_system_user')->field('dept_id')->where('id', $current_user_id)->select()->toArray();
|
|
$result = Db::connect('db_system')->table('sa_system_user')->field('dept_id')->where('id', $current_user_id)->select()->toArray();
|
|
|
$dept_ids = array_column($result, 'dept_id');
|
|
$dept_ids = array_column($result, 'dept_id');
|
|
|
$under_user_ids = Db::connect('db_system')->table('sa_system_user')->field('id')->where('dept_id', 'in', $dept_ids)->select()->toArray();
|
|
$under_user_ids = Db::connect('db_system')->table('sa_system_user')->field('id')->where('dept_id', 'in', $dept_ids)->select()->toArray();
|
|
|
$under_user_ids = array_column($under_user_ids, 'id');
|
|
$under_user_ids = array_column($under_user_ids, 'id');
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if(!empty($data['auth_id'])){
|
|
if(!empty($data['auth_id'])){
|
|
|
// 如果传入了负责人ID,则取交集
|
|
// 如果传入了负责人ID,则取交集
|
|
|
$data['auth_id'] = array_values(array_intersect( $data['auth_id'], array_values($under_user_ids)));
|
|
$data['auth_id'] = array_values(array_intersect( $data['auth_id'], array_values($under_user_ids)));
|
|
@@ -221,7 +229,12 @@ class BaseLogic
|
|
|
|
|
|
|
|
// 广告数据权限-如果auth_id为空,则取当前用户
|
|
// 广告数据权限-如果auth_id为空,则取当前用户
|
|
|
if($authAdPermission==0){
|
|
if($authAdPermission==0){
|
|
|
- $current_user_id = $this->adminInfo['id'];
|
|
|
|
|
|
|
+ // 根据用户id获取用户权限
|
|
|
|
|
+ $token = getCurrentInfo();
|
|
|
|
|
+ // 用户权限缓存
|
|
|
|
|
+ $userAuthCache = new UserInfoCache($token['id']);
|
|
|
|
|
+ $user_info = $userAuthCache->getUserInfo();
|
|
|
|
|
+ $current_user_id = $user_info['id'];
|
|
|
if(!empty($data['auth_id'])){
|
|
if(!empty($data['auth_id'])){
|
|
|
// 如果传入了负责人ID,则取交集
|
|
// 如果传入了负责人ID,则取交集
|
|
|
$data['auth_id'] = array_values(array_intersect( $data['auth_id'], array_values($under_user_ids)));
|
|
$data['auth_id'] = array_values(array_intersect( $data['auth_id'], array_values($under_user_ids)));
|