实现手动设计的权限管理

This commit is contained in:
augushong
2020-05-14 21:36:07 +08:00
parent ddb72ba623
commit 217120d274
16 changed files with 71 additions and 327 deletions

View File

@@ -27,7 +27,7 @@ class Admin extends Model
return [];
}
return AdminGroup::where('id',$this->getData('group_id'))->cache(1)->find();
return AdminGroup::where('id',$this->getData('group_id'))->cache(60)->find();
}
}

View File

@@ -19,22 +19,5 @@ class AdminLog extends Model
return $this->belongsTo('Admin','admin_id');
}
public function getUrlAttr()
{
return AdminPermission::where([
'app'=>$this->getData('app'),
'controller'=>$this->getData('controller'),
'action'=>$this->getData('action'),
])->find();
}
public function setParamAttr($value)
{
return json_encode($value,JSON_UNESCAPED_UNICODE);
}
public function getParamAttr($value)
{
return \mb_substr($value,0,30);
}
}

View File

@@ -22,14 +22,5 @@ class AdminPermission extends Model
return $status[intval($value)];
}
public function getNameAttr($value)
{
if(empty($value)){
$value = $this->getData('app').'/'.$this->getData('controller').'/'.$this->getData('action');
}
return $value;
}
}