45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
class PushOrder extends MY_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
function index()
|
|
{
|
|
$body = file_get_contents("php://input");
|
|
$sql = "insert into xone.cpone_order(date,data) values(now(),?)";
|
|
$qry = $this->db->query($sql, [$body]);
|
|
$jbody = json_decode($body, true);
|
|
//print_r($jbody);
|
|
//exit;
|
|
$outletId = $jbody["outletId"];
|
|
$nolab = $jbody["OrderNumber"];
|
|
// echo $nolab;
|
|
|
|
|
|
$receivedDT = Date("Y/m/d h:i:s");
|
|
if (strpos($nolab, "3") !== false) {
|
|
$resp = [
|
|
"status" => 1,
|
|
"message" => "ERROR",
|
|
"outletId" => $outletId,
|
|
"orderNumber" => $nolab,
|
|
"lisRegNo" => "x-lis-" . $nolab,
|
|
"receivedDT" => $receivedDT
|
|
];
|
|
} else {
|
|
|
|
$resp = [
|
|
"status" => 0,
|
|
"message" => "SUCCESS",
|
|
"outletId" => $outletId,
|
|
"orderNumber" => $nolab,
|
|
"lisRegNo" => "x-lis-" . $nolab,
|
|
"receivedDT" => $receivedDT
|
|
];
|
|
}
|
|
echo json_encode($resp);
|
|
}
|
|
}
|