Exemplo n.º 1
0
//$result = MealAction::addTodayMeal(8);
//var_dump($result);
//$result = MealAction::getTodayMeals(TimeUtils::getCurrentDate());
//var_dump($result);
//require_once "entity/MealFavor.php";
//$result = MealAction::favor(1, 8);
//var_dump($result);
//$result = MealAction::getTopTenMeals();
//var_dump($result);
//$result = MealAction::cancelFavor(1, 8);
//var_dump($result);
//$result = MealAction::getTopTenMeals();
//var_dump($result);
require_once "config.php";
require_once "entity/User.php";
require_once "entity/Order.php";
require_once "action/OrderAction.php";
require_once "provider/Database.php";
require_once "util/TimeUtils.php";
$result = OrderAction::orderMeal(1);
var_dump($result);
$result = OrderAction::orderMeal(1);
var_dump($result);
$result = OrderAction::getOrders();
var_dump($result);
$result = OrderAction::cancelOrder(1);
var_dump($result);
$result = OrderAction::cancelOrder(1);
var_dump($result);
$result = OrderAction::getOrders();
var_dump($result);
Exemplo n.º 2
0
 */
header("Content-Type: text/html; charset=utf-8");
require_once '../entity/Meal.php';
require_once '../action/OrderAction.php';
require_once "../config.php";
require_once "../provider/Database.php";
require_once "../provider/testFormat.php";
require_once "../entity/response/Response.php";
require_once "../entity/response/mealsRes.php";
require_once "../util/TimeUtils.php";
require_once "../entity/MealFavor.php";
require_once "../entity/Order.php";
require_once "../entity/response/OrdersResponse.php";
require_once "../entity/User.php";
session_start();
$getOrderFlag = OrderAction::getOrders();
if ($getOrderFlag === OrderAction::$GET_ORDERS_FAIL) {
    $result = new Response(false, "数据库连接失败");
    echo json_encode($result);
} elseif (isset($getOrderFlag)) {
    $amount = sizeof($getOrderFlag);
    $orders = array();
    $prevLocation = "----";
    $count = 0;
    $users = array();
    foreach ($getOrderFlag as $order) {
        if ($order->user->location != $prevLocation) {
            if ($prevLocation != "----") {
                $orders[] = ["location" => $prevLocation, "count" => $count, "users" => $users];
            }
            $count = 0;