function CheckCanRead($uid, $info_id)
{
    $info = M('cat_info')->find($info_id);
    return CheckCanReadEntity($uid, $info['entity_id']);
}
 public function fav()
 {
     $this->setTitle('个人中心');
     $entitys = M('cat_entity')->where('show_nav = 1' . ' and status=1')->order('sort desc')->select();
     // dump($entitys);exit;
     $map['entity_id'] = $entitys[0]['id'];
     //获取该用户发布的全部用户组
     $t_map['uid'] = is_login();
     $fav = M('cat_fav')->where($t_map)->limit(999)->select();
     $fav_ids = getSubByKey($fav, 'info_id');
     $map['id'] = array('in', implode(',', $fav_ids));
     if (I('get.id', 0, 'intval') != 0) {
         $map['entity_id'] = I('get.id', 0, 'intval');
     }
     $map['status'] = 1;
     if ($fav_ids) {
         $my_post = M('cat_info')->where($map)->findPage(10);
         foreach ($entitys as $key => $v) {
             if (!CheckCanReadEntity(is_login(), $v['id'])) {
                 unset($entitys[$key]);
             }
         }
         foreach ($my_post['data'] as $key => $info) {
             $my_post['data'][$key]['tpl'] = M('Render')->renderInfo($info['id']);
         }
         $data['my_post'] = $my_post;
     } else {
         $data['my_post']['count'] = 0;
         $data['my_post']['totalPages'] = 0;
     }
     $data['entitys'] = $entitys;
     if (I('get.id', 0, 'intval') == 0) {
         foreach ($entitys as $v) {
             $current_entity = $v['id'];
             break;
         }
     } else {
         $current_entity = I('get.id', 0, 'intval');
     }
     $this->assign('current_entity', $current_entity);
     $this->assign($data);
     $this->display();
 }
function CheckCanRead($uid, $goods_id)
{
    $goods = M('Goods')->find($goods_id);
    return CheckCanReadEntity($uid, $goods['entity_id']);
}