Exemplo n.º 1
0
$app->post('/commentary/list', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($_POST["json"]);
    $commentaryDAO = new Commentary();
    $result = $commentaryDAO->list_($commentary);
    if (sizeof($result) > 0) {
        echo json_encode($result);
    } else {
        echo json_encode(array("id" => "false"));
    }
});
$app->post('/commentary/getallbyplace', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($_POST["json"]);
    $commentaryDAO = new Commentary();
    $result = $commentaryDAO->listall($commentary);
    if (sizeof($result) > 0) {
        $result["success"] = true;
    } else {
        $result["success"] = false;
    }
    echo json_encode($result);
});
$app->put('/commentary', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($request->getBody());
    $commentaryDAO = new Commentary();
    $commentaryDAO->update($commentary);
    echo '{"result":"ok"}';
});
$app->delete('/commentary', function () {