本文整理汇总了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;
}
}
}
示例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");
}
}
//.........这里部分代码省略.........
示例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();
}