ordersprinter/gastsystem/php/queue.php

36 lines
906 B
PHP
Raw Normal View History

2020-11-19 23:10:06 +01:00
<?php
require_once 'dbutils.php';
require_once 'config.php';
require_once 'system.php';
class Queue {
public static function putintoqueue($pdo,$prodid,$tableid,$tablecode,$dailycode) {
$timezone = System::getTimeZone($pdo);
date_default_timezone_set($timezone);
$ordertime = date('Y-m-d H:i:s');
$pdo->beginTransaction();
$sql = "INSERT INTO %queue% (date,prodid,tableid,tablecode,dailycode) VALUES(?,?,?,?,?)";
DbUtils::execSql($pdo, $sql, array($ordertime,$prodid,$tableid,$tablecode,$dailycode));
$pdo->commit();
return array("status" => "OK");
}
}
if (isset($_GET["command"])) {
$command = $_GET["command"];
$pdo = DbUtils::openDbAndReturnPdoStatic();
switch ($command) {
case "putintoqueue":
$ret = Queue::putintoqueue($pdo,$_POST["prodid"],$_POST["tableid"],$_POST["tablecode"],$_POST["dailycode"]);
echo json_encode($ret);
break;
default:
break;
}
}