本文整理汇总了PHP中TravelHelper::insertDuplicate方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::insertDuplicate方法的具体用法?PHP TravelHelper::insertDuplicate怎么用?PHP TravelHelper::insertDuplicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TravelHelper
的用法示例。
在下文中一共展示了TravelHelper::insertDuplicate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _update_duplicate_data
function _update_duplicate_data($id, $data)
{
if (!TravelHelper::checkTableDuplicate('st_rental')) {
return;
}
if (get_post_type($id) == 'st_rental') {
$num_rows = TravelHelper::checkIssetPost($id, 'st_rental');
$location_str = get_post_meta($id, 'multi_location', true);
$location_id = '';
// location_id
$address = get_post_meta($id, 'address', true);
// address
$rentals_booking_period = get_post_meta($id, 'rentals_booking_period', true);
// rentals_booking_period
$rental_max_adult = get_post_meta($id, 'rental_max_adult', true);
// rental max adult
$rental_max_children = get_post_meta($id, 'rental_max_children', true);
// rental max children
$sale_price = get_post_meta($id, 'price', true);
// sale price
$discount = get_post_meta($id, 'discount_rate', true);
$is_sale_schedule = get_post_meta($id, 'is_sale_schedule', true);
if ($is_sale_schedule == 'on') {
$sale_from = get_post_meta($id, 'sale_price_from', true);
$sale_to = get_post_meta($id, 'sale_price_to', true);
if ($sale_from and $sale_from) {
$today = date('Y-m-d');
$sale_from = date('Y-m-d', strtotime($sale_from));
$sale_to = date('Y-m-d', strtotime($sale_to));
if ($today >= $sale_from && $today <= $sale_to) {
} else {
$discount = 0;
}
} else {
$discount = 0;
}
}
if ($discount) {
$sale_price = $sale_price - $sale_price / 100 * $discount;
}
$rate_review = STReview::get_avg_rate($id);
// rate review
if ($num_rows == 1) {
$data = array('multi_location' => $location_str, 'location_id' => $location_id, 'address' => $address, 'rental_max_adult' => $rental_max_adult, 'rental_max_children' => $rental_max_children, 'rate_review' => $rate_review, 'sale_price' => $sale_price, 'rentals_booking_period' => $rentals_booking_period);
$where = array('post_id' => $id);
TravelHelper::updateDuplicate('st_rental', $data, $where);
} elseif ($num_rows == 0) {
$data = array('post_id' => $id, 'multi_location' => $location_str, 'location_id' => $location_id, 'address' => $address, 'rental_max_adult' => $rental_max_adult, 'rental_max_children' => $rental_max_children, 'rate_review' => $rate_review, 'sale_price' => $sale_price, 'rentals_booking_period' => $rentals_booking_period);
TravelHelper::insertDuplicate('st_rental', $data);
}
}
}
示例2: _update_duplicate_data
function _update_duplicate_data($id, $data)
{
if (!TravelHelper::checkTableDuplicate('st_cars')) {
return;
}
if (get_post_type($id) == 'st_cars') {
$num_rows = TravelHelper::checkIssetPost($id, 'st_cars');
$location_str = get_post_meta($id, 'multi_location', true);
$location_id = '';
// location_id
$cars_address = get_post_meta($id, 'cars_address', true);
// address
$cars_price = get_post_meta($id, 'cars_price', true);
// price
$number_car = get_post_meta($id, 'number_car', true);
// number_car
$cars_booking_period = get_post_meta($id, 'cars_booking_period', true);
// cars_booking_period
$sale_price = get_post_meta($id, 'cars_price', true);
// sale_price
$discount = get_post_meta($id, 'discount', true);
$is_sale_schedule = get_post_meta($id, 'is_sale_schedule', true);
if ($is_sale_schedule == 'on') {
$sale_from = get_post_meta($id, 'sale_price_from', true);
$sale_to = get_post_meta($id, 'sale_price_to', true);
if ($sale_from and $sale_from) {
$today = date('Y-m-d');
$sale_from = date('Y-m-d', strtotime($sale_from));
$sale_to = date('Y-m-d', strtotime($sale_to));
if ($today >= $sale_from && $today <= $sale_to) {
} else {
$discount = 0;
}
} else {
$discount = 0;
}
}
if ($discount) {
$sale_price = $sale_price - $sale_price / 100 * $discount;
}
if ($num_rows == 1) {
$data = array('multi_location' => $location_str, 'id_location' => $location_id, 'cars_address' => $cars_address, 'cars_price' => $cars_price, 'sale_price' => $sale_price, 'number_car' => $number_car, 'cars_booking_period' => $cars_booking_period);
$where = array('post_id' => $id);
TravelHelper::updateDuplicate('st_cars', $data, $where);
} elseif ($num_rows == 0) {
$data = array('post_id' => $id, 'multi_location' => $location_str, 'id_location' => $location_id, 'cars_address' => $cars_address, 'cars_price' => $cars_price, 'sale_price' => $sale_price, 'number_car' => $number_car, 'cars_booking_period' => $cars_booking_period);
TravelHelper::insertDuplicate('st_cars', $data);
}
}
}
示例3: _update_duplicate_data
function _update_duplicate_data($id, $data)
{
if (!TravelHelper::checkTableDuplicate('st_holidays')) {
return;
}
if (get_post_type($id) == 'st_holidays') {
$num_rows = TravelHelper::checkIssetPost($id, 'st_holidays');
$location_str = get_post_meta($id, 'multi_location', true);
$location_id = '';
// location_id
$address = get_post_meta($id, 'address', true);
// address
$max_people = get_post_meta($id, 'max_people', true);
// maxpeople
$check_in = get_post_meta($id, 'check_in', true);
// check in
$check_out = get_post_meta($id, 'check_out', true);
// check out
$type_holiday = get_post_meta($id, 'type_holiday', true);
// check out
$duration_day = get_post_meta($id, 'duration_day', true);
// duration_day
$holidays_booking_period = get_post_meta($id, 'holidays_booking_period', true);
// holidays_booking_period
$sale_price = get_post_meta($id, 'price', true);
// sale_price
$child_price = get_post_meta($id, 'child_price', true);
$adult_price = get_post_meta($id, 'adult_price', true);
$infant_price = get_post_meta($id, 'infant_price', true);
$discount = get_post_meta($id, 'discount', true);
$is_sale_schedule = get_post_meta($id, 'is_sale_schedule', true);
if ($is_sale_schedule == 'on') {
$sale_from = get_post_meta($id, 'sale_price_from', true);
$sale_to = get_post_meta($id, 'sale_price_to', true);
if ($sale_from and $sale_from) {
$today = date('Y-m-d');
$sale_from = date('Y-m-d', strtotime($sale_from));
$sale_to = date('Y-m-d', strtotime($sale_to));
if ($today >= $sale_from && $today <= $sale_to) {
} else {
$discount = 0;
}
} else {
$discount = 0;
}
}
if ($discount) {
$sale_price = $sale_price - $sale_price / 100 * $discount;
$child_price = $child_price - $child_price / 100 * $discount;
$adult_price = $adult_price - $adult_price / 100 * $discount;
$infant_price = $infant_price - $infant_price / 100 * $discount;
}
$rate_review = STReview::get_avg_rate($id);
// rate review
if ($num_rows == 1) {
$data = array('multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'type_holiday' => $type_holiday, 'check_in' => $check_in, 'check_out' => $check_out, 'sale_price' => $sale_price, 'child_price' => $child_price, 'adult_price' => $adult_price, 'infant_price' => $infant_price, 'max_people' => $max_people, 'rate_review' => $rate_review, 'duration_day' => $duration_day, 'holidays_booking_period' => $holidays_booking_period);
$where = array('post_id' => $id);
TravelHelper::updateDuplicate('st_holidays', $data, $where);
} elseif ($num_rows == 0) {
$data = array('post_id' => $id, 'multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'type_holiday' => $type_holiday, 'check_in' => $check_in, 'check_out' => $check_out, 'sale_price' => $sale_price, 'child_price' => $child_price, 'adult_price' => $adult_price, 'infant_price' => $infant_price, 'max_people' => $max_people, 'rate_review' => $rate_review, 'duration_day' => $duration_day, 'holidays_booking_period' => $holidays_booking_period);
TravelHelper::insertDuplicate('st_holidays', $data);
}
}
}
示例4: _update_duplicate_data
/**
*@since 1.1.8
**/
function _update_duplicate_data($id, $data)
{
if (!TravelHelper::checkTableDuplicate('st_hotel')) {
return;
}
if (get_post_type($id) == 'st_hotel') {
$num_rows = TravelHelper::checkIssetPost($id, 'st_hotel');
$location_str = get_post_meta($id, 'multi_location', true);
$location_id = '';
// location_id
$address = get_post_meta($id, 'address', true);
// address
$allow_full_day = get_post_meta($id, 'allow_full_day', true);
// address
$rate_review = STReview::get_avg_rate($id);
// rate review
$hotel_star = get_post_meta($id, 'hotel_star', true);
// hotel star
$price_avg = get_post_meta($id, 'price_avg', true);
// price avg
$hotel_booking_period = get_post_meta($id, 'hotel_booking_period', true);
// price avg
$map_lat = get_post_meta($id, 'map_lat', true);
// map_lat
$map_lng = get_post_meta($id, 'map_lng', true);
// map_lng
if ($num_rows == 1) {
$data = array('multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'allow_full_day' => $allow_full_day, 'rate_review' => $rate_review, 'hotel_star' => $hotel_star, 'price_avg' => $price_avg, 'hotel_booking_period' => $hotel_booking_period, 'map_lat' => $map_lat, 'map_lng' => $map_lng);
$where = array('post_id' => $id);
TravelHelper::updateDuplicate('st_hotel', $data, $where);
} elseif ($num_rows == 0) {
$data = array('post_id' => $id, 'multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'allow_full_day' => $allow_full_day, 'rate_review' => $rate_review, 'hotel_star' => $hotel_star, 'price_avg' => $price_avg, 'hotel_booking_period' => $hotel_booking_period, 'map_lat' => $map_lat, 'map_lng' => $map_lng);
TravelHelper::insertDuplicate('st_hotel', $data);
}
}
}