本文整理汇总了PHP中local_to_gmt函数的典型用法代码示例。如果您正苦于以下问题:PHP local_to_gmt函数的具体用法?PHP local_to_gmt怎么用?PHP local_to_gmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了local_to_gmt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getActivityByMinutes
function getActivityByMinutes($productId)
{
$timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
$timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
$all_ret = array();
$version = "all";
for ($i = 29; $i >= 0; $i--) {
$all_size = 0;
$dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
$allAcs = $this->redis->keys("razor_r_ac_p_" . $productId . "_" . $dataStr . "*");
if ($allAcs && count($allAcs) > 0) {
for ($k = 0; $k < count($allAcs); $k++) {
$key = $allAcs[$k];
$len = $this->redis->hlen($key);
$all_size += $len;
}
}
if ($i == 0) {
$onlinedata = array('minutes' => lang("v_rpt_realtime_now"), 'size' => $all_size);
} else {
$onlinedata = array('minutes' => "- " . $i . lang("v_rpt_realtime_minutes"), 'size' => $all_size);
}
array_push($all_ret, $onlinedata);
}
return json_encode($all_ret);
}
开发者ID:newbeess,项目名称:razor,代码行数:26,代码来源:pageviewmodel.php
示例2: addFaq
function addFaq()
{
//Intialize values for library and helpers
$this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
if ($this->input->post('addFaq')) {
//Set rules
$this->form_validation->set_rules('question', 'Question', 'required|trim|xss_clean');
$this->form_validation->set_rules('faq_content', 'Answer', 'required|trim');
if ($this->form_validation->run()) {
//prepare insert data
$insertData = array();
$insertData['question'] = $this->input->post('question');
$insertData['faq_content'] = $this->input->post('faq_content', false);
$insertData['created'] = local_to_gmt();
//Add Groups
$this->faq_model->addfaq($insertData);
//Notification message
$this->session->set_flashdata('flash_message', $this->Common_model->admin_flash_message('success', translate_admin('FAQ added successfully')));
redirect_admin('faq/viewFaqs');
}
}
//If - Form Submission End
//Load View
$data['message_element'] = 'administrator/faq/addFaq';
$this->load->view('administrator/admin_template', $data);
}
开发者ID:BersnardC,项目名称:DROPINN,代码行数:26,代码来源:faq.php
示例3: mobileCode
public function mobileCode()
{
$post = $this->input->post();
$mobile = $post['mobile'];
$this->load->helper('string');
$this->load->model('sms');
$this->load->model('validation');
if (!preg_mobile($mobile)) {
echo json_encode(array('code' => '1002', 'msg' => '错误的手机号码'));
exit;
}
$code = mt_rand(100000, 999999);
$msg = "您好!您验证手机号所需的验证码为" . $code . ",请勿泄露给任何人,30分钟内有效。";
if ($this->sms->send($mobile, $msg)) {
$this->validation->delete_by(array('mobile' => $mobile));
if ($this->validation->insert(array('mobile' => $mobile, 'code' => $code, 'expires' => local_to_gmt() + 1800))) {
echo json_encode(array('code' => '1000'));
exit;
}
} else {
echo json_encode(array('code' => '1002', 'msg' => '发送失败,请稍候重试'));
exit;
}
echo json_encode(array('code' => '1001', 'msg' => '发生错误'));
}
开发者ID:norain2050,项目名称:one,代码行数:25,代码来源:send.php
示例4: addAdmin_key
/**
* Loads Add Admin key.
*
* @access private
* @param nil
* @return void
*/
public function addAdmin_key()
{
//Intialize values for library and helpers
$this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
if ($this->input->post('addAdmin_key')) {
//Set rules
$this->form_validation->set_rules('Admin_key', 'Page_key', 'required|trim|xss_clean');
//$this->form_validation->set_rules('page_ref.','page_ref.','required|trim|xss_clean');
if ($this->form_validation->run()) {
//prepare insert data
$insertData = array();
$insertData['page_key'] = $this->input->post('Admin_key');
$insertData['page_refer'] = $this->input->post('page_ref');
$insertData['status'] = $this->input->post('is_footer');
$insertData['created'] = local_to_gmt();
if ($this->Common_model->getTableData('admin_key', array('status' => 0))->num_rows() == 0 && $insertData['status'] == 0) {
//Add Groups
$this->Admin_key_model->addAdmin_key($insertData);
//Notification message
$this->session->set_flashdata('flash_message', $this->Common_model->admin_flash_message('success', translate_admin('Admin Key added successfully')));
} else {
$this->session->set_flashdata('flash_message', $this->Common_model->admin_flash_message('error', translate_admin('Sorry! Already another Admin Key in active state.')));
}
redirect_admin('admin_key/viewAdmin_key');
}
}
//If - Form Submission End
//Get Faq Categories
$data['Admin_key'] = $this->Admin_key_model->getAdmin_keys();
$data['message_element'] = "administrator/admin_key/addAdmin_key";
$this->load->view('administrator/admin_template', $data);
}
开发者ID:BersnardC,项目名称:DROPINN,代码行数:39,代码来源:admin_key.php
示例5: getTransRateByTime
function getTransRateByTime($productId)
{
$r = $this->getTargetListByProductId($productId);
$num = $r->num_rows();
$ret = array();
$nret = array();
foreach ($r->result() as $row) {
$transEvents = $this->getTransEventsIdByTargetId($row->tid);
$event_from = $transEvents["from"];
$event_to = $transEvents["to"];
$timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
$timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
$from_count = 0;
$to_count = 0;
for ($i = 29; $i >= 0; $i--) {
$dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
$from_size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $event_from . "_" . $dataStr);
$from_count += $from_size;
$to_size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $event_to . "_" . $dataStr);
$to_count += $to_size;
if ($from_count == 0) {
$rate = 0;
} else {
$rate = $to_count / $from_count;
}
}
$r = array('name' => $row->targetname, 'time' => '-' . $i . lang("v_rpt_realtime_minutes"), 'from_count' => $from_count, 'to_count' => $to_count, 'rate' => $rate, 'event_to' => $event_to);
if ($to_count == 0) {
continue;
}
array_push($ret, $r);
}
return $ret;
}
开发者ID:stdroom,项目名称:MKAnalytics,代码行数:34,代码来源:transratemodel.php
示例6: current_time
function current_time($timezone, $daylight_saving)
{
$time = time();
$gmt = local_to_gmt($time);
$local = gmt_to_local($gmt, $timezone, $daylight_saving);
return standard_date("DATE_RFC822", $local);
}
开发者ID:gitanton,项目名称:cono-rest,代码行数:7,代码来源:MY_date_helper.php
示例7: index
public function index()
{
$data = array();
$show_count = 3;
//首页展示楼层数量
$this->load->model('user');
$this->load->model('product');
$this->load->model('product_category');
$this->load->model('product_category_map');
$this->load->model('newss');
$this->load->model('link');
$this->load->model('product_brand');
$this->load->model('ad');
$this->load->model('order');
$this->load->model('coupon');
$product_cate = $this->product_category->get_level_tree();
//树状产品类型
/*
if($product_cate){
foreach ($product_cate as $key => $item) {
$cate_id_ary = $this->product_category->get_all_children($item['id']);
$ids = array($item['id']);
foreach ($cate_id_ary as $k => $v) {
$ids[] = $v;
}
$hot_product = $this->product_category_map->get_product_by_cate($ids); //首页展示的商品
$brand = $this->product_brand->get_by_cateid($item['id']); //首页商品区展示的品牌
$product_cate[$key]['hot_product'] = $hot_product;
// $product_cate[$key]['product_cate_brand'] = $brand;
if($key == ($show_count-1)) //只展示前三楼
break;
}
}
*/
//$handpick_product = $this->product->lists(8,'','',array('handpick = 1'));
//$data['handpick_product'] = $handpick_product;
$data['show_count'] = $show_count;
$data['product_cate'] = $product_cate;
$data['news'] = $this->newss->lists(array("status='1' or (status='2' and show_time < " . local_to_gmt() . ")", "cate_id='1'"), 5, "a.show_time desc");
//按发布时间
$data['vip_news'] = $this->newss->lists(array("status='1' or (status='2' and show_time < " . local_to_gmt() . ")", "cate_id='2'"), 5, "a.show_time desc");
//按发布时间
$data['link'] = $this->link->lists(array("num" => "5"));
//最新五条友情链接
$data['ad_home'] = $this->ad->lists(array("where" => "position_id = 1"));
//首页广告
//$data['ad_1F'] = $this->ad->lists(array("where"=>"position_id = 2"));//1L广告
//$data['ad_2F'] = $this->ad->lists(array("where"=>"position_id = 3"));//2L广告
//$data['ad_3F'] = $this->ad->lists(array("where"=>"position_id = 4"));//3L广告
$data['product_brand'] = $this->product_brand->lists(array("num" => "10"));
//最新27条品牌信息
$data['coupon'] = $this->coupon->lists(array("expirse_from < " . local_to_gmt(), "expirse_to > " . local_to_gmt()), 5, "a.id desc");
if ($this->auth->is_login()) {
$data['order_count'] = $this->order->user_count(array('user_id' => $this->auth->user_id()));
$user = $this->user->get($this->auth->user_id());
$data['score'] = $user->score;
}
$this->load->view('home/index', $data);
}
开发者ID:norain2050,项目名称:one,代码行数:60,代码来源:index.php
示例8: get_gmt_time
function get_gmt_time($time = '')
{
if ($time == '') {
$time = time();
}
$gmt = local_to_gmt($time);
return $gmt;
}
开发者ID:BersnardC,项目名称:DROPINN,代码行数:8,代码来源:MY_date_helper.php
示例9: get_est_time
function get_est_time()
{
$now = time();
$gmt = local_to_gmt($now);
$timezone = 'UM4';
$daylight_saving = FALSE;
$tt = gmt_to_local($gmt, $timezone, $daylight_saving);
return $tt;
}
开发者ID:khanals,项目名称:rbs-ext,代码行数:9,代码来源:MY_date_helper.php
示例10: insert
public function insert($row)
{
if (is_array($row) && !empty($row)) {
if (!isset($row['create_time']) || $row['create_time'] == '') {
$row['create_time'] = local_to_gmt();
}
if ($this->db->insert($this->table, $row)) {
return $this->db->insert_id();
}
}
return false;
}
开发者ID:norain2050,项目名称:one,代码行数:12,代码来源:ad.php
示例11: insert
public function insert($row)
{
if (is_array($row) && !empty($row)) {
if (!isset($row['create_time']) || intval($row['create_time']) <= 0) {
$row['create_time'] = local_to_gmt();
}
if (!isset($row['expires']) || intval($row['expires']) <= 0) {
$row['expires'] = $row['create_time'] + 24 * 3600;
}
if ($this->db->insert($this->table, $row)) {
return $this->db->insert_id();
}
}
return false;
}
开发者ID:norain2050,项目名称:one,代码行数:15,代码来源:validation.php
示例12: getOnlineUsers
function getOnlineUsers($productId)
{
$timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
$timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
$ret = array();
for ($i = 30; $i >= 0; $i--) {
$dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
$size = $this->redis->hlen("razor_r_u_p_" . $productId . "_" . $dataStr);
if ($i == 0) {
$onlinedata = array('minutes' => lang("v_rpt_realtime_now"), 'size' => $size);
} else {
$onlinedata = array('minutes' => "- " . $i . lang("v_rpt_realtime_minutes"), 'size' => $size);
}
array_push($ret, $onlinedata);
}
return $ret;
}
开发者ID:newbeess,项目名称:razor,代码行数:17,代码来源:onlineusermodel.php
示例13: insert
public function insert($row)
{
if (is_array($row) && !empty($row)) {
if (!isset($row['create_time']) || intval($row['create_time']) == 0) {
$row['create_time'] = local_to_gmt();
}
if (!isset($row['user_id']) || intval($row['user_id']) == 0) {
$row['user_id'] = $this->auth->is_login() ? $this->auth->user_id() : 0;
}
if (!isset($row['status'])) {
$row['status'] = 1;
}
if ($this->db->insert($this->table, $row)) {
return $this->db->insert_id();
}
}
return false;
}
开发者ID:norain2050,项目名称:one,代码行数:18,代码来源:pay_log.php
示例14: insert
public function insert($row)
{
if (is_array($row) && !empty($row)) {
if (!isset($row['user_id'])) {
$row['user_id'] = $this->auth->user_id();
}
if (!isset($row['username'])) {
$row['username'] = $this->auth->username();
}
if (!isset($row['time'])) {
$row['time'] = local_to_gmt();
}
if (!isset($row['ip'])) {
$row['ip'] = $this->input->ip_address();
}
if ($this->db->insert($this->table, $row)) {
return $this->db->insert_id();
}
}
return false;
}
开发者ID:norain2050,项目名称:one,代码行数:21,代码来源:logs.php
示例15: test
function test()
{
ini_set('date.timezone', 'PRC');
//people republic of china
$this->load->helper("date");
// echo timezone_menu("UP8");
// $datestring = "Year: %Y Month: %m Day: %d - %h:%i %a";
$time = time();
// echo standard_date("DATE_ATOM", $time);
$timestamp = local_to_gmt($time);
//转化为时间戳 gmt greenwich mean time 格林尼治时间
//$timezone="PRC";//people republic of china
// echo gmt_to_local($timestamp,$timezone,true);
$mysql = '20061124092345';
$unix = mysql_to_unix($mysql);
$past_time = '19900926092633';
$a = strtotime($past_time);
echo local_to_gmt($past_time);
// $time=time();
echo timespan($past_time, $time);
///$past_time 一定是个时间戳
}
开发者ID:GStepOne,项目名称:CI,代码行数:22,代码来源:time.php
示例16: getEventNumByEvent
function getEventNumByEvent($productId)
{
$timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
$timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
$all_ret = array();
$version = "all";
$eventid_array = $this->event->getEventIdentifierinfo($productId, $version);
foreach ($eventid_array->result() as $row) {
$all_size = 0;
for ($i = 0; $i <= 30; $i++) {
$dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
$size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $row->event_identifier . "_" . $dataStr);
$all_size += $size;
}
$data = array('event' => $row->event_identifier, 'size' => $all_size);
if ($all_size == 0) {
continue;
}
array_push($all_ret, $data);
}
return $all_ret;
}
开发者ID:stdroom,项目名称:MKAnalytics,代码行数:22,代码来源:eventmodel.php
示例17: id
public function id($id)
{
if (!$id) {
show_error('参数错误', 500);
}
$product = $this->product->get($id);
if (!$product) {
show_404();
}
$this->product->add_view($id);
$category = $this->product->get_category($id);
if ($category) {
$data['category'] = $category;
if ($category->parent_id) {
$parent = $this->product_category->get($category->parent_id);
$data['parent'] = $parent;
$data['child'] = $this->product_category->all(array('where' => array('parent_id' => $category->parent_id)));
}
}
$brand = $this->product_brand->get($product->brand_id);
$data['brand_name'] = '';
if ($brand) {
$data['brand_name'] = $brand->name;
}
$data['product'] = $product;
//看了又看
$data['view_again'] = $this->product->all(array('status' => 1), 'view_num desc', '', 3);
//销售排行
$data['goodsale'] = $this->product->all(array('status' => 1), 'sale_num desc', '', 9);
//最终购买了
$data['last_buy'] = $this->product->all(array('status' => 1), '', '', 3);
if ($this->auth->is_login()) {
$this->load->model('user_browse_history');
$this->user_browse_history->insert(array('user_id' => $this->auth->user_id(), 'product_id' => $id, 'create_time' => local_to_gmt()));
}
$this->load->view('home/item', $data);
}
开发者ID:JokeLook,项目名称:one,代码行数:37,代码来源:item.php
示例18: date
{
alert('Sorry! Email or Phone number is not allowed');return false;
}
})
})
</script>
<script type="text/javascript">
// Current Server Time script (SSI or PHP)- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use.
//Depending on whether your page supports SSI (.shtml) or PHP (.php), UNCOMMENT the line below your page supports and COMMENT the one it does not:
//Default is that SSI method is uncommented, and PHP is commented:
var currenttime = '<?php
echo date("F d, Y H:i:s", get_user_time(local_to_gmt(), get_user_timezoneL($this->uri->segment(3))));
?>
' //PHP method of getting server date
///////////Stop editting here/////////////////////////////////
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var serverdate=new Date(currenttime)
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}
function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
开发者ID:BersnardC,项目名称:DROPINN,代码行数:31,代码来源:view_vouch.php
示例19: pay
//.........这里部分代码省略.........
$admin_name = $this->dx_auth->get_site_title();
$query3 = $this->Common_model->getTableData('users', array('id' => $list['userby']));
$rows = $query3->row();
$username = $rows->username;
$user_id = $rows->id;
$email_id = $rows->email;
$query4 = $this->Users_model->get_user_by_id($buyer_id);
$buyer_name = $query4->row()->username;
$buyer_email = $query4->row()->email;
//Check md5('No Travel Cretids') || md5('Yes Travel Cretids')
if ($is_travelCretids == '7c4f08a53f4454ea2a9fdd94ad0c2eeb') {
$query5 = $this->Referrals_model->get_details_refamount($user_id);
$amount = $query5->row()->amount;
$updateKey = array('user_id ' => $user_id);
$updateData = array();
$updateData['amount'] = $amount - $user_travel_cretids;
$this->Referrals_model->updateReferralsAmount($updateKey, $updateData);
$list['credit_type'] = 2;
$list['ref_amount'] = $user_travel_cretids;
$row = $query4->row();
//sent mail to administrator
$email_name = 'tc_book_to_admin';
$splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email);
//Send Mail
$this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars);
//sent mail to buyer
$email_name = 'tc_book_to_host';
$splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price']);
//Send Mail
if ($buyer_email != '0') {
$this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars);
}
}
$list['book_date'] = local_to_gmt();
//Actual insertion into the database
$this->Common_model->insertData('reservation', $list);
$reservation_id = $this->db->insert_id();
//Send Message Notification
$insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation request from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1);
$this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id);
$message_id = $this->db->insert_id();
$actionurl = site_url('trips/request/' . $reservation_id);
//Reservation Notification To Host
$email_name = 'host_reservation_notification';
$splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price'], "{action_url}" => $actionurl);
//Send Mail
//
if ($buyer_email != '0') {
$this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars);
}
//Reservation Notification To Traveller
$email_name = 'traveller_reservation_notification';
$splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username));
//Send Mail
$this->Email_model->sendMail($email_id, $admin_email, ucfirst($admin_name), $email_name, $splVars);
//Reservation Notification To Administrator
$email_name = 'admin_reservation_notification';
$splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email);
//Send Mail
$this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars);
// if($is_block == 'on')
// {
$this->db->select_max('group_id');
$group_id = $this->db->get('calendar')->row()->group_id;
if (empty($group_id)) {
echo $countJ = 0;
开发者ID:empotix,项目名称:travelo,代码行数:67,代码来源:payment.php
示例20: cancel_travel
public function cancel_travel($params1 = '', $params2 = '', $params3 = '')
{
if ($params1 != '') {
$conditions = array('reservation.id' => $params1);
$row = $this->Trips_model->get_reservation($conditions)->row();
if ($row->status == 12 || $row->status == 6) {
echo translate('This reservation is already cancelled by Guest.');
exit;
} else {
if ($row->status == 5 || $row->status == 11) {
echo translate('This reservation is already cancelled by Host.');
exit;
}
}
}
if ($this->input->post('reservation_id')) {
$reservation_id = $this->input->post('reservation_id');
$admin_email = $this->dx_auth->get_site_sadmin();
$admin_name = $this->dx_auth->get_site_title();
$conditions = array('reservation.id' => $reservation_id);
$row = $this->Trips_model->get_reservation($conditions)->row();
$before_status = $row->status;
if ($this->Users_model->get_user_by_id($row->userby)) {
$query1 = $this->Users_model->get_user_by_id($row->userby);
} else {
$this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Your List was deleted.')));
redirect('travelling/your_trips');
}
$traveler_name = $query1->row()->username;
$traveler_email = $query1->row()->email;
$query2 = $this->Users_model->get_user_by_id($row->userto);
$host_name = $query2->row()->username;
$host_email = $query2->row()->email;
$list_title = $this->Common_model->getTableData('list', array('id' => $row->list_id))->row()->title;
$updateKey = array('id' => $reservation_id);
$updateData = array();
$check_user = $this->db->where('user_id', $this->dx_auth->get_user_id())->where('id', $row->list_id)->get('list');
if ($check_user->num_rows() == 1) {
if ($row->status == 7) {
$updateData['status'] = 11;
} else {
$updateData['status'] = 5;
}
if ($row->status == 1) {
$updateData['status'] = 13;
}
$host_cancellation = $this->Common_model->getTableData('host_cancellation_policy', array('id' => 1))->row();
$check_free_cancellation_limit = $this->db->query("SELECT * FROM (`reservation`) WHERE `userto` = " . $this->dx_auth->get_user_id() . " AND from_unixtime(cancel_date) >= DATE_SUB(CURRENT_TIMESTAMP(),INTERVAL " . $host_cancellation->months . " MONTH) AND (`status` = 5 OR `status` = 11)");
if ($check_free_cancellation_limit->num_rows() >= $host_cancellation->free_cancellation) {
$free_cancellation_limit = 0;
$date1 = new DateTime(date('Y-m-d H:i:s'));
$date2 = new DateTime(date('Y-m-d H:i:s', $row->checkin));
$interval = $date1->diff($date2);
if ($interval->days < $host_cancellation->days) {
$penalty_amount = $host_cancellation->before_amount;
} else {
$penalty_amount = $host_cancellation->after_amount;
}
$check_already_penalty = $this->Common_model->getTableData('host_cancellation_penalty', array('user_id' => $this->dx_auth->get_user_id()));
if ($check_already_penalty->num_rows() != 0) {
$update_penalty['amount'] = $check_already_penalty->row()->amount + get_currency_value_lys($host_cancellation->currency, $check_already_penalty->row()->currency, $penalty_amount);
$update_penalty_key['id'] = $check_already_penalty->row()->id;
$this->Common_model->updateTableData('host_cancellation_penalty', 0, $update_penalty_key, $update_penalty);
} else {
$insert_penalty['amount'] = $penalty_amount;
$insert_penalty['user_id'] = $this->dx_auth->get_user_id();
$insert_penalty['currency'] = $host_cancellation->currency;
$this->Common_model->inserTableData('host_cancellation_penalty', $insert_penalty);
}
$insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => 1, 'userto' => $row->userto, 'message' => "You're cross the free cancellation limit. So, Admin will take {$penalty_amount}" . $host_cancellation->currency . " penalty amount from your next payout.", 'created' => local_to_gmt(), 'message_type' => 3);
$this->Message_model->sentMessage($insertData, 1);
$insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => 1, 'userto' => 1, 'message' => "{$host_name} cross the free cancellation limit. So, You will earn {$penalty_amount}" . $host_cancellation->currency . " penalty amount from {$host_name} next payout.", 'created' => local_to_gmt(), 'message_type' => 3);
$this->Message_model->sentMessage($insertData, 1);
} else {
$free_cancellation_limit = $host_cancellation->free_cancellation - $check_free_cancellation_limit->num_rows();
}
$insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userto, 'userto' => $row->userby, 'message' => "Sorry, Your reservation is cancelled by {$host_name} for {$list_title}.", 'created' => local_to_gmt(), 'message_type' => 3);
$this->Message_model->sentMessage($insertData, 1);
} else {
if ($row->status == 7) {
$updateData['status'] = 12;
} else {
$updateData['status'] = 6;
}
if ($row->status == 1) {
$updateData['status'] = 13;
}
$insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userby, 'userto' => $row->userto, 'message' => "Sorry, Your list reservation is cancelled by {$traveler_name} for {$list_title}.", 'created' => local_to_gmt(), 'message_type' => 3);
$this->Message_model->sentMessage($insertData, 1);
}
$updateData['cancel_date'] = time();
$this->Trips_model->update_reservation($updateKey, $updateData);
// payment_helper called for refund amount for host and guest as per host and guest cancellation policy
refund($reservation_id);
/* $cancel_trip_referral_query = $this->db->select('cancel_trips_referral_code')->where('id',$row->userby)->get('users');
if($cancel_trip_referral_query->num_rows()!=0)
{
if($cancel_trip_referral_query->row()->cancel_trips_referral_code != '')
{
$this->db->set('trips_referral_code',$cancel_trip_referral_query->row()->cancel_trips_referral_code)->where('id',$row->userby)->update('users');
//.........这里部分代码省略.........
开发者ID:BersnardC,项目名称:DROPINN,代码行数:101,代码来源:travelling.php
注:本文中的local_to_gmt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论