AdminAction::delPost PHP Method

delPost() public method

后台删除帖子至回收站
public delPost ( )
    public function delPost()
    {
        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_del', 1);
        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'] = L('PUBLIC_ADMIN_OPRETING_SUCCESS');
        } else {
            $return['status'] = 0;
            $return['data'] = L('PUBLIC_ADMIN_OPRETING_ERROR');
        }
        echo json_encode($return);
        exit;
    }