public function ajaxList()
{
$type = t($_GET['type']);
$feedId = intval($_GET['feedId']);
if (empty($type) || empty($feedId)) {
return array();
}
$data = array();
// 获取分享信息
$sourceInfo = model('Feed')->getFeedInfo($feedId);
if ($type === 'report') {
$var = array();
$var['app_name'] = 'public';
$var['table'] = 'feed';
$var['limit'] = 5;
$var['order'] = 'a.publish_time DESC';
$map = array();
$map['a.app_row_id'] = $feedId;
$map['a.app'] = $var['app_name'];
$map['a.app_row_table'] = $var['table'];
$var['list'] = D()->table('`' . C('DB_PREFIX') . 'feed` AS a LEFT JOIN `' . C('DB_PREFIX') . 'feed_data` AS b ON a.`feed_id` = b.`feed_id`')->field('a.`uid`, b.`feed_content`, a.`publish_time`, a.`feed_id` AS `curid`, a.`app_row_id` AS `sid`, a.`is_repost`')->where($map)->order($var['order'])->findPage($var['limit']);
foreach ($var['list']['data'] as &$value) {
$value['user_info'] = model('User')->getUserInfo($value['uid']);
}
$html = fetch('ajaxListReport', $var);
$over = $var['list']['totalPages'] == $var['list']['nowPage'] || empty($var['list']['data']) ? 1 : 0;
$data = array('status' => 1, 'data' => $html, 'over' => $over);
} elseif ($type === 'comment') {
$weiboSet = model('Xdata')->get('admin_Config:feed');
$var = array();
// 默认配置数据
$var['cancomment'] = 1;
// 是否可以评论
$var['canrepost'] = 1;
// 是否允许转发
$var['cancomment_old'] = 1;
// 是否可以评论给原作者
$var['app_name'] = 'public';
$var['table'] = 'feed';
$var['limit'] = 5;
$var['order'] = 'DESC';
$var['app_uid'] = $sourceInfo['uid'];
$var['feedtype'] = $sourceInfo['type'];
$var['user_info'] = model('User')->getUserInfo($var['app_uid']);
// 获取分享评论信息
if ($var['table'] == 'feed' && $this->mid != $var['app_uid']) {
// 判断隐私设置
if ($this->mid != $var['app_uid']) {
$userPrivacy = model('UserPrivacy')->getPrivacy($this->mid, $var['app_uid']);
if ($userPrivacy['comment_weibo'] == 1) {
$data = array('status' => 0, 'data' => L('PUBLIC_CONCENT_TIPES'));
exit(json_encode($data));
}
}
}
// 获取数据
$map = array();
$map['app'] = $var['app_name'];
$map['table'] = $var['table'];
$map['row_id'] = $feedId;
$var['list'] = model('Comment')->getCommentList($map, 'comment_id ' . $var['order'], $var['limit']);
// 转发权限判断
if (!CheckPermission('core_normal', 'feed_share') || !in_array('repost', $weiboSet['weibo_premission'])) {
$var['canrepost'] = 0;
}
// 组装数据
$html = fetch('ajaxListComment', $var);
$over = $var['list']['totalPages'] == $var['list']['nowPage'] || empty($var['list']['data']) ? 1 : 0;
$data = array('status' => 1, 'data' => $html, 'over' => $over);
}
exit(json_encode($data));
}