當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Booking::changeBookingStatus方法代碼示例

本文整理匯總了PHP中Booking::changeBookingStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP Booking::changeBookingStatus方法的具體用法?PHP Booking::changeBookingStatus怎麽用?PHP Booking::changeBookingStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Booking的用法示例。


在下文中一共展示了Booking::changeBookingStatus方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preProcess

 public function preProcess()
 {
     if (!Tools::hasFunction('booking_list')) {
         Tools::redirect('index.php');
     }
     if (Tools::getValue("settle") == 1) {
         $this->brandNavi[] = array("name" => "Settlement", "url" => 'booking_list.php?settle=1');
     } else {
         $this->brandNavi[] = array("name" => "Booking List", "url" => $this->php_self);
     }
     if (Tools::isSubmit("change_pay")) {
         $id = (int) Tools::getValue("id");
         $status = (int) Tools::getValue("status");
         Booking::changePayStatus($id, $status);
         if ($status == 2) {
             Booking::changeBookingStatus($id, 10);
             // Successed
             Booking::payment($id, $_POST['money']);
             //給otherPrice值
         }
         exit;
     } else {
         if (Tools::isSubmit("change_status")) {
             $id = (int) Tools::getValue("id");
             $status = (int) Tools::getValue("status");
             $roleid = self::$cookie->RoleID;
             if ($status == 7) {
                 $bookingInfo = Booking::getBookingInfo($id);
                 $checkin = $bookingInfo['checkin'];
                 $nights = $bookingInfo['nights'];
                 $roomplan_list = array();
                 foreach ($bookingInfo['booked_roomplan_list'] as $booked_roomplan_list) {
                     $roomplan_list[] = $booked_roomplan_list['RoomPlanId'];
                 }
                 Stock::updateAmountStock($checkin, $nights, $roomplan_list);
             }
             Booking::changeBookingStatus($id, $status);
             exit;
         }
     }
 }
開發者ID:khuyennd,項目名稱:dev-tasagent,代碼行數:41,代碼來源:BookingListController.php

示例2: run

 public function run()
 {
     $logStr = "";
     $logFd = fopen(PAYPAL_IPN_LOG, "a");
     //$booking_info = Booking::getBookingInfoByBN('TASF0000427');
     // p($booking_info);
     fwrite($logFd, "******************************START*****************************************************************\n");
     //echo PAYPAL_IPN_LOG;
     if (array_key_exists("txn_id", $_POST)) {
         $logStr = "Received IPN,  TX ID : " . htmlspecialchars($_POST["txn_id"]);
         fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
     } else {
         $logStr = "IPN Listner recieved an HTTP request with out a Transaction ID.";
         fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
         fclose($logFd);
         exit;
     }
     //從 PayPal 出讀取 POST 信息同時添加變量?cmd?
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= "&{$key}={$value}";
     }
     //建議在此將接受到的信息記錄到日誌文件中以確認是否收到 IPN 信息
     $tmpAr = array_merge($_POST, array("cmd" => "_notify-validate"));
     $postFieldsAr = array();
     foreach ($tmpAr as $name => $value) {
         $postFieldsAr[] = "{$name}={$value}";
     }
     $logStr = "Sending IPN values:\n" . implode("\n", $postFieldsAr);
     fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
     //將信息 POST 回給 PayPal 進行驗證
     $ppResponseAr = Utils::PPHttpPost("https://www." . DEFAULT_ENV . ".paypal.com/cgi-bin/webscr", implode("&", $postFieldsAr), false);
     if (!$ppResponseAr["status"]) {
         fwrite($logFd, "--------------------\n");
         $logStr = "IPN Listner recieved an Error:\n";
         if (0 !== $ppResponseAr["error_no"]) {
             $logStr .= "Error " . $ppResponseAr["error_no"] . ": ";
         }
         $logStr .= $ppResponseAr["error_msg"];
         fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
         fclose($logFd);
         exit;
     }
     //將 POST 變量記錄在本地變量中
     //該付款明細所有變量可參考:
     //https://www.paypal.com/IntegrationCenter/ic_ipn-pdt-variable-reference.html
     $item_name = $_POST['item_name'];
     $item_number = $_POST['item_number'];
     $payment_status = $_POST['payment_status'];
     $payment_amount = $_POST['mc_gross'];
     $payment_currency = $_POST['mc_currency'];
     $txn_id = $_POST['txn_id'];
     $receiver_email = $_POST['receiver_email'];
     $payer_email = $_POST['payer_email'];
     //…
     //判斷回複 POST 是否創建成功
     fwrite($logFd, "--------------------\n");
     $logStr = "IPN Post Response:\n" . $ppResponseAr["httpResponse"];
     fwrite($logFd, strftime("%d %b %Y %H:%M:%S ") . "[IPNListner.php] {$logStr}\n");
     $res = $ppResponseAr["httpResponse"];
     //已經通過認證
     if (strcmp($res, "VERIFIED") == 0) {
         fwrite($logFd, "----- VERIFIED -----------\n");
         //檢查付款狀態
         fwrite($logFd, "----- Payment Status:{$payment_status} -----------\n");
         if ($payment_status == "Completed") {
             //檢查 txn_id  是否已經處理過
             fwrite($logFd, "-----Check Transaction ID :{$txn_id}-----------\n");
             //檢查 receiver_email 是否是您的 PayPal 賬戶中的 EMAIL 地址
             fwrite($logFd, "-----Check Receiver_email :{$receiver_email}-----------\n");
             if ($receiver_email != DEFAULT_EMAIL_ADDRESS) {
                 fwrite($logFd, "----- Receiver_email Error :{$receiver_email}-----------\n");
             } else {
                 //檢查付款金額和貨幣單位是否正確
                 //todo:$ammount
                 $booking_info = Booking::getBookingInfoByBN($item_name);
                 // fwrite($logFd, "-----Booking Info :-----------\n");
                 //fwrite($logFd, var_dump($booking_info));
                 $ammount = $booking_info['money'];
                 fwrite($logFd, "-----Check Payment Amount :{$payment_amount}-----------\n");
                 fwrite($logFd, "-----Check Payment Currency :{$payment_currency}-----------\n");
                 if ($payment_currency != DEFAULT_PAYMENT_CURRENCY) {
                     fwrite($logFd, "-----Payment Currency Error :{$payment_currency}-----------\n");
                 } elseif ($payment_amount != $ammount) {
                     fwrite($logFd, "-----Payment Error :{$payment_amount}---{$ammount}--------\n");
                 } else {
                     //處理這次付款,包括寫數據庫
                     fwrite($logFd, "----- changeBookingStatus  -----------\n");
                     Booking::changeBookingStatus($booking_info['order_id'], 4);
                     fwrite($logFd, "----- changePayStatus  -----------\n");
                     Booking::changePayStatus($booking_info['order_id'], 2);
                     fwrite($logFd, "----- payment  -----------\n");
                     Booking::payment($booking_info['order_id'], $payment_amount);
                     //下訂單成功,此時需要發送郵件
                     fwrite($logFd, "----- ordermail  -----------\n");
                     Tools::ordermail($booking_info['order_id']);
                     fwrite($logFd, "----- finish  -----------\n");
                 }
             }
//.........這裏部分代碼省略.........
開發者ID:khuyennd,項目名稱:dev-tasagent,代碼行數:101,代碼來源:IpnListenController.php

示例3: process


//.........這裏部分代碼省略.........
             self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
             exit;
         }
         $checkin = $_POST['checkin'];
         //獲取checkin的值
         $checkout = $_POST['checkout'];
         //獲取checkout的值
         //獲取roomPlanId
         $ids = $_POST['ids'];
         $rpid_list = array();
         foreach ($ids as $id) {
             $rpid_list[] = $_POST['roomplan_ids_' . $id];
         }
         //計算房間數量是否滿足條件,如果有一條不滿足則發出錯誤報告
         $roomplan_list = RoomPlan::getRoomPlanListForBooking($rpid_list, $checkin, $checkout);
         $plan_list = array();
         foreach ($roomplan_list as $record) {
             $plan_list[$record['RoomPlanId']] = $record;
         }
         //查看是否有房間不滿足條件
         $isOk = true;
         foreach ($rpid_list as $rpid) {
             if (empty($plan_list[$rpid])) {
                 $isOk = false;
                 break;
             }
         }
         if (!$isOk) {
             $error['message'] = "There is not any room as requested";
             self::$smarty->assign("error", $error);
             self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
             exit;
         }
         $booking_info['paymentMethod'] = Member::getPaymentMethod(self::$cookie->CompanyID);
         //獲取支付方式,是前支付還是後支付
         $order_id = Booking::modifyBooking($booking_info);
         if (empty($order_id)) {
             $error['message'] = "修改失敗, 您修訂的房間信息不存在。";
             self::$smarty->assign("error", $error);
             self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
         } else {
             //下訂單成功,此時需要發送郵件
             Tools::ordermail($order_id);
             Tools::emailHotel($order_id, 11);
             Tools::redirect('booking_list.php');
         }
         exit;
     }
     if ($_POST["booking"] == 'finish') {
         //  $_POST ["booking"] == 'save'
         if ($booking_info['order_id'] == 0) {
             $booking_info['OrderUserId'] = self::$cookie->UserID;
         }
         //獲取用戶ID
         $booking_info['paymentMethod'] = Member::getPaymentMethod(self::$cookie->CompanyID);
         $order_id = Booking::insertNewBooking($booking_info);
         if ($order_id) {
             $booking_info = Booking::getBookingInfo($order_id);
             //下訂單成功,此時需要發送郵件
             Tools::ordermail($order_id);
             Tools::emailHotel($order_id, 10);
         } else {
             $error['message'] = "Booking has time out!";
             self::$smarty->assign("error", $error);
             self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
             exit;
         }
         //$booking_info = Booking::getBookingInfo ( $order_id );
         self::$smarty->assign("booking_info", $booking_info);
         //if ($_POST ["booking"] == 'save')
         //	Tools::redirect ( 'booking_list.php' );
     }
     if ($_POST['booking'] == 'payment') {
         //支付接口調用
         $url = "http://localhost/payment.php";
         //支付站點網址
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_exec($ch);
         //$content =
         $response = curl_getinfo($ch);
         curl_close($ch);
         if ($response['http_code'] == 200) {
             //判斷是否支付成功,此處隻是模擬使用
             Booking::changeBookingStatus($booking_info['order_id'], 4);
             Booking::changePayStatus($booking_info['order_id'], 2);
             Booking::payment($booking_info['order_id'], $_POST['money']);
             //下訂單成功,此時需要發送郵件
             Tools::ordermail($order_id);
         } else {
             //模擬支付失敗的情況
             $error = array();
             $error['message'] = 'sorroy charge fail';
             self::$smarty->assign("error", $error);
             self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl');
             exit;
         }
     }
     parent::process();
 }
開發者ID:khuyennd,項目名稱:dev-tasagent,代碼行數:101,代碼來源:BookingConfirmController.php


注:本文中的Booking::changeBookingStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。