IndexAction::catelist PHP Méthode

catelist() public méthode

刷新catelist
public catelist ( )
    public function catelist()
    {
        // 安全过滤
        $map['is_del'] = 0;
        $map['status'] = 1;
        $list = M('weiba')->where($map)->select();
        $weiba = getSubByKey($list, 'weiba_id');
        unset($map);
        $map['recommend'] = 1;
        $map['weiba_id'] = array('in', $weiba);
        $p = $_REQUEST['p'];
        if (!$p) {
            $p = 1;
        }
        $map['is_del'] = 0;
        $postList = D('weiba_post')->where($map)->order('recommend_time desc')->findpage(10);
        $postList = $postList['data'];
        $weiba_ids = getSubByKey($post_list, 'weiba_id');
        $nameArr = $this->_getWeibaName($weiba_ids);
        foreach ($postList as $k => $v) {
            $postList[$k]['weiba'] = $nameArr[$v['weiba_id']];
            $postList[$k]['user'] = model('User')->getUserInfo($v['post_uid']);
        }
        //dump($postList);
        //dump(M()->getLastSql());
        $html = '';
        foreach ($postList as $vo) {
            $html .= '<dl>';
            $html .= '<dt><a href="' . U('weiba/Index/postDetail', array('post_id' => $vo['post_id'])) . '">' . getShort(t($vo['title']), 20) . '</a></dt>';
            $html .= '<dd class="f8">';
            $html .= '来自&nbsp;&nbsp;' . $vo['user']['space_link'] . '&nbsp;&nbsp;' . friendlyDate($vo['post_time'], 'ymd');
            $html .= '</dd>';
            $html .= '</dl>';
        }
        exit(json_encode($html));
    }