IndexAction::myWeiba PHP Méthode

myWeiba() public méthode

我的微吧
public myWeiba ( )
    public function myWeiba()
    {
        $weiba_arr = getSubByKey(D('weiba')->where('is_del=0 and status=1')->field('weiba_id')->findAll(), 'weiba_id');
        //未删除且通过审核的微吧
        $map['weiba_id'] = array('in', $weiba_arr);
        $map['is_del'] = 0;
        $type = in_array(t($_GET['type']), array('myPost', 'myReply', 'myWeiba', 'myFavorite', 'myFollowing')) ? t($_GET['type']) : 'myFollowing';
        switch ($type) {
            case 'myPost':
                $map['post_uid'] = $this->mid;
                $post_list = D('weiba_post')->where($map)->order('post_time desc')->findpage(20);
                break;
            case 'myReply':
                $myreply = D('weiba_reply')->where('uid=' . $this->mid)->order('ctime desc')->field('post_id')->findAll();
                $map['post_id'] = array('in', array_unique(getSubByKey($myreply, 'post_id')));
                $post_list = D('weiba_post')->where($map)->order('last_reply_time desc')->findpage(20);
                break;
            case 'myFavorite':
                $myFavorite = D('weiba_favorite')->where('uid=' . $this->mid)->order('favorite_time desc')->findAll();
                $map['post_id'] = array('in', getSubByKey($myFavorite, 'post_id'));
                $post_list = D('weiba_post')->where($map)->order('post_time desc')->findpage(20);
                break;
            case 'myWeiba':
                $sfollow = D('weiba_follow')->where('follower_uid=' . $this->mid)->findAll();
                $sfollow = getSubByKey($sfollow, 'weiba_id');
                $map['weiba_id'] = array('in', $sfollow);
                $map['status'] = 1;
                //dump($map);
                $post_list = D('weiba')->where($map)->order('new_day desc, new_count desc ,recommend desc,follower_count desc,thread_count desc')->findpage(20);
                //dump($post_list);exit;
                break;
            default:
                $myFollow_arr = getSubByKey(D('weiba_follow')->where('follower_uid=' . $this->mid)->findAll(), 'weiba_id');
                foreach ($myFollow_arr as $v) {
                    if (in_array($v, $weiba_arr)) {
                        $weibas[] = $v;
                    }
                }
                $map['weiba_id'] = array('in', $weibas);
                $post_list = D('weiba_post')->where($map)->order('last_reply_time desc')->findpage(20);
                break;
        }
        // if($postList['nowPage']==1){  //列表第一页加上全局置顶的帖子
        // 	$topPostList = D('weiba_post')->where('top=2 and is_del=0')->order('post_time desc')->findAll();
        // 	!$topPostList && $topPostList = array();
        // 	!$postList['data'] && $postList['data'] = array();
        // 	$postList['data'] = array_merge($topPostList,$postList['data']);
        // }
        $weiba_ids = getSubByKey($post_list['data'], 'weiba_id');
        $nameArr = $this->_getWeibaName($weiba_ids);
        foreach ($post_list['data'] as $k => $v) {
            $post_list['data'][$k]['weiba'] = $nameArr[$v['weiba_id']];
            $post_list['data'][$k]['user'] = model('User')->getUserInfo($v['post_uid']);
            $post_list['data'][$k]['replyuser'] = model('User')->getUserInfo($v['last_reply_uid']);
            // $images = matchImages($v['content']);
            // $images[0] && $post_list['data'][$k]['image'] = array_slice( $images , 0 , 5 );
            $image = getEditorImages($v['content']);
            !empty($image) && ($post_list['data'][$k]['image'] = array($image));
        }
        $this->assign('post_list', $post_list);
        $this->assign('type', $type);
        $this->assign('nav', 'myweiba');
        $this->setTitle('我的微吧');
        $this->setKeywords('我的微吧');
        $this->display();
    }