public function indexPost()
{
$_REQUEST['tabHash'] = 'indexPost';
$this->_initWeibaListAdminMenu();
// 设置列表主键
$this->_listpk = 'post_id';
$this->pageButton[] = array('title' => '移除帖子', 'onclick' => 'admin.removePost()');
$this->opt['recommend'] = array('0' => L('PUBLIC_SYSTEMD_NOACCEPT'), '1' => '是', '2' => '否');
$this->opt['digest'] = array('0' => L('PUBLIC_SYSTEMD_NOACCEPT'), '1' => '是', '2' => '否');
$this->opt['top'] = array('0' => L('PUBLIC_SYSTEMD_NOACCEPT'), '1' => '吧内置顶', '2' => '全局置顶');
$weibaList = D('weiba')->getHashList($k = 'weiba_id', $v = 'weiba_name');
$weibaList[0] = L('PUBLIC_SYSTEMD_NOACCEPT');
$this->opt['weiba_id'] = $weibaList;
$this->pageKeyList = array('post_id', 'title', 'post_uid', 'index_img', 'is_index_time', 'weiba_id', 'DOACTION');
// 查询数据
$map['weiba_id'] = array('in', getSubByKey(M('weiba')->where('is_del=0')->findAll(), 'weiba_id'));
$map['is_del'] = 0;
$map['is_index'] = 1;
$list = M('weiba_post')->where($map)->order('last_reply_time desc,post_time desc')->findPage(5);
$scount = M('weiba_post')->where($map)->count();
if ($scount < 5) {
$this->pageButton[] = array('title' => '添加帖子', 'onclick' => "location.href='" . U('weiba/Admin/newImg') . "'");
}
// 数据组装
foreach ($list['data'] as $k => $v) {
$list['data'][$k]['title'] = '<a target="_blank" href="' . U('weiba/Index/postDetail', array('post_id' => $v['post_id'])) . '">' . $v['title'] . '</a>';
$author = model('User')->getUserInfoByUids($v['post_uid']);
$list['data'][$k]['post_uid'] = $author[$v['post_uid']]['space_link'];
$list['data'][$k]['index_img'] = '<img src="' . getImageUrlByAttachId($v['index_img']) . '" style="height:50px; width:50px;" />';
$list['data'][$k]['is_index_time'] = friendlyDate($v['is_index_time']);
$list['data'][$k]['weiba_id'] = M('weiba')->where('weiba_id=' . $v['weiba_id'])->getField('weiba_name');
if ($v['is_del'] == 0) {
$list['data'][$k]['DOACTION'] = '<a href=' . U('weiba/Admin/newImg', 'post_id=' . $v['post_id']) . '>修改</a> - ';
$list['data'][$k]['DOACTION'] .= '<a href="javascript:void(0)" onclick="admin.removePost(' . $v['post_id'] . ')">移除帖子</a>';
} else {
$list['data'][$k]['DOACTION'] = '<a href="javascript:void(0)" onclick="admin.recoverPost(' . $v['post_id'] . ')">还原</a> - <a href="javascript:void(0)" onclick="admin.deletePost(' . $v['post_id'] . ')">彻底删除</a>';
}
$listData = $list;
}
$this->displayList($listData);
}