作者 lyh

gx

@@ -41,7 +41,7 @@ class LoginLogic extends BaseLogic @@ -41,7 +41,7 @@ class LoginLogic extends BaseLogic
41 */ 41 */
42 public function login() 42 public function login()
43 { 43 {
44 - $manage = $this->model->select('id', 'name', 'password', 'token', 'status', 'gid', 'dept_id','role') 44 + $manage = $this->model->select('id', 'name', 'password', 'token', 'status', 'gid', 'dept_id','role','rules')
45 ->where('mobile', $this->param['mobile'])->first(); 45 ->where('mobile', $this->param['mobile'])->first();
46 if (!$manage){ 46 if (!$manage){
47 $this->fail('登录用户名不存在'); 47 $this->fail('登录用户名不存在');
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Aside\Manage; 3 namespace App\Http\Logic\Aside\Manage;
4 4
5 5
  6 +use App\Helper\Arr;
6 use App\Helper\Common; 7 use App\Helper\Common;
7 use App\Http\Logic\Aside\BaseLogic; 8 use App\Http\Logic\Aside\BaseLogic;
8 use App\Models\Manage\Manage; 9 use App\Models\Manage\Manage;
@@ -59,6 +60,9 @@ class ManageLogic extends BaseLogic @@ -59,6 +60,9 @@ class ManageLogic extends BaseLogic
59 if($managerInfo !== false){ 60 if($managerInfo !== false){
60 $this->fail('当前手机号码已存在'); 61 $this->fail('当前手机号码已存在');
61 } 62 }
  63 + if (isset($this->param['rules']) && is_array($this->param['rules'])){
  64 + $this->param['rules'] = Arr::arrToSet($this->param['rules']);
  65 + }
62 $this->param['password'] = Hash::make(isset($this->param['password']) ?? 'globalsov6'); 66 $this->param['password'] = Hash::make(isset($this->param['password']) ?? 'globalsov6');
63 $this->model->add($this->param); 67 $this->model->add($this->param);
64 $this->success(); 68 $this->success();
@@ -93,6 +97,9 @@ class ManageLogic extends BaseLogic @@ -93,6 +97,9 @@ class ManageLogic extends BaseLogic
93 if(isset($this->param['password']) && !empty($this->param['password'])){ 97 if(isset($this->param['password']) && !empty($this->param['password'])){
94 $this->param['password'] = Hash::make($this->param['password']); 98 $this->param['password'] = Hash::make($this->param['password']);
95 } 99 }
  100 + if (isset($this->param['rules']) && is_array($this->param['rules'])){
  101 + $this->param['rules'] = Arr::arrToSet($this->param['rules']);
  102 + }
96 $this->model->edit($this->param,['id'=>$this->param['id']]); 103 $this->model->edit($this->param,['id'=>$this->param['id']]);
97 } 104 }
98 105
@@ -120,7 +127,7 @@ class ManageLogic extends BaseLogic @@ -120,7 +127,7 @@ class ManageLogic extends BaseLogic
120 */ 127 */
121 public function getManagerInfo(){ 128 public function getManagerInfo(){
122 $info = $this->model->read(['id'=>$this->param['id']], 129 $info = $this->model->read(['id'=>$this->param['id']],
123 - ['id','name','email','mobile','status','gid','sort','dept_id','is_dept_manager','created_at','role','updated_at']); 130 + ['id','name','email','mobile','status','gid','sort','dept_id','is_dept_manager','created_at','role','rules','updated_at']);
124 if($info === false){ 131 if($info === false){
125 $this->fail('error'); 132 $this->fail('error');
126 } 133 }
@@ -93,6 +93,14 @@ class MenuLogic extends BaseLogic @@ -93,6 +93,14 @@ class MenuLogic extends BaseLogic
93 */ 93 */
94 public function getMenuByGroupId($gid){ 94 public function getMenuByGroupId($gid){
95 $rights = Group::where(['id' => $gid, 'status' => Group::STATUS_NORMAL])->pluck('rights')->first(); 95 $rights = Group::where(['id' => $gid, 'status' => Group::STATUS_NORMAL])->pluck('rights')->first();
  96 + //获取个人权限
  97 + if(isset($this->manager['rules']) && !empty($this->manager['rules'])){
  98 + $rules = Arr::setToArr($this->manager['rules']);
  99 + // 合并两个数组
  100 + $mergedArray = array_merge($rules, $rights);
  101 + // 去除重复的元素
  102 + $rights = array_unique($mergedArray);
  103 + }
96 $map = [ 104 $map = [
97 'type'=>0, 105 'type'=>0,
98 'status' => Menu::STATUS_NORMAL, 106 'status' => Menu::STATUS_NORMAL,