当前位置: 首页>>代码示例>>PHP>>正文


PHP Orders::getOrders方法代码示例

本文整理汇总了PHP中Orders::getOrders方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::getOrders方法的具体用法?PHP Orders::getOrders怎么用?PHP Orders::getOrders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orders的用法示例。


在下文中一共展示了Orders::getOrders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Orders

header("Content-Type: text/event-stream");
header("Cache-Control: no-cache");
// header('retry: 1000');
require_once "DbConnection.php";
require_once "../models/Orders.php";
session_start();
if (!isset($_SESSION['rows'])) {
    $_SESSION['rows'] = 0;
}
var_dump($_SESSION);
$tblRows = $_SESSION['rows'];
$dbConnection = DbConnection::getConnection();
$orderInterface = new Orders($dbConnection);
$dbRowSet = $dbConnection->query("SELECT count(*) as count from orders");
$resultArr = $dbRowSet->fetch_assoc();
// $resultArr = json_encode($resultArr);
// echo "data: {$resultArr}\n\n";
if ($tblRows != 0 && $tblRows < $resultArr['count']) {
    $_SESSION['rows'] = $resultArr['count'];
    $ordersSet = $orderInterface->getOrders("and status != 'canceled' order by date,time desc limit 1");
    $order = $ordersSet->fetch_assoc();
    $response = array();
    $response['response'] = $order;
    $response = json_encode($response);
    echo "data: {$response}\n\n";
    ob_end_flush();
    flush();
} else {
    $_SESSION['rows'] = $resultArr['count'];
}
开发者ID:hazemtaha,项目名称:Php_Cafteria_Project,代码行数:30,代码来源:ordersFeeds.php

示例2: Orders

<?php

require_once "DbConnection.php";
require_once "../models/Orders.php";
session_start();
$orderInterface = new Orders(DbConnection::getConnection());
if (isset($_POST['dest'])) {
    switch ($_POST['dest']) {
        case 'cancelOrder':
            $orderInterface->setOrderStatus('canceled', $_POST['msg']);
            break;
        case 'getOrders':
            $ordersRowSet = $orderInterface->getOrders("and status = 'proccessing' order by date,time");
            $orders = array();
            while ($order = $ordersRowSet->fetch_assoc()) {
                array_push($orders, $order);
            }
            echo json_encode($orders);
            break;
        case 'getOrderDetails':
            $ordersRowSet = $orderInterface->getOrderDetails($_POST['oId']);
            $orders = array();
            while ($order = $ordersRowSet->fetch_assoc()) {
                array_push($orders, $order);
            }
            echo json_encode($orders);
            break;
        case 'deliver':
            $orderInterface->setOrderStatus('Out for delivery', $_POST['oId']);
            $dbConnection = DbConnection::getConnection();
            $dbConnection->query("CREATE EVENT updateStatus" . $_POST['oId'] . "\n                ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE DO\n                UPDATE orders SET status = 'Done' WHERE o_id = " . $_POST['oId'] . ";");
开发者ID:hazemtaha,项目名称:Php_Cafteria_Project,代码行数:31,代码来源:ordersController.php


注:本文中的Orders::getOrders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。