public function postDel()
{
$weiba = D('weiba_post')->where('post_id=' . intval($_POST['post_id']))->field('weiba_id,post_uid')->find();
if (CheckPermission('weiba_normal', 'weiba_del') || $weiba['post_uid'] == $this->mid || CheckWeibaPermission('', $weiba['weiba_id'])) {
//判断删帖权限
if ($weiba['post_uid'] != $this->mid) {
//判断是否本人
if (!CheckWeibaPermission('', $weiba['weiba_id'])) {
//判断管理员或圈主
echo 0;
return;
}
}
} else {
echo 0;
return;
}
if (!CheckWeibaPermission('', $weiba['weiba_id'])) {
//判断管理员或圈主
if (!CheckPermission('weiba_normal', 'weiba_del') || $weiba['post_uid'] != $this->mid) {
echo 0;
return;
}
}
$post_id = $_POST['post_id'];
$post_id = intval($post_id);
if (D('weiba_post')->where('post_id=' . $post_id)->setField('is_del', 1)) {
$post_detail = D('weiba_post')->where('post_id=' . $post_id)->find();
if (intval($_POST['log']) == 1) {
D('log')->writeLog($post_detail['weiba_id'], $this->mid, '删除了帖子“' . $post_detail['title'] . '”', 'posts');
}
D('weiba')->where('weiba_id=' . intval($_POST['weiba_id']))->setDec('thread_count');
//添加积分
model('Credit')->setUserCredit($this->mid, 'delete_topic');
// 删除相应的分享信息
model('Feed')->doEditFeed($post_detail['feed_id'], 'delFeed', '', $this->mid);
/* 删除收藏 */
D('WeibaPost')->where(array('post_id' => $post_id))->delete();
echo 1;
}
}