public function removePost() { if (empty($_POST['post_id'])) { $return['status'] = 0; $return['data'] = ''; echo json_encode($return); exit; } !is_array($_POST['post_id']) && ($_POST['post_id'] = array($_POST['post_id'])); $data['post_id'] = array('in', $_POST['post_id']); $res = D('weiba_post')->where($data)->setField('is_index', 0); if ($res) { $postList = D('weiba_post')->where($data)->findAll(); foreach ($postList as $v) { D('weiba')->where('weiba_id=' . $v['weiba_id'])->setDec('thread_count'); } $return['status'] = 1; $return['data'] = '移除成功'; } else { $return['status'] = 0; $return['data'] = '移除失败'; } echo json_encode($return); exit; }