コード例 #1
0
ファイル: routes.php プロジェクト: CWMCDev/Movie-Rental
//	Invoices 		//
//					//
//////////////////////
$app->post('/customer/invoice/pay', function ($request, $response) {
    $args = $request->getParsedBody();
    if (empty($args['rentals'])) {
        createResponse(array('error' => 'No rentals found.'));
        return;
    }
    $rentals = $args['rentals'];
    $results = array();
    for ($i = 0; $i < count($rentals); $i++) {
        $result = array();
        $result['id'] = $rentals[$i]['id'];
        $result['payed'] = true;
        payInvoice($rentals[$i]['id']);
        array_push($results, $result);
    }
    createResponse($results);
});
//////////////////////
//					//
//		Stats 		//
//					//
//////////////////////
$app->get('/stats/payed/', function ($request, $response, $args) {
    if ($statsData = payedStats()) {
        $stats = array();
        while ($stat = mysqli_fetch_array($statsData)) {
            array_push($stats, $stat);
        }
コード例 #2
0
<?php

chdir("../../database");
require_once "storeAccount.php";
if (isset($_GET["invoiceCode"])) {
    $invoiceCode = $_GET["invoiceCode"];
    payInvoice($invoiceCode);
    echo json_encode(array("result" => "ok"));
} else {
    echo json_encode(array("result" => "missingParams"));
}