Exemple #1
0
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$orderID = $obj["orderID"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_array = array("orderID" => $orderID);
    $selectDetail = $db_utils->selectTableAnd($user_link, TableName::getOrderDetailTable, $select_array);
    if (!$selectDetail) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    $detailNum = 0;
    while ($record = mysql_fetch_array($selectDetail)) {
        $detailNum++;
    }
    if ($detailNum > 0) {
        $selectRoot = $db_utils->selectTableAnd($user_link, TableName::getOrderTable, $select_array);
        if (!$selectRoot) {
            $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
        }