private function getTopFatherOrgid($org_id) { if ($org_id) { include_once ROOT_PATH . 'lib/class/auth.class.php'; $auth = new auth(); $data = array(); $data = $auth->get_one_org($org_id); if ($data) { $data = $data[0]; if ($data['fid']) { //hg_pre($data);exit; return $this->getTopFatherOrgid($data['fid']); } else { return $data['id']; } } } }
public function sysOrg() { include_once ROOT_PATH . 'lib/class/auth.class.php'; $auth = new auth(); $sql = "SELECT * FROM " . DB_PREFIX . "company WHERE 1"; $q = $this->db->query($sql); while ($row = $this->db->fetch_array($q)) { if ($row['org_id']) { $ret = $auth->get_one_org($row['org_id']); $ret = $ret[0]; if ($row['org_children'] != $ret['childs']) { $sql = "UPDATE " . DB_PREFIX . "company SET org_children='" . $ret['childs'] . "' WHERE id=" . $row['id']; $this->db->query($sql); } } } return true; }
public function getFatherOrgById() { if ($this->user['org_id']) { $org_id = $this->user['org_id']; } else { $org_id = $this->input['org_id'] ? trim($this->input['org_id']) : ''; } $data = array(); include_once ROOT_PATH . 'lib/class/auth.class.php'; $auth = new auth(); $data = $auth->get_one_org($org_id); $id = $data[0]['fid']; $data = $auth->get_one_org($id); $id2 = $data[0]['fid']; if ($id2 == 0) { $fid = array($id); } else { $fid = array($id, $id2); } if ($fid) { include_once ROOT_PATH . 'lib/class/auth.class.php'; $auth = new auth(); foreach ($fid as $k => $v) { $data = $auth->getMemberByOrg($v); if ($data) { foreach ($data as $kk => $vv) { $user_info[] = $vv; } } } } $this->addItem($user_info); $this->output(); }