| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');class Privilnode_model extends CI_Model{	private $table = 'privilnode';	public function __construct(){		parent::__construct();	}	public function get_all_privilnode($role){		$this->db->where('status', 1);		$this->db->where('level >=', $role);		$query = $this->db->get($this->table);		return $query->result_array();	}	public function get_default_privilege($role){		$this->db->select('id');		$this->db->where('status', 1);		$this->db->where('level >=', $role);		if ($role == COMPANY_CUSTOMER) {			$this->db->where('parentid', 1);		}		$query = $this->db->get($this->table);		$result = $query->result_array();		$privilegeid = array();		foreach ($result as $key => $value) {			$privilegeid[] = $value['id'];		}		return join(',', $privilegeid);	}	// 获取权限action	public function get_privilege_action($ids){		$sql = "select action from {$this->table} where id in ({$ids})";		$res = $this->db->query($sql)->result_array();		$data = array();		foreach ($res as $v) {			if (!empty($v['action'])) {				$data[] = $v['action'];			}		}		return empty($data) ? $data : explode(',', implode(',', $data));	}	}
 |