AdminAction::doStorey PHP Method

doStorey() public method

调整评论楼层
public doStorey ( )
    public function doStorey()
    {
        if (empty($_POST['post_id'])) {
            echo 0;
            exit;
        }
        //echo 1;exit;
        !is_array($_POST['post_id']) && ($_POST['post_id'] = array($_POST['post_id']));
        $data['post_id'] = array('in', $_POST['post_id']);
        $postList = D('weiba_post')->where($data)->findAll();
        foreach ($postList as $v) {
            $replyList = D('weiba_reply')->where('post_id=' . $v['post_id'] . ' AND is_del=0')->order('reply_id ASC')->findAll();
            foreach ($replyList as $key => $val) {
                D('weiba_reply')->where('reply_id=' . $val['reply_id'])->setField('storey', $key + 1);
            }
            D('weiba_post')->where('post_id=' . $v['post_id'])->setField('reply_all_count', count($replyList));
            //总回复统计数加1
        }
        echo 1;
        exit;
    }