TaoLer/app/admin/model/AuthRule.php
2020-01-01 13:17:19 +08:00

36 lines
638 B
PHP

<?php
namespace app\admin\model;
use think\Model;
use think\facade\Db;
use think\facade\Session;
//use think\model\concern\SoftDelete;
class AuthRule extends Model
{
//软删除
//use SoftDelete;
//protected $deleteTime = 'delete_time';
//protected $defaultSoftDelete = 0;
//登陆校验
public function authRuleTree()
{
$authRules = $this->order('sort asc')->select();
return $this->sort($authRules);
}
public function sort($data,$pid=0)
{
static $arr = array();
foreach($data as $k=> $v){
if($v['pid']==$pid){
$arr[] = $v;
$this->sort($data,$v['id']);
}
}
return $arr;
}
}