You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/third_party/order/controllers/confirm.php

139 lines
6.1 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Confirm extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Order_model');
}
//site_code默认是空ct的站点需要传值
public function index($COLI_SN = false, $visitor_link = false, $token = false,$site_code='') {
$data = array();
if (empty($COLI_SN) || strtoupper(md5($visitor_link)) != strtoupper($token)) {
echo '<div class="hidden">校验不对</div>';
$this->load->view($site_code.'/link_tips', $data);
return false;
}
$data['visitor_link'] = $visitor_link;
$data['userinfo'] = $this->Order_model->get_customer_info($COLI_SN);
$data['username'] = '';
if (!empty($data['userinfo'])) {
foreach ($data['userinfo'] as $v) {
if ($v->CUL_IsLinkMan == 1) {
$data['username'] = $v->MEI_FirstName;
$data['usermail'] = $v->MEI_MailList;
}
}
} else {
$this->load->view($site_code.'/link_tips', $data);
return false;
}
$visitor_link_arr = $this->Order_model->get_visitor_link($COLI_SN);
foreach ($visitor_link_arr as $l) {
if ($visitor_link == $l->visitor_link) {
$this->load->view($site_code.'/link_tips', $data);
return false;
}
}
$this->load->view($site_code.'/confirm_order', $data);
}
public function save_confirm_info() {
//客人信息
$gender = $this->input->post('gender');
$given_name = $this->input->post('given_name');
$birthday = $this->input->post('birthday');
$passport = $this->input->post('passport');
$expiration_date = $this->input->post('passport_expiration_date');
$nationality = $this->input->post('nationality');
$contact_phone = '座机:' . $this->input->post('landline') . '/手机:' . $this->input->post('mobile');
$COLI_SN = $this->input->post('COLI_SN');
$visitor_link = $this->input->post('visitor_link');
$COLI_ID = $this->input->post('COLI_ID');
//航班信息
$MEI_ArrivalFlightNo = $this->input->post('MEI_ArrivalFlightNo');
$MEI_ArrivalTime = $this->input->post('MEI_ArrivalTime');
$MEI_DepartureFlightNo = $this->input->post('MEI_DepartureFlightNo');
$MEI_DepartureTime = $this->input->post('MEI_DepartureTime');
//已经确认过
$had_save = $this->Order_model->get_visitor_link($COLI_SN, $visitor_link);
if (!empty($had_save)) {
echo json_encode(array('status' => 'ok'));
return;
}
$MEI_SN = false;
foreach ($this->input->post('sur_name') as $key => $name) {
if (!empty($name)) {
if ($this->input->post('home_address') != '') {
$MEI_Street = $this->input->post('home_address');
} elseif ($this->input->post('address_street')) {
$MEI_Street = $this->input->post('address_street') . ',' . $this->input->post('address_city') . ',' . $this->input->post('address_state') . ',' . $this->input->post('address_country');
} else {
$MEI_Street = $this->input->post('street').','.$this->input->post('city').','.$this->input->post('country');
}
$data['MEI_Street'] = $MEI_Street;
if (isset($given_name[$key]) && $given_name[$key] != 'None') {
$MEI_FirstName = $given_name[$key];
} else {
$MEI_FirstName = '';
}
$MEI_LastName = $name;
$CUL_Memo = $this->input->post('insurance_information');
$MEI_Memo = $this->input->post('special_request') . ' ' . $CUL_Memo;
$birthday_tmp = date('Y-m-d H:i:s', strtotime($birthday[$key]));
$expiration_date_tmp = date('Y-m-d H:i:s', strtotime($expiration_date[$key]));
$MEI_SN = $this->Order_model->add_customer_info($gender[$key], $nationality[$key], $MEI_FirstName, $MEI_LastName, $passport[$key], $expiration_date_tmp, $birthday_tmp, $MEI_Memo, $MEI_Street, '', $contact_phone, 0, $COLI_SN, $visitor_link,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime);
}
}
if ($MEI_SN && $this->input->post('emergency_person_name') != '') {
$add_emergency_res = $this->Order_model->add_customer_info(
'', '', $this->input->post('emergency_person_name'), '', '', '', '', $this->input->post('emergency_relationship'), '', $this->input->post('emergency_email'), $this->input->post('emergency_telephone'), 1, $COLI_SN, $visitor_link
,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime
);
}
if ($MEI_SN) {
$customer_usermail = $this->input->post('customer_usermail');
$customer_username = $this->input->post('customer_username');
$toname = $this->input->post('toname');
$tomail = $this->input->post('tomail');
$data['postdata'] = $this->input->post();
$mail_text = $this->load->view('mailtext', $data, true);
$this->Order_model->send_mail('chinahighlights', 'service@chinahighlights.com', $toname, $tomail, $COLI_ID . ' 团个人信息导入HT', $COLI_ID . ' 团个人信息导入HT<br>' . $mail_text, 'China Highlights', $M_Web = 'CHT_USERINFO');
//发送信息给客人
//$this->Order_model->send_mail($toname, $tomail, $customer_username, $customer_usermail, 'Passenger Information', $mail_text, 'China Highlights', $M_Web = 'CHT_USERINFO');
echo json_encode(array('status' => 'ok'));
} else {
echo json_encode(array('status' => 'no'));
}
}
//只有ch有review功能
function review() {
$data = array();
$data['postdata'] = $this->input->post();
$mail_text = $this->load->view('mailtext', $data, true);
echo json_encode($mail_text);
}
}