where($map)->select(); } public function getUserIdsByRoleName($role_name){ $map['name'] = array('like', '%' . $role_name . '%'); return $this->join('__ROLE_USER__ ON __ROLE__.id=__ROLE_USER__.role_id') ->where($map)->getField('user_id', true); } public function getRoleByUserId($user_id){ $role_user_ent = M('RoleUser')->where(array('user_id' => $user_id))->find(); $role_ent = $this->where(array('status' => DBCont::NORMAL_STATUS, 'id' => $role_user_ent['role_id']))->find(); if(!$role_ent){ E('无法获取角色数据'); } return $role_ent; } }