AdminAction::doWeibaAudit PHP Method

doWeibaAudit() public method

public doWeibaAudit ( )
    public function doWeibaAudit()
    {
        if (empty($_POST['weiba_id'])) {
            $return['status'] = 0;
            $return['data'] = '';
            echo json_encode($return);
            exit;
        }
        !is_array($_POST['weiba_id']) && ($_POST['weiba_id'] = array($_POST['weiba_id']));
        $map['weiba_id'] = array('in', $_POST['weiba_id']);
        $data['status'] = intval($_POST['value']);
        /* 如果小于1,是-1 则直接删除数据 */
        if (intval($_POST['value']) < 1) {
            $res = D('weiba')->where($map)->delete();
            /* # 否则通过 */
        } else {
            $res = D('weiba')->where($map)->save($data);
        }
        if ($res) {
            $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;
    }