コード例 #1
0
ファイル: shope_car.php プロジェクト: todary/Eshopper
                // echo $json_response;
            } elseif ($_POST['_method'] == 'quantity') {
                $product = new shope($_GET['id']);
                $product->id = $_GET['id'];
                $product->quantity = $_POST['quantity'];
                $product->update_quantity();
            }
        }
    } else {
        //insert action
        $product = new shope();
        $product->user_id = $_POST['user_id'];
        $product->product_id = $_POST['product_id'];
        $product->quantity = $_POST['quantity'];
        $product->but_not = $_POST['but_not'];
        $product->id = $product->insert();
        // print_r($_POST);
        if ($product->id > 0) {
            // $status=200;
            $response['data'] = array('user_id' => $product->id);
            $rest = new car_server();
            $rest->handle_response($response['data'], 200);
            // $response['status'] = 'OK';
            // $json_response = json_encode($response);
            // echo $json_response;
        }
    }
    //get user either with id or all
} else {
    if ($_method == 'GET') {
        // get user with a specific id