diff --git a/application/third_party/dinglogin/controllers/login.php b/application/third_party/dinglogin/controllers/login.php
new file mode 100644
index 00000000..3db981d0
--- /dev/null
+++ b/application/third_party/dinglogin/controllers/login.php
@@ -0,0 +1,85 @@
+load->helper('dinglogin');
+ $this->load->helper('cookie');
+ $this->appid = 'dingoalutppbmywhkyorfp';
+ $this->appsecret = '6vAG1GwqwUE0b3g-8g0ZooKXt0SVVwcypIYbDLVy_MyS0jDV89rE68hXOV6WL0HO';
+ $this->AppKey = 'dingjcbxgidah9uspeuc';
+ $this->AppSecret = 'C4-8rUDK1u5Twpsw7U3yo42s_bbYxFIqzLMp2j7uI80Sa8D-OPbtSoCMgZxHxo2d';
+ $this->load->model('ding_login_model');
+ }
+
+ //展示第三方登录页HTTP_REFERER
+ public function index(){
+ delete_cookie('returnurl');
+ if(isset($_REQUEST['returnurl'])){
+ $returnurl = $_REQUEST['returnurl'];
+ }else{
+ $returnurl = 'http://www.mycht.cn';
+ }
+ $this->input->set_cookie('returnurl',$returnurl,60);
+ $this->load->view('login-indx');
+ }
+
+ //判断是否存在该用户
+ public function auth_login(){
+ $code = $_REQUEST['code'];
+ $microtime = get_microtime();
+
+ $signature = get_loginsign($microtime,$this->appsecret);
+ $url = 'https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey='.urlencode($this->appid).'×tamp='.urlencode($microtime).'&signature='.urlencode($signature);
+ $data = array();
+ $data['tmp_auth_code'] = $code;
+ $userinfo = GetPost_http($url,json_encode($data),'json');
+ $userinfo_data = json_decode($userinfo);
+ //如果不存在unionid,则不往下执行
+ if(!isset($userinfo_data->user_info->unionid)){
+ header("HTTP/1.1 404 Not Found");
+ exit('{"errcode":404,"errmsg":"不存在unionid!"}');
+ }
+
+ $unionid = $userinfo_data->user_info->unionid;
+ //获取access_token
+ $access_url = 'https://oapi.dingtalk.com/gettoken?appkey='.$this->AppKey.'&appsecret='.$this->AppSecret;
+ $access_token = GetPost_http($access_url,'','');
+ $access_token = json_decode($access_token)->access_token;
+
+ //通过unionid获取userid(在公司内部进行查找,如果人员不存在则不会返回userid)
+ $userid_url = 'https://oapi.dingtalk.com/user/getUseridByUnionid?access_token='.$access_token.'&unionid='.$unionid;
+
+ $userid_json = GetPost_http($userid_url,'','');
+ if(!isset(json_decode($userid_json)->userid)){
+ header("HTTP/1.1 404 Not Found");
+ exit($userid_json);
+ }
+ $userid = json_decode($userid_json)->userid;
+
+ $user_url = 'https://oapi.dingtalk.com/user/get?access_token='.$access_token.'&userid='.$userid;
+ $user_info = GetPost_http($user_url,'','');
+
+ $user_data = json_decode($user_info);
+ $userinfo = array();
+ $userinfo['name'] = $user_data->name;
+ $userinfo['position'] = $user_data->position;
+ $userinfo['unionid'] = $user_data->unionid;
+ $userinfo['avatar'] = $user_data->avatar;
+ $userinfo['orgEmail'] = $user_data->orgEmail;
+ $userinfo['mobile'] = $user_data->mobile;
+ $userinfo['datetime'] = time();
+ $this->ding_login_model->addorupdateuser($userinfo);
+ $this->input->set_cookie('dingname',$user_data->name,2592000);
+ $this->input->set_cookie('dingunionid',$user_data->unionid,2592000);
+ redirect(get_cookie('returnurl'));
+ }
+
+}
\ No newline at end of file
diff --git a/application/third_party/dinglogin/helpers/dinglogin_helper.php b/application/third_party/dinglogin/helpers/dinglogin_helper.php
new file mode 100644
index 00000000..8eab66af
--- /dev/null
+++ b/application/third_party/dinglogin/helpers/dinglogin_helper.php
@@ -0,0 +1,49 @@
+
\ No newline at end of file
diff --git a/application/third_party/dinglogin/models/ding_login_model.php b/application/third_party/dinglogin/models/ding_login_model.php
new file mode 100644
index 00000000..7069f4e3
--- /dev/null
+++ b/application/third_party/dinglogin/models/ding_login_model.php
@@ -0,0 +1,34 @@
+HT = $this->load->database('HT', TRUE);
+ }
+
+ public function addorupdateuser($data){
+ $sql = "
+ IF NOT EXISTS(
+ select * from Dingding_User where ddu_Unionid = ?
+ )
+ INSERT INTO Dingding_User (ddu_Name,ddu_Unionid,ddu_Mobile,ddu_Email,ddu_Position,ddu_Avatar,ddu_Datetime) VALUES (N?,?,?,?,N?,?,?)
+
+ ELSE
+ UPDATE Dingding_User SET
+ ddu_Name = N?,
+ ddu_Mobile = ?,
+ ddu_Email = ?,
+ ddu_Position = N?,
+ ddu_Avatar = ?,
+ ddu_Datetime = ?
+ WHERE ddu_Unionid = ?
+ ";
+ $query = $this->HT->query($sql,array($data['unionid'],$data['name'],$data['unionid'],$data['mobile'],$data['orgEmail'],$data['position'],$data['avatar'],$data['datetime'],$data['name'],$data['mobile'],$data['orgEmail'],$data['position'],$data['avatar'],$data['datetime'],$data['unionid']));
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/application/third_party/dinglogin/views/login-indx.php b/application/third_party/dinglogin/views/login-indx.php
new file mode 100644
index 00000000..ce6d92cc
--- /dev/null
+++ b/application/third_party/dinglogin/views/login-indx.php
@@ -0,0 +1,124 @@
+
+
+
+
+ value系统登录
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
IE6 isn't allowed!
+ Please use Google Chrome, Firefox, Safair, or IE7+.
+
+
+
+
+
+
+
+
diff --git a/application/third_party/trainsystem/controllers/api.php b/application/third_party/trainsystem/controllers/api.php
index c62c3293..9d33819d 100644
--- a/application/third_party/trainsystem/controllers/api.php
+++ b/application/third_party/trainsystem/controllers/api.php
@@ -248,30 +248,6 @@ class api extends CI_Controller{
}
}
- //登录验证
- public function check_login(){
- $code = $this->input->get('code');
- $signature = getDingSignature();
- $urlencode_signature = urlencode($signature);
- $personInfoUrl = 'https://oapi.dingtalk.com/sns/getuserinfo_bycode?signature='.$urlencode_signature.'×tamp='.time().'&accessKey=dingoaystremzlahfew1tb';
- $post_data = '{"tmp_auth_code":"'.$code.'"}';
- $returnJson = GetPost_http($personInfoUrl,$post_data,'json');
- $returnData = json_decode($returnJson);
-
- if(!empty($returnData->user_info)){
- //创建session
- $this->session->set_userdata('dingname', $returnData->user_info->nick);
- $this->session->set_userdata('dingunionid', $returnData->user_info->unionid);
- redirect('http://www.mycht.cn/info.php/apps/trainsystem/pages/');
- }else{
- redirect('http://www.mycht.cn/info.php/apps/trainsystem/pages/login');
- }
- }
-
- public function check_session(){
- print_r($this->session->userdata('dingunionid'));
- }
-
//订单同步到trainsystem
public function sync_orders(){
die();
diff --git a/application/third_party/trainsystem/controllers/pages.php b/application/third_party/trainsystem/controllers/pages.php
index c7a86c6d..cb1715b6 100644
--- a/application/third_party/trainsystem/controllers/pages.php
+++ b/application/third_party/trainsystem/controllers/pages.php
@@ -9,13 +9,15 @@ class pages extends CI_Controller{
$this->load->model("train_system_model");
$this->load->model("BIZ_train_model");
$this->load->helper('train');
+ $this->load->helper('cookie');
$this->order_status_msg = $this->config->item('train_order_status_msg');
}
public function index($coli_id = null){
- /*if($this->session->userdata('dingname') == '' && $this->session->userdata('dingunionid') == ''){
- dingLogin();
- }*/
+ if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
+ redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
+ }
+
if($coli_id == null){
$cols_id = $this->input->post("ht_order");
}else{
@@ -54,9 +56,9 @@ class pages extends CI_Controller{
//系统列表页面
public function order_list(){
- /*if($this->session->userdata('dingname') == '' && $this->session->userdata('dingunionid') == ''){
- dingLogin();
- }*/
+ if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
+ redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
+ }
$page_size = 10;
$page = $this->input->get("page");
$order = $this->input->get("order");
@@ -110,9 +112,9 @@ class pages extends CI_Controller{
//订单详情页面
public function order(){
- /*if($this->session->userdata('dingname') == '' && $this->session->userdata('dingunionid') == ''){
- dingLogin();
- }*/
+ if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
+ redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
+ }
$ordernumber = $order=$this->input->get("order");
if(empty($ordernumber)){
@@ -159,9 +161,9 @@ class pages extends CI_Controller{
//退票页面
public function refund(){
- /*if($this->session->userdata('dingname') == '' && $this->session->userdata('dingunionid') == ''){
- dingLogin();
- }*/
+ if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
+ redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
+ }
$ordernumber = $order=$this->input->get("order");
if(empty($ordernumber)){
@@ -198,9 +200,9 @@ class pages extends CI_Controller{
}
public function export(){
- /*if($this->session->userdata('dingname') == '' && $this->session->userdata('dingunionid') == ''){
- dingLogin();
- }*/
+ if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
+ redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
+ }
$this->load->view('header');
$this->load->view('export');
$this->load->view('footer');
diff --git a/application/third_party/trainsystem/helpers/train_helper.php b/application/third_party/trainsystem/helpers/train_helper.php
index d79db5e6..99e2914a 100644
--- a/application/third_party/trainsystem/helpers/train_helper.php
+++ b/application/third_party/trainsystem/helpers/train_helper.php
@@ -74,16 +74,4 @@ function GetPost_http($url, $data = '',$format='') {
return $tmpInfo; //
}
-function getDingSignature(){
- $timestamp = time();
- $signature = hash_hmac('sha256',$timestamp,'emCK5vYFJc-HtMNNgbyGpmbYaNyPkNXn_ayoFd6q2m6rpljhxBn2JQEx9gy8H6DQ',true);
- $signature = base64_encode($signature);
- return $signature;
-}
-
-function dingLogin(){
- redirect('https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoaystremzlahfew1tb&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/info.php/apps/trainsystem/api/check_login');
-}
-
-
?>
\ No newline at end of file
diff --git a/test122.php b/test122.php
new file mode 100644
index 00000000..dfa50f78
--- /dev/null
+++ b/test122.php
@@ -0,0 +1,205 @@
+Group_model->get_plan_not_received(1, $GRI_SN, $vendor_str, $start_date, $end_date);
-// log_message('error',var_export($ready_to_send, 1));
if (empty($ready_to_send)) {
return $this->output->set_output("empty");
}
@@ -54,6 +52,7 @@ class Index extends CI_Controller {
public function verify_user()
{
+ return false;
$open_id = $this->input->post('openId');
$open_key = $this->input->post('key');
$match = $this->UserAuth_model->if_user_key($open_id, $open_key, 1);
@@ -82,6 +81,10 @@ class Index extends CI_Controller {
{
$input = $this->input->post();
log_message('error',"Call [Tulanduo>uploadOperation]: " . json_encode($input));
+ $ret['status'] = 1;
+ $ret['errMsg'] = "";
+ return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
+ ;
$ret['status'] = -1;
$ret['errMsg'] = "未知错误";
$user_verify = $this->verify_user();
@@ -123,6 +126,7 @@ class Index extends CI_Controller {
public function plan_confirm($input, $vps)
{
+ return false;
$ret['status'] = -1;
$ret['errMsg'] = "";
$vendor_manager = $this->Group_model->get_vendorContact($input['openId']);
@@ -160,6 +164,7 @@ class Index extends CI_Controller {
public function fill_tourguide($input, $vps)
{
+ return false;
$ret['status'] = -1;
$ret['errMsg'] = "";
$eva = $this->Group_model->get_plan_eva($vps->VAS_SN);
@@ -198,6 +203,7 @@ class Index extends CI_Controller {
public function calc_key($userId, $key)
{
+ return false;
$default = "b825e39422a54875a95752fc7ed6f5d2";
$ret = md5(hash("sha256", $userId.$default));
return $ret;
diff --git a/webht/third_party/vendorPlanSync/libraries/Tulanduo.php b/webht/third_party/vendorPlanSync/libraries/Tulanduo.php
index 08fe8ddd..fff3a8e5 100644
--- a/webht/third_party/vendorPlanSync/libraries/Tulanduo.php
+++ b/webht/third_party/vendorPlanSync/libraries/Tulanduo.php
@@ -54,6 +54,9 @@ class Tulanduo
public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/";
public $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/";
+ private $tulanduo_trippest_pag = array();
+ private $tulanduo_trippest_code = array();
+
public function __construct(){
$this->ci =& get_instance();
mb_regex_encoding("UTF-8");
@@ -72,6 +75,11 @@ class Tulanduo
public function order_push($order=null)
{
+ // 初始化所有Trippest合作项目的包价产品
+ $this->tulanduo_trippest_pag = $this->ci->BIZ_order->get_packageDetails('', implode(',', $this->vendor_ids));
+ $this->tulanduo_trippest_code = array_map(function($ele){return mb_strtoupper($ele->PAG_Code);}, $this->tulanduo_trippest_pag);
+ $this->tulanduo_trippest_pag = array_combine($this->tulanduo_trippest_code, $this->tulanduo_trippest_pag);
+
// 目的地计划
if (strval($order->GRI_OrderType) === "227002" && strval($order->department) === "30") {
return $this->push_trippest($order);
@@ -79,12 +87,12 @@ class Tulanduo
// 商务
if (strval($order->GRI_OrderType) === "227002") {
return false; // for Trippest deploy
- return $this->push_tour($order);
+ return $this->push_biz($order, strval($order->GRI_OrderType));
}
// 传统订单
if (strval($order->GRI_OrderType) === "227001") {
return false; // for Trippest deploy
- return $this->push_tour($order);
+ return $this->push_tour($order, strval($order->GRI_OrderType));
}
return "[Tulanduo>order_push] No function match. ";
@@ -92,147 +100,283 @@ class Tulanduo
/*!
* 发送线路订单计划
- * @date 2018-11-22
*/
- public function push_tour($vas=null)
+ public function push_tour($vas=null, $gri_ordertype='227001')
{
return false; // for Trippest deploy
- $userId = $this->send_host["1"]["userId"];
- $userKey = $this->send_host["1"]["key"];
$gri_sn = $vas->GRI_SN;
$vas_sn = $vas->VAS_SN;
$vei_sn = $vas->VAS_VEI_SN;
- $is_send_vary = $vas->VAS_SendVary;
- $change_info = $vas->VAS_ChangeText;
- if (trim($change_info) !== "") {
- preg_match_all('/(.*)={6}(.*)(\d{4}\-\d{2}\-\d{2})/ismU', characet($change_info,'UTF-8'), $change_arr);
- $change_info = $change_arr[0][0];
- }
- $change_info = str_replace("\n", "
", $change_info);
$grd_info = $this->ci->Group_model->get_vendor_plan_info($gri_sn, $vei_sn);
if (empty($grd_info)) {
+ $this->ci->Group_model->set_plan_received($vas_sn);
return false;
}
- $all_day_no = array_map(function($ele){return $ele->GRD_DayNo;}, $grd_info);
- $arrange_info = $this->ci->Group_model->get_arrange_info($gri_sn, $vei_sn);
- $routeName = "中华游" . $arrange_info[0]->tocity . "线路"; // TODO 线路名称
- $routeType = "桂林海纳国旅"; // TODO 线路类型
- $agcOrderNo = $vas->GRI_Name . "-" . $arrange_info[0]->citycode;
- $agcOrderNo .= "(" . $vas->operator . ")";
- $first_date = $grd_info[0]->day_no_raw;
- $last_date = count($grd_info)-1;
- $end_date = $grd_info[$last_date]->day_no_raw;
- $request_info = $this->ci->Group_model->get_plan_request($gri_sn);
- $order_type = 1;
- $this->ci->tldOrderBuilder->setUserId($userId)
- ->setKey($userKey)
- ->setOrderType($order_type)
- ->setRouteName($routeName)
- ->setRouteType($routeType)
- ->setAgcOrderNo($agcOrderNo)
- ->setAdultNum(intval($arrange_info[0]->ACI_PersonNum))
- ->setChildNum(intval(bcadd($arrange_info[0]->ACI_ChildNum, $arrange_info[0]->ACI_BabyNum)))
- ->setDestination($arrange_info[0]->tocity)
- ->setTravelDate($first_date)
- ->setLeavedDate($end_date)
- // ->setOrderRemark($order_remark) // 订单备注 TODO
- ->setRoomStandard($request_info->GCI_HotelRequest) // 住房标准
- ->setRouteStandard($request_info->GCI_Request) // 行程服务标准
- ;
$guestlist = $this->ci->orders_model->get_customer_list($gri_sn);
- foreach ($guestlist as $key => $vg) {
- $this->ci->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
- ->setCustomersPeopleType($key, (calc_age_type($vg->BirthDay)==1 ? "成人" : "儿童"))
- ->setCustomersDocumentType($key, "护照") // Passport No.
- ->setCustomersDocumentNo($key, $vg->PassportNo)
- ->setCustomersOtherInfo($key, $vg->Country);
+ $request_info = $this->ci->Group_model->get_plan_request($vas->GRI_SN);
+ /**
+ * TODO:团队类型? 先写2
+ * ??是否同一天含多个包价项目
+ */
+ /*!
+ // 同一天含多个包价产品时, 需要先合并.避免丢失
+ $all_trippest_package = array_filter(array_map(function ($ele){return $ele->pag_code_arr;}, $grd_info));
+ $reduce_package_code = array();
+ foreach ($all_trippest_package as $ktp => $vtp) {
+ $reduce_package_code = array_merge($reduce_package_code, $vtp);
}
- // $travel_fee = 0;
- // foreach ($arrange_info as $kaci => $vaci) {
- // $travel_fee = bcadd($travel_fee, $vaci->ACI_Amount);
- // }
- // // TODO 是否需要travelFee
- // $this->ci->tldOrderBuilder->setTravelFeesType(0, "Per Group")
- // ->setTravelFeesMoney(0, $travel_fee)
- // ->setTravelFeesNum(0, 1)
- // ->setTravelFeesUnit(0, 1)
- // ->setTravelFeesSumMoney(0, $travel_fee)
- // ->setTravelFeesRemark(0, "");
- // 补全空的日期,行程为空
- $date1 = new DateTime($first_date);
- $date_end = new DateTime($end_date);
- $date_diff = $date_end->diff($date1);
- $d = ($date_diff->format("%a"));
- $all_date = array();
- for ($j=0; $j < ($d+1); $j++) {
- $all_date[] = date('Y-m-d', strtotime("+$j day", strtotime($first_date)));
+ $reduce_package_code = array_filter($reduce_package_code);
+ */
+ $grd_apart_info = $this->tour_apart($grd_info);
+ $big_order_index = 0;
+ $expect_order_cnt = count($grd_apart_info['com'])+intval(!empty($grd_apart_info['big_pvt']))+intval(!empty($grd_apart_info['pvt']));
+// echo json_encode($grd_info);exit;
+ foreach ($grd_apart_info as $group_key => $grd_a) {
+ $big_order_index = $this->tour_apart_order_exec($group_key, $vas, $request_info, $guestlist, $grd_a, $big_order_index);
}
- $real_date = array_map(function ($ele){return $ele->day_no_raw;}, $grd_info);
- foreach ($all_date as $kd => $vd) {
- if ( ! in_array($vd, $real_date)) {
- $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
- ->setScheduleDetailsContent($kd, "无")
- ->setScheduleDetailsAccommodation($kd, "")
- // ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
- ->setScheduleDetailsBreakFirst($kd, 0 )
- ->setScheduleDetailsDinner($kd, 0)
- ->setScheduleDetailsLunch($kd, 0)
- ;
- continue;
+ if ($big_order_index === $expect_order_cnt) {
+ /** VendorArrangeState VAS_IsReceive */
+ $this->ci->Group_model->set_plan_received($vas_sn);
+ }
+ return "[Tulanduo>push_tour] Done. ";
+ }
+
+ /*!
+ * @Author: LYT
+ * @Date: 2019-05-30 16:11:34
+ * @Desc: 执行发送订单计划信息. 参数已拆分归类好的行程
+ */
+ public function tour_apart_order_exec($group_type, $vas, $request_info, $guestlist, $grd, $total_order_index)
+ {
+ if (empty($grd)) {
+ return $total_order_index;
+ }
+ $userId = $this->send_host["1"]["userId"];
+ $userKey = $this->send_host["1"]["key"];
+ switch ($group_type) {
+ case 'big_pvt':
+ $total_order_index ++;
+ $all_grd = array($grd);
+ $routeName = "中华游" . $grd['details'][0]->tocity . "常规线路";
+ $routeType = $routeName;
+ $agcOrderNo = $vas->GRI_Name . "-" . $grd['details'][0]->citycode . "-" . $total_order_index;
+ $agcOrderNo .= "(" . $vas->operator . ")";
+ $order_type = 1;
+ break;
+ case 'pvt':
+ $total_order_index ++;
+ $all_grd = array($grd);
+ $routeName = empty($grd['details'][0]->GRD_Landscape) ? $grd['details'][0]->PAG_Title : $grd['details'][0]->GRD_Landscape;
+ $routeName .= "(" . $grd['details'][0]->PAG_Code . ")";
+ $routeType = $grd['details'][0]->tocity . "目的地线路";
+ $agcOrderNo = $vas->GRI_Name . "-" . $grd['details'][0]->citycode . "-" . $total_order_index;
+ $agcOrderNo .= "(" . $vas->operator . ")";
+ $order_type = 1;
+ break;
+ case 'com':
+ default:
+ $all_grd = ($grd);
+ $order_type = 2;
+ break;
+ }
+ foreach ($all_grd as $ko => $vo) {
+ if ($order_type === 2) {
+ $total_order_index ++;
+ $routeName = $vo['PAG_Name'];
+ if (empty($routeName)) {
+ $routeName = $vo['details'][0]->GRD_Landscape . "(" . $vo['details'][0]->PAG_Code . ")";
+ }
+ $routeType = $vo['details'][0]->tocity . "目的地线路";
+ $agcOrderNo = $vas->GRI_Name . "-" . $vo['details'][0]->citycode . "-" . $total_order_index;
+ $agcOrderNo .= "(" . $vas->operator . ")";
}
- foreach ($grd_info as $kgrd => $vgrd) {
- if ($vd==$vgrd->day_no_raw) {
- $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, $vgrd->GRD_OrderDate)
- ->setScheduleDetailsContent($kd, $vgrd->GRD_Landscape)
- ->setScheduleDetailsAccommodation($kd, $vgrd->GRD_Hotel)
- ->setScheduleDetailsTraffic($kd, ($vgrd->GRD_Traffic))
- ->setScheduleDetailsBreakFirst($kd, 0 )
- ->setScheduleDetailsDinner($kd, (trim($vgrd->GRD_Meal_S)==="" ? 0 : 1 ))
- ->setScheduleDetailsLunch($kd, (trim($vgrd->GRD_Meal_L)==="" ? 0 : 1 ))
- ;
+ $first_date = $vo['details'][0]->day_no_raw;
+ $last_date = COUNT($vo['details'])-1;
+ $end_date = $vo['details'][$last_date]->day_no_raw;
+ $this->ci->tldOrderBuilder->resetBizContent();
+ $this->ci->tldOrderBuilder->setUserId($userId)
+ ->setKey($userKey)
+ ->setOrderType($order_type)
+ ->setRouteName($routeName)
+ ->setRouteType($routeType)
+ ->setAgcOrderNo($agcOrderNo)
+ ->setAdultNum(intval($vo['details'][0]->ACI_PersonNum))
+ ->setChildNum(intval(bcadd($vo['details'][0]->ACI_ChildNum, $vo['details'][0]->ACI_BabyNum)))
+ ->setDestination($vo['details'][0]->tocity)
+ ->setTravelDate($first_date)
+ ->setLeavedDate($end_date)
+ // ->setOrderRemark($order_remark) // 订单备注 TODO:
+ // ->setRoomStandard($request_info->GCI_HotelRequest) // 住房标准
+ ->setRouteStandard($request_info->GCI_Request) // 行程服务标准
+ ;
+ foreach ($guestlist as $key => $vg) {
+ $this->ci->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
+ ->setCustomersPeopleType($key, (calc_age_type($vg->BirthDay)==1 ? "成人" : "儿童"))
+ ->setCustomersDocumentType($key, "护照") // Passport No.
+ ->setCustomersDocumentNo($key, $vg->PassportNo)
+ ->setCustomersOtherInfo($key, $vg->Country . "; " . $vg->phone);
+ }
+ // 补全空的日期,行程为空
+ $date1 = new DateTime($first_date);
+ $date_end = new DateTime($end_date);
+ $date_diff = $date_end->diff($date1);
+ $d = ($date_diff->format("%a"));
+ $all_date = array();
+ for ($j=0; $j < ($d+1); $j++) {
+ $all_date[] = date('Y-m-d', strtotime("+$j day", strtotime($first_date)));
+ }
+ $real_date = array_map(function ($ele){return $ele->day_no_raw;}, $vo['details']);
+ foreach ($all_date as $kd => $vd) {
+ if ( ! in_array($vd, $real_date)) {
+ $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
+ ->setScheduleDetailsContent($kd, "无")
+ ->setScheduleDetailsAccommodation($kd, "")
+ // ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
+ ->setScheduleDetailsBreakFirst($kd, 0 )
+ ->setScheduleDetailsDinner($kd, 0)
+ ->setScheduleDetailsLunch($kd, 0)
+ ;
+ continue;
+ }
+ foreach ($vo['details'] as $kgrd => $vgrd) {
+ if ($vd==$vgrd->day_no_raw) {
+ $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, $vgrd->GRD_OrderDate)
+ ->setScheduleDetailsContent($kd,
+ $vgrd->GRD_LeaveCity . "-" . $vgrd->GRD_ServiceCity . "\r\n" .
+ $vgrd->GRD_Landscape . "\r\n" . $vgrd->GRD_Traffic)
+ ->setScheduleDetailsAccommodation($kd, $vgrd->GRD_Hotel)
+ ->setScheduleDetailsTraffic($kd, ($vgrd->GRD_Traffic))
+ ->setScheduleDetailsBreakFirst($kd, 0 )
+ ->setScheduleDetailsDinner($kd, (trim($vgrd->GRD_Meal_S)==="" ? 0 : 1 ))
+ ->setScheduleDetailsLunch($kd, (trim($vgrd->GRD_Meal_L)==="" ? 0 : 1 ))
+ ;
+ }
}
}
- }
- // 查询是否变更 TODO deprecated
- $sync_orderstate = 10;
- $vps_sn = 0;
- $vendor_orderid = 0;
- $this->ci->tldOrderBuilder->clearModifyLogInfo();
- // $resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
- $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
+ // 查询是否变更 TODO: deprecated at 2019-05
+ $sync_orderstate = 10;
+ $this->ci->tldOrderBuilder->clearModifyLogInfo();
+ $resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
+ // $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test:
echo $this->ci->tldOrderBuilder->getBizContent();
log_message('error',$resp);
- $response = json_decode($resp);
- if ($response->status == 1) {
- /** VendorPlanSync */
- $sync_ret = array(
- "VPS_VAS_SN" => $vas_sn
- ,"VPS_GRI_SN" => $gri_sn
- ,"VPS_VEI_SN" => $vei_sn
- ,"VPS_startDate" => $first_date
- ,"VPS_endDate" => $end_date
- ,"VPS_sendHost" => $userId
- ,"VPS_externalId" => $response->responseData->orderId
- ,"VPS_externalorderType" => $order_type
- ,"VPS_externalorderState" => $sync_orderstate
- ,"VPS_sendTime" => date('Y-m-d H:i:s')
- );
- if ($vps_sn === 0) {
+ $response = json_decode($resp);
+ if ($response->status == 1) {
+ /** VendorPlanSync */
+ $sync_ret = array(
+ "VPS_VAS_SN" => $vas->VAS_SN
+ ,"VPS_GRI_SN" => $vas->GRI_SN
+ ,"VPS_VEI_SN" => $vas->VAS_VEI_SN
+ ,"VPS_startDate" => $first_date
+ ,"VPS_endDate" => $end_date
+ ,"VPS_sendHost" => $userId
+ ,"VPS_externalId" => $response->responseData->orderId
+ ,"VPS_externalorderType" => $order_type
+ ,"VPS_externalorderState" => $sync_orderstate
+ ,"VPS_sendTime" => date('Y-m-d H:i:s')
+ );
$sync_id = $this->ci->Group_model->insert_VendorPlanSync($sync_ret);
+ }
+ }
+ return $total_order_index;
+ }
+
+ /*!
+ * @Author: LYT
+ * @Date: 2019-05-29 14:54:17
+ * @Desc: 线路订单计划拆分.
+ * 合并同样的行程
+ * 根据行程类型拆分
+ * @return $ret = array(
+ * 'big_pvt'=>array(), // 不是合作项目的产品
+ * 'pvt'=>array(), // 合作项目中的pvt
+ * 'com'=>array( // 合作项目中的拼团
+ * 'details' => [],'PAG_Code'=> 'XXX'
+ * )
+ * )
+ */
+ public function tour_apart($all_pag_info)
+ {
+ $apart = array(); $ret = array();
+ foreach ($all_pag_info as $key => $pag) {
+ // CH下的产品编号修正
+ if (intval($pag->PAG_DEI_SN)===1 && ! empty($pag->PAG_Code)) {
+ $pag->PAG_Code = $this->ci->trippest->ch_code_transfer( mb_strtoupper($pag->PAG_Code));
+ $pag->PAG_ExtendType = $this->tulanduo_trippest_pag[$pag->PAG_Code]->PAG_ExtendType;
+ }
+ if (empty($pag->PAG_Code)) // 已在grd查询中增加是否目的地产品的判断
+ {
+ $apart['big_pvt']['details'][] = $pag;
+ continue;
+ }
+ if (empty($pag->PAG_Title) ) {
+ $pag->PAG_Title = $this->tulanduo_trippest_pag[$pag->PAG_Code]->PAG_Title;
+ }
+ // 合作的产品
+ if ($this->ci->trippest->if_tour_pvt(array($pag))===1) {
+ $apart["pvt"]['details'][] = $pag;
} else {
- $update = $this->ci->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
+ $apart["com"]['details'][$pag->PAG_Code][] = $pag;
}
- /** VendorArrangeState VAS_IsReceive */
+ }
+ $apart_com = array();
+ if ( ! empty($apart['com'])) {
+ $all_com_pag = array_keys($apart['com']['details']);
+ $full_pag = array();
+ $process_pag = array();
+ foreach ($all_com_pag as $kp => $vp) {
+ $apart_com[$vp]['details'] = array();
+ $this_include_pags = $this->ci->trippest->tour_code($vp);
+ if( isset($this->ci->trippest->special_route[$vp]) ) {
+ $full_pag = array_diff($this_include_pags, array_merge($full_pag,$process_pag));
+ foreach ($this_include_pags as $vi) {
+ if ($vi !== $vp) {
+ unset($apart_com[$vi]);
+ }
+ // $apart_com[$vp]['details'][] = $apart['com']['details'][$vi];
+ $apart_com[$vp]['details'] = array_merge($apart_com[$vp]['details'], $apart['com']['details'][$vi]);
+ $apart_com[$vp]['PAG_Code'] = $vp;
+ $apart_com[$vp]['PAG_Name'] = $this->ci->trippest->special_route[$vp]['name'];
+ }
+ } else {
+ $full_pag = array_merge($full_pag, $this_include_pags);
+ // $apart_com[$vp]['details'][] = $apart['com']['details'][$vp];
+ $apart_com[$vp]['details'] = array_merge($apart_com[$vp]['details'], $apart['com']['details'][$vp]);
+ $apart_com[$vp]['PAG_Code'] = $vp;
+ $apart_com[$vp]['PAG_Name'] = "";
+ }
+ $process_pag[] = $vp;
+ $this_include_pags = array();
+ }
+ }
+ $ret['big_pvt'] = empty($apart['big_pvt']) ? null : $apart['big_pvt'];
+ $ret['pvt'] = empty($apart['pvt']['details']) ? null : ($apart['pvt']);
+ $ret['com'] = array_values($apart_com);
+ return $ret;
+ }
+
+ /*!
+ * @Author: LYT
+ * @Date: 2019-06-04 11:47:38
+ * @Desc: 发送商务订单计划
+ */
+ public function push_biz($vas=null, $gri_ordertype='227002')
+ {
+ $gri_sn = $vas->GRI_SN;
+ $vas_sn = $vas->VAS_SN;
+ $vei_sn = $vas->VAS_VEI_SN;
+ $grd_info = $this->ci->Group_model->get_vendor_plan_info($gri_sn, $vei_sn);
+ if (empty($grd_info)) {
$this->ci->Group_model->set_plan_received($vas_sn);
+ return false;
}
- // return $this->ci->tldOrderBuilder->getBizContent() . "[Tulanduo>push_tour] Done. ";
- return "[Tulanduo>push_tour] Done. ";
+ $COLD_SN_str = implode(',', array_map( function($element){return $element->GRD_COLD_SN;}, $grd_info )) ;
+ $all_colds = $this->ci->BIZ_order->get_all_cold($COLD_SN_str);
+ return false;
}
/*!
* 发送目的地项目组预订计划到图兰朵地接系统
- * 地接社未接收的或有变更的
- * @date 2018-10-26
*/
public function push_trippest($vas=null)
{
@@ -243,13 +387,6 @@ log_message('error',$resp);
$gri_sn = $vas->GRI_SN;
$vas_sn = $vas->VAS_SN;
$vei_sn = $vas->VAS_VEI_SN;
- $is_send_vary = $vas->VAS_SendVary;
- $change_info = $vas->VAS_ChangeText;
- if (trim($change_info) !== "") {
- preg_match_all('/(.*)={6}(.*)(\d{4}\-\d{2}\-\d{2})/ismU', characet($change_info,'UTF-8'), $change_arr);
- $change_info = $change_arr[0][0];
- }
- $change_info = str_replace("\n", "
", $change_info);
$vei_sn_str = implode(",", $this->vendor_ids);
$orderinfo = $this->ci->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";}
@@ -321,8 +458,7 @@ log_message('error',$resp);
$this->ci->tldOrderBuilder->resetBizContent();
$order_type = $set_pvt;
if ($set_pvt==='0') {
- $code_type_arr = array_map(function($pag) { return intval($pag->PAG_ExtendType); }, $vf["package_info"]);
- $order_type = in_array(39009, $code_type_arr) ? 1 : 2;
+ $order_type = $this->ci->trippest->if_tour_pvt($vf["package_info"]);
}
$last_code = count($vf["package_info"])-1;
$last_date = count($vf["cold"])-1;
@@ -361,7 +497,7 @@ log_message('error',$resp);
->setTravelDate(strstr($vf["cold"][0]->COLD_StartDate, " ", true))
->setLeavedDate($end_date)
->setOrderRemark($order_remark)
- // todo 抵离交通
+ // todo: 抵离交通
// ->setToTraffic($toTraffic)
// ->setBackTraffic($backTraffic)
;
@@ -408,8 +544,17 @@ log_message('error',$resp);
if (trim($hotels[0]->POI_HotelAddress) != "") {
$this_content .= "\r\n酒店地址:" . $hotels[0]->POI_HotelAddress;
}
- $this_content .= trim($hotels[0]->POI_HotelCheckInName)!=="" ? "\r\n入住人:".$hotels[0]->POI_HotelCheckInName : "";
- $this_content .= trim($hotels[0]->POI_HotelCheckIn)!=="" ? "\r\n入住日期:".$hotels[0]->POI_HotelCheckIn : "";
+ if (trim($hotels[0]->POI_Hotel) != '') {
+ $this->ci->tldOrderBuilder->setToTraffic($hotels[0]->POI_Hotel);
+ $this->ci->tldOrderBuilder->setBackTraffic($hotels[0]->POI_Hotel);
+ }
+ $checkin_name = trim($hotels[0]->POI_HotelCheckInName)!=="" ? "\r\n入住人:".$hotels[0]->POI_HotelCheckInName : "";
+ $checkin_date = trim($hotels[0]->POI_HotelCheckIn)!=="" ? "\r\n入住日期:".$hotels[0]->POI_HotelCheckIn : "";
+ $this_content .= $checkin_name;
+ $this_content .= $checkin_date;
+ if ($checkin_name!=='' || $checkin_date!=='') {
+ $this->ci->tldOrderBuilder->setRoomStandard(trim($checkin_name) . ", " . trim($checkin_date));
+ }
if ($hotels[0]->POI_FlightsNo) {
$this_content .= "\r\n航/车次:" . $hotels[0]->POI_FlightsNo;
if ($hotels[0]->POI_FromCity || $hotels[0]->POI_ToCity) {
@@ -458,7 +603,7 @@ log_message('error',$resp);
$date_s = new DateTime(strstr($vs->COLD_StartDate, " ", TRUE));
$date_e = new DateTime(strstr($vs->COLD_EndDate, " ", TRUE));
$date_d = $date_e->diff($date_s);
- $d_t = ($date_d->format("%d"));
+ $d_t = ($date_d->format("%a"));
if ($d_t > 0) {
for ($d_i=0; $d_i < ($d_t+1); $d_i++) {
$f_d = date('Y-m-d', strtotime("+$d_i day", strtotime(substr($vs->COLD_StartDate, 0, 10))));
@@ -504,20 +649,28 @@ log_message('error',$resp);
}
// 拆分的订单团款录第一个
if ($i===1) {
+ $fee_index=0;
if ( ! empty($travel_fees) ) {
- $this->ci->tldOrderBuilder->setTravelFeesType(0, "Per Group")
- ->setTravelFeesMoney(0, $travel_fees->SUM_SSJE)
- ->setTravelFeesNum(0, 1)
- ->setTravelFeesUnit(0, 1)
- ->setTravelFeesSumMoney(0, $travel_fees->SUM_SSJE);
+ $this->ci->tldOrderBuilder->setTravelFeesType($fee_index, "Per Group")
+ ->setTravelFeesMoney($fee_index, $travel_fees->SUM_SSJE)
+ ->setTravelFeesNum($fee_index, 1)
+ ->setTravelFeesUnit($fee_index, 1)
+ ->setTravelFeesSumMoney($fee_index, $travel_fees->SUM_SSJE);
+ ++$fee_index;
}
if ( ! empty($replace_collections) ) {
$this->ci->tldOrderBuilder->setReplaceCollectionsType(0, "Per Group")
->setReplaceCollectionsMoney(0, $replace_collections->SUM_SSJE)
->setReplaceCollectionsRemark(0, $replace_collections->ALL_Memo);
+ $this->ci->tldOrderBuilder->setTravelFeesType($fee_index, "Per Group")
+ ->setTravelFeesMoney($fee_index, $replace_collections->SUM_SSJE)
+ ->setTravelFeesNum($fee_index, 1)
+ ->setTravelFeesUnit($fee_index, 1)
+ ->setTravelFeesSumMoney($fee_index, $replace_collections->SUM_SSJE)
+ ->setTravelFeesRemark($fee_index, "代收; " . $replace_collections->ALL_Memo);
}
}
- // 查询是否变更 TODO deprecated
+ // 查询是否变更 TODO: deprecated
$sync_orderstate = 10;
$vps_sn = 0;
$vendor_orderid = 0;
@@ -571,7 +724,7 @@ log_message('error',$resp);
->setUserId($userId)
->setKey($userKey);
$detail_resp = $this->excute_curl($this->detail_url, $this->tld_order);
- // $detail_resp = '{"status":1,"errMsg":"","orderDetail":{"orderId":' . rand(1000,9999) . ',"operationDetails": {"guiderOperations":[{"name":"北京翟梦琪Susie","mobelPhone":"18801326155","startDate":"2017-04-25","endDate":"2017-04-25","sumMoney":400,"remark":"","guiderPhoto":"http://djb3c.ltsoftware.net:9921/projects/djb3c//uploadImages/guider/1526898234415.png"}]}}}'; // test
+ // $detail_resp = '{"status":1,"errMsg":"","orderDetail":{"orderId":' . rand(1000,9999) . ',"operationDetails": {"guiderOperations":[{"name":"北京翟梦琪Susie","mobelPhone":"18801326155","startDate":"2017-04-25","endDate":"2017-04-25","sumMoney":400,"remark":"","guiderPhoto":"http://djb3c.ltsoftware.net:9921/projects/djb3c//uploadImages/guider/1526898234415.png"}]}}}'; // test:
$detail_jsonResp = json_decode($detail_resp);
// 判断
if ($detail_jsonResp->status !== 1) {
@@ -640,7 +793,7 @@ log_message('error',$resp);
$ret['errMsg'] = "身份验证失败.";
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
- // $vendorID = 29188;//29188 1343; // test
+ // $vendorID = 29188;//29188 1343; // test:
$vas_info = array();
if (in_array($input['agcName'], array("D目的地桂林组", "Trippest"))) {
$vas_info = $this->BIZ_order->get_vendorarrangestate_byVendor($input['orderId'], $vendorID);
@@ -693,7 +846,6 @@ log_message('error',$resp);
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
-
private function excute_curl($url, $content_builder)
{
$ch = curl_init();
diff --git a/webht/third_party/vendorPlanSync/libraries/trippest.php b/webht/third_party/vendorPlanSync/libraries/trippest.php
index ebba5748..876ba2cd 100644
--- a/webht/third_party/vendorPlanSync/libraries/trippest.php
+++ b/webht/third_party/vendorPlanSync/libraries/trippest.php
@@ -56,6 +56,58 @@ class Trippest
return $ret;
}
+ public function ch_code_transfer($code)
+ {
+ $trippest_code = $code;
+ switch ($code) {
+ case 'SHALC-6':
+ case 'SHALC-7':
+ case 'SHALC-8':
+ case 'SHALC-9':
+ $trippest_code = "SHSIC-45";
+ break;
+ case 'SHSIC-31':
+ $trippest_code = "SHSIC-41";
+ break;
+ case 'SHSIC-32':
+ $trippest_code = "SHSIC-42";
+ break;
+ case 'SHSIC-33':
+ $trippest_code = "SHSIC-43";
+ break;
+
+ default:
+ break;
+ }
+ return $trippest_code;
+ }
+
+ /*!
+ * @Author: LYT
+ * @Date: 2019-05-28 15:17:11
+ * @Desc: 判断产品是否需要发送PVT计划
+ * @param $all_pag_info = array((pag.*),(pag.*))
+ * @return 1-pvt;2-combine
+ */
+ public function if_tour_pvt($all_pag_info)
+ {
+ $tour_pvt_arr = array_filter(array_map(function($pag) {
+ if(intval($pag->PAG_ExtendType)===39009)
+ {
+ return 1;
+ } else if (stripos($pag->PAG_Title,"PVT") !== false) {
+ return 1;
+ } else if (stripos($pag->PAG_Title,"private") !== false) {
+ return 1;
+ } else {
+ return null;
+ }
+ }, $all_pag_info));
+ $order_type = empty($tour_pvt_arr) ? 2 : 1;
+ return $order_type;
+ }
+
+
}
diff --git a/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php b/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php
index 50307ec4..ada71877 100644
--- a/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php
+++ b/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php
@@ -9,27 +9,6 @@ class BIZ_Orders_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
- //读取默认配置
- $this->COLI_WebCode = $this->config->item('Site_Code');
- $this->COLI_Area = $this->config->item('Site_Area');
- $this->COLI_CustomerType = $this->config->item('Site_DepartmentID');
- $this->COLI_department = $this->config->item('Site_Department');
- $this->COLI_Currency = $this->config->item('Site_Currency');
- $this->COLI_InterestRate = $this->config->item('Site_InterestRate');
- $this->COLI_TrueCardRate = $this->config->item('Site_TrueCardRate');
- $this->COLI_TouristLGC = $this->config->item('Site_ServiceLGC');
- $this->COLI_OrderStartDate = null;
- $this->COLI_Keywords = NULL;
- switch ($this->check_device()) {
- case 'mobile':
- $this->COLI_OrderSource = '62003';
- break;
- case 'tablet':
- $this->COLI_OrderSource = '62002';
- break;
- default:
- $this->COLI_OrderSource = '62001';
- }
}
public function get_orderinfo_detail($gri_sn, $vei_sn_str)
@@ -85,14 +64,18 @@ class BIZ_Orders_model extends CI_Model {
return $query->result();
}
/** 根据线路代号 */
- public function get_packageDetails($pag_code_str)
+ public function get_packageDetails($pag_code_str='', $vei_sn_str='')
{
+ $code_sql = $pag_code_str=='' ? " " : " and pag.PAG_Code IN ($pag_code_str) ";
+ $vei_sql = $vei_sn_str=='' ? " " : " and pag.PAG_DefaultVEI_SN IN ($vei_sn_str) ";
$sql = "SELECT *,
(select CII2_name from CItyInfo2 where CII2_CII_SN=PAG_CII_SN and CII2_LGC=2) as city_chinese,
(select CII_PKCode from CItyInfo where CII_SN=PAG_CII_SN) as city_code
FROM BIZ_PackageInfo2 pag2
INNER JOIN BIZ_PackageInfo pag ON pag.PAG_SN=pag2.PAG2_PAG_SN and pag2.PAG2_LGC=2 and pag.PAG_DEI_SN=30
- WHERE pag.PAG_Code IN ($pag_code_str)
+ WHERE 1=1
+ $code_sql
+ $vei_sql
order by pag.PAG_Code ";
$query = $this->HT->query($sql);
return $query->result();
@@ -132,78 +115,6 @@ class BIZ_Orders_model extends CI_Model {
return $query->result();
}
- public function get_groupCodeList($GroupCodeList_str)
- {
- $sql = "SELECT GRI_No
- FROM GRoupInfo gri
- INNER JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gri.GRI_SN
- WHERE gri.GRI_No IN ($GroupCodeList_str)";
- $query = $this->HT->query($sql);
- return $query->result();
- }
-
- public function get_packageSN($pag_code)
- {
- $sql = "SELECT top 1 PAG2_SN,PAG_CII_SN,PAG2_PAG_SN
- FROM BIZ_PackageInfo2 pag2
- INNER JOIN BIZ_PackageInfo pag ON pag.PAG_SN=pag2.PAG2_PAG_SN
- WHERE pag.PAG_Code = '$pag_code' and pag2.PAG2_LGC=2 and pag.PAG_DEI_SN=30
- ";
- $query = $this->HT->query($sql);
- if ($query->row()) {
- return $query->row();
- }
- return NULL;
- }
-
- /*!
- * 需要更新调度信息的订单 -- 商务表
- * @param integer $coli_sn [description]
- * @param [type] $startDate [description]
- * @param [type] $endDate [description]
- */
- public function get_groupCombineInfo($coli_sn=0, $get_vendorID=null, $startDate=null, $endDate=NULL)
- {
- $sql = "SELECT top 1 coli.COLI_ID, coli.COLI_SN, coli.COLI_GRI_SN, cold.COLD_SN, coli.COLI_OrderDetailText, coli.COLI_Memo,coli.COLI_State,coli.COLI_OPI_ID,
- cold.COLD_PlanVEI_SN, gci.*,'0' as 'isHistory'
- FROM GroupCombineInfo gci
- LEFT JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN --and coli.COLI_State NOT IN ('30','40','50')
- LEFT JOIN BIZ_ConfirmLineDetail cold ON cold.COLD_COLI_SN=coli.COLI_SN
- WHERE 1=1 ";
- if ($coli_sn !== 0) {
- $sql .= " and coli.COLI_SN='$coli_sn' ";
- }
- if ($get_vendorID !== null) {
- $sql .= " and GCI_VendorOrderId='$get_vendorID' ";
- }
- if ($startDate !== NULL) {
- $sql .= " and gci.GCI_travelDate between '$startDate' and '$endDate' and gci.GCI_createTime < '" . date('Y-m-d') . "' ";
- }
- // 近期的订单同步完成之后, 同步历史数据
- $sql .= " UNION ALL ";
- $sql .= " SELECT top 1 coli.COLI_ID, coli.COLI_SN, coli.COLI_GRI_SN, cold.COLD_SN, coli.COLI_OrderDetailText, coli.COLI_Memo,coli.COLI_State,coli.COLI_OPI_ID,
- cold.COLD_PlanVEI_SN, gci.*,'1' as 'isHistory'
- from GroupCombineInfo gci
- inner join GRoupInfo on GRI_SN=GCI_GRI_SN and GRI_No<>''
- LEFT JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN
- LEFT JOIN BIZ_ConfirmLineDetail cold ON cold.COLD_COLI_SN=coli.COLI_SN
- where
- GCI_combineNo is not null and GCI_combineNo not in ('cancel','forbidden')
- and GCI_leaveDate < '" . date('Y-m-d', strtotime("-7 days")) . "'
- and GCI_combineNo not like '%取消%'
- and not exists (
- select GCOD_SN from GroupCombineOperationDetail gcod where gcod.GCOD_GCI_combineNo=GCI_combineNo
- )
- and 0 < (
- select sum(isnull(COLD_PersonNum,0)+isnull(COLD_ChildNum,0)+isnull(COLD_BabyNum,0)) person from BIZ_ConfirmLineInfo
- inner join BIZ_ConfirmLineDetail on COLD_COLI_SN=COLI_SN
- where COLI_GRI_SN=gri_sn
- ) ";
- $sql .= " ORDER BY isHistory ASC,GCI_createTime ASC ";
- $query = $this->HT->query($sql);
- return $query->result();
- }
-
/*!
* 获取团计划信息的记录 - 根据地接社订单id
* 计划变更和订单状态确认时使用
@@ -258,350 +169,6 @@ class BIZ_Orders_model extends CI_Model {
return $query->result();
}
- /*!
- * 生成预定传真
- */
- public function sp_biz_arrange()
- {
- $sql = "SP_BIZ_Arrange ?";
- $query = $this->HT->query($sql, array($this->GRI_SN));
- return $query->result();
- }
-
- public $GRI_SN=0; // 团号
- public $GRI_No; // 团号
- public $GRI_OrderType; // 订单类型
- public $GRI_Name; // 团名
- public $GRI_PersonNum; // 人数
- public $GRI_Days; // 行程天数
- public $GRI_IsCancel=0;
- public $GRI_DeleteFlag=0;
- public $GRI_OPI_ID=0;
- public $GRI_operator=0;
- public $GRI_Creator=0;
- public $GRI_CreateDate=0;
- /** 团信息 */
- public function groupinfo_save()
- {
- $sql = "INSERT INTO GRoupInfo
- (GRI_No
- ,GRI_Name
- ,GRI_PersonNum
- ,GRI_Days
- ,GRI_IsCancel
- ,DeleteFlag
- ,GRI_OPI_ID
- ,GRI_operator
- ,GRI_Creator
- ,GRI_CreateDate
- ,GRI_OrderType)
- VALUES (N?,N?,?,?,?,?,?,?,?,GETDATE(),?)";
- $query = $this->HT->query($sql, array(
- $this->GRI_No,
- $this->GRI_Name,
- $this->GRI_PersonNum,
- $this->GRI_Days,
- $this->GRI_IsCancel,
- $this->GRI_DeleteFlag,
- $this->GRI_OPI_ID,
- $this->GRI_operator,
- $this->GRI_Creator,
- $this->GRI_OrderType
- ));
- $this->GRI_SN = $this->HT->query("select MAX(GRI_SN) as insert_id FROM GRoupInfo WHERE GRI_operator=435 AND GRI_No='" . $this->GRI_No . "'")->row('insert_id');
- return $this->GRI_SN;
- }
-
- public $GCI_SN;
- public $GCI_VEI_SN;
- public $GCI_combineNo=''; // 拼团团号
- public $GCI_GRI_SN; // 团key
- public $GCI_VendorOrderId; // 地接社系统订单id
- public $GCI_FromAgc; // 组团社来源
- public $GCI_groupType; // 组团社来源
- public $GCI_travelDate;
- public $GCI_leaveDate;
- public $GCI_createTime;
- /** 目的地订单 拼团信息 */
- public function biz_groupcombineinfo_save()
- {
- $sql = "IF NOT EXISTS(
- SELECT TOP 1 1
- FROM GroupCombineInfo
- WHERE GCI_VendorOrderId = ? and GCI_GRI_SN=? and GCI_VEI_SN=?
- )
- INSERT INTO GroupCombineInfo
- (GCI_combineNo
- ,GCI_GRI_SN
- ,GCI_VEI_SN
- ,GCI_VendorOrderId
- ,GCI_FromAgc
- ,GCI_groupType
- ,GCI_travelDate
- ,GCI_leaveDate
- ,GCI_createTime)
- VALUES
- (N?
- ,?
- ,?
- ,?
- ,N?
- ,?
- ,?
- ,?
- ,?)
- ";
- $query = $this->HT->query($sql, array(
- $this->GCI_VendorOrderId
- ,$this->GCI_GRI_SN
- ,$this->GCI_VEI_SN
- ,$this->GCI_combineNo
- ,$this->GCI_GRI_SN
- ,$this->GCI_VEI_SN
- ,$this->GCI_VendorOrderId
- ,$this->GCI_FromAgc
- ,$this->GCI_groupType
- ,$this->GCI_travelDate
- ,$this->GCI_leaveDate
- ,$this->GCI_createTime
- ));
- $this->GCI_SN = $this->HT->query("select MAX(GCI_SN) as insert_id FROM GroupCombineInfo WHERE GCI_combineNo='" . $this->GCI_combineNo . "'")->row('insert_id');
- return $this->GCI_SN;
- }
-
- public function biz_groupcombineoperationdetail_cut($combineNo)
- {
- $sql = "DELETE
- FROM GroupCombineOperationDetail
- WHERE GCOD_GCI_combineNo = N?";
- $query = $this->HT->query($sql, array($combineNo));
- return $query;
- }
-
- /*!
- * 暂时没用
- */
- public function combineoperation_exist($combineNo='', $operation="")
- {
- if( ! $combineNo) { return array(); }
- $sql = "SELECT TOP 1 GCOD_GCI_combineNo
- FROM GroupCombineOperationDetail
- WHERE GCOD_GCI_combineNo = N? and GCOD_operationType=?";
- $query = $this->HT->query($sql, array(
- $combineNo,$operation
- ));
- return $query->result();
- }
- public $GCOD_SN;
- public $GCOD_VEI_SN;
- public $GCOD_GCI_combineNo = '';
- public $GCOD_operationType = '';
- public $GCOD_subType = '';
- public $GCOD_title = '';
- public $GCOD_dutyName = '';
- public $GCOD_dutyTel;
- public $GCOD_dutyPhoto;
- public $GCOD_startDate;
- public $GCOD_endDate;
- public $GCOD_useNum=1;
- public $GCOD_sumMoney;
- public $GCOD_standard = '';
- public $GCOD_carLicense = '';
- public $GCOD_remark = '';
- public $GCOD_creatTime;
- public function biz_groupcombineoperationdetail_save()
- {
- // IF NOT EXISTS(
- // SELECT TOP 1 1
- // FROM GroupCombineOperationDetail
- // WHERE GCOD_GCI_combineNo = N? and GCOD_operationType=N?
- // )
- $sql = "INSERT INTO GroupCombineOperationDetail
- (GCOD_GCI_combineNo
- ,GCOD_VEI_SN
- ,GCOD_operationType
- ,GCOD_subType
- ,GCOD_title
- ,GCOD_dutyName
- ,GCOD_dutyTel
- ,GCOD_dutyPhoto
- ,GCOD_startDate
- ,GCOD_endDate
- ,GCOD_useNum
- ,GCOD_sumMoney
- ,GCOD_standard
- ,GCOD_carLicense
- ,GCOD_remark
- ,GCOD_creatTime)
- VALUES
- (N?
- ,?
- ,N?
- ,N?
- ,N?
- ,N?
- ,?
- ,?
- ,?
- ,?
- ,?
- ,?
- ,N?
- ,N?
- ,N?
- ,GETDATE())
- ";
- $query = $this->HT->query($sql, array(
- $this->GCOD_GCI_combineNo
- ,$this->GCOD_VEI_SN
- ,$this->GCOD_operationType
- // ,$this->GCOD_GCI_combineNo
- // ,$this->GCOD_operationType
- ,$this->GCOD_subType
- ,$this->GCOD_title
- ,$this->GCOD_dutyName
- ,$this->GCOD_dutyTel
- ,$this->GCOD_dutyPhoto
- ,$this->GCOD_startDate
- ,$this->GCOD_endDate
- ,$this->GCOD_useNum
- ,$this->GCOD_sumMoney
- ,$this->GCOD_standard
- ,$this->GCOD_carLicense
- ,$this->GCOD_remark
- ));
- return $query;
- }
-
-
-
- var $GUT_SN;
- var $GUT_FirstName; //联系人
- var $GUT_LastName = ""; //联系人
- var $GUT_Title; //称谓
- var $GUT_Email; //主email
- var $GUT_Email2; //备用email
- var $GUT_NationalityID; //国家
- var $GUT_Passport; //护照
- var $GUT_TEL; //座机
- var $GUT_MoveTel; //手机
-
- /**
- * 商务联系人表入库
- *
- * @return int GUT_SN 插入id
- */
-
- function biz_guest_save() {
- //生成一个号码,用于MAX函数来查询插入ID时避免获得其它线程插入的值
- $AddCode = $this->MakeOrderNumber();
- $sql = "INSERT INTO BIZ_Guest \n"
- . " ( \n"
- . " GUT_FirstName, \n"
- . " GUT_LastName, \n"
- . " GUT_Title, \n"
- . " GUT_Email, \n"
- . " GUT_Email2, \n"
- . " GUT_NationalityID, \n"
- . " GUT_Passport, \n"
- . " GUT_TEL, \n"
- . " GUT_MoveTel, \n"
- . " GUT_AddCode, \n"
- . " GUT_CreateDate \n"
- . " ) \n"
- . "VALUES \n"
- . " ( \n"
- . " N?, \n"
- . " N?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " GETDATE() \n"
- . " )";
- $query = $this->HT->query($sql, array(
- mb_convert_encoding($this->GUT_FirstName, 'UTF-8'),
- mb_convert_encoding($this->GUT_LastName, 'UTF-8'),
- $this->GUT_Title,
- $this->GUT_Email,
- $this->GUT_Email2,
- $this->GUT_NationalityID,
- mb_convert_encoding($this->GUT_Passport, 'UTF-8'),
- $this->GUT_TEL,
- $this->GUT_MoveTel, $AddCode
- ));
- $this->GUT_SN = $this->HT->query('select MAX(GUT_SN) as insert_id FROM BIZ_Guest WHERE GUT_AddCode=' . $AddCode)->row('insert_id');
- return $this->GUT_SN;
- }
-
- public function get_SN_by_vendorOrderId($vendorOrderId, $vendorID)
- {
- $sql = "SELECT TOP 1 coli.COLI_GRI_SN,coli.COLI_SN,gci.GCI_SN
- FROM GroupCombineInfo gci
- INNER JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN
- WHERE gci.GCI_VendorOrderId='$vendorOrderId' and GCI_VEI_SN='$vendorID'";
- $query = $this->HT->query($sql);
- if ($query->row()) {
- $this->BIZ_COLI_SN = $query->row()->COLI_SN;
- $this->GRI_SN = $query->row()->COLI_GRI_SN;
- $this->GCI_SN = $query->row()->GCI_SN;
- return $query->row();
- }
- return NULL;
- }
-
- /*!
- * 1. 获取列表时: 按团号查询团是否已存在, 避免渠道和目的地组同时操作
- * @param [type] $code [description]
- * @param [type] $vendorOrderId [description]
- */
- public function get_SN_by_groupCode($code, $vendorOrderId=NULL)
- {
- $sql = "SELECT top 1 COLI_SN,gri.GRI_SN,cold.COLD_PlanVEI_SN,cold.COLD_SN,coli.COLI_ID,coli.COLI_Memo,coli.COLI_OrderDetailText,coli.COLI_State,coli.COLI_OPI_ID,coli.COLI_Price,coli.COLI_CUrrency
- ,GRI_OPI_ID,GRI_operator,GRI_No,GRI_Name
- FROM BIZ_ConfirmLineInfo coli
- inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN --and COLI_State not in (30,40,50)
- LEFT JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN and GRI_OrderType=227002
- and gri.GRI_operator<>435 and gri.GRI_operator is not null
- WHERE coli.COLI_Department=30 and gri.GRI_No LIKE '%$code%'
- order by COLI_SN desc"; // and gri.GRI_Name like '%$NoName%'
- $query = $this->HT->query($sql);
- if ($query->num_rows() > 0) {
- $this->BIZ_COLI_SN = $query->row()->COLI_SN;
- $this->GRI_SN = $query->row()->GRI_SN;
- $this->GRI_No = $query->row()->GRI_No;
- $this->GRI_operator = $query->row()->GRI_operator;
- $this->COLD_PlanVEI_SN = $query->row()->COLD_PlanVEI_SN;
- return $query->row();
- }
- return NULL;
- }
-
- /*!
- * 更新时:
- * @date 2018-08-23
- * @param [type] $code [description]
- */
- public function get_order_by_groupcode($code)
- {
- $sql = "SELECT COLI_SN,gri.GRI_SN,cold.COLD_PlanVEI_SN,cold.COLD_SN,coli.COLI_ID,
- coli.COLI_OrderDetailText,
- coli.COLI_State,coli.COLI_OPI_ID,coli.COLI_Price,coli.COLI_CUrrency
- GRI_OPI_ID,GRI_operator,GRI_No,GRI_Name,
- coli.COLI_Memo
- FROM BIZ_ConfirmLineInfo coli
- inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN
- left JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN and GRI_OrderType=227002
- WHERE coli.COLI_Department=30 and gri.GRI_No LIKE '%$code%'
- order by case COLI_OPI_ID when 435 then 1 else 0 end asc,COLI_SN desc";
- $query = $this->HT->query($sql);
- return $query->result();
- }
-
/*!
* 获取地接社接受计划的人员信息
* @param $vendorID 地接社ID
@@ -623,744 +190,6 @@ class BIZ_Orders_model extends CI_Model {
return $query->row();
}
- var $BIZ_COLI_SN;
- var $BIZ_COLI_ID;
- var $BIZ_COLI_GUT_SN; //联系人id
- var $BIZ_COLI_Area; //市场
- var $BIZ_COLI_ApplyDate = ''; //提交日期
- var $BIZ_COLI_Price; //订单总价
- var $BIZ_COLI_Cost; //总成本
- var $BIZ_COLI_Currency; //币种
- var $BIZ_COLI_TrueCardRate; //信用卡手续费
- var $BIZ_COLI_SenderIP = ''; //客人ip
- var $BIZ_COLI_WebCode = ''; //站点code
- var $BIZ_COLI_servicetype; //订单来源类型
- var $BIZ_COLI_sourcetype; //预定类型
- var $BIZ_COLI_AgencyID;
- var $BIZ_COLI_ConfirmType; //提交方式
- var $BIZ_COLI_OrderDetailText;
- var $BIZ_COLI_OriginalText='';
- var $BIZ_COLI_Memo;
- var $BIZ_COLI_GRI_SN;
- var $BIZ_COLI_GroupCode='';
- var $BIZ_COLI_PayManner;
- var $BIZ_COLI_State;
- var $BIZ_COLI_OPI_ID;
-
- /**
- * 商务订单主表入库
- * @return int BIZ_COLI_ID 插入id
- */
- function biz_confirm_save() {
- // if (empty($this->BIZ_COLI_WebCode)) {
- $this->BIZ_COLI_WebCode = '';// 来源图兰朵
- // }
- //生成一个号码,用于MAX函数来查询插入ID时避免获得其它线程插入的值
- $AddCode = $this->MakeOrderNumber();
- $sql = "INSERT INTO BIZ_ConfirmLineInfo \n"
- . "( \n"
- . " COLI_ID, \n"
- . " COLI_GUT_SN, \n"
- . " COLI_Area, \n"
- . " COLI_ApplyDate, \n"
- . " COLI_Price, \n"
- . " COLI_Cost, \n"
- . " COLI_Currency, \n"
- . " COLI_TrueCardRate, \n"
- . " COLI_AgencyID, \n"
- . " COLI_OrderDetailText, \n"
- . " COLI_SenderIP, \n"
- . " COLI_WebCode, \n"
- . " COLI_servicetype, \n"
- . " COLI_sourcetype, \n"
- . " COLI_ConfirmType, \n"
- . " COLI_State, \n"
- . " COLI_Department, \n"
- . " COLI_AddCode, \n"
- . " COLI_OrderSource, \n"
- . " COLI_Memo, \n"
- . " COLI_GRI_SN, \n"
- . " COLI_OPI_ID, \n"
- . " COLI_GroupCode, \n"
- . " COLI_PayManner, \n"
- . " COLI_OriginalText \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " N?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " N?, \n"
- . " ?, \n"
- . " N? \n"
- . ")";
- $query = $this->HT->query($sql, array(
- $this->BIZ_COLI_ID,
- $this->BIZ_COLI_GUT_SN,
- 2,
- // $this->config->item('Site_Area'),
- //date("Y-m-d H:i:s"),
- $this->BIZ_COLI_ApplyDate,
- $this->BIZ_COLI_Price,
- $this->BIZ_COLI_Cost,
- $this->config->item('Site_Currency'),
- $this->BIZ_COLI_TrueCardRate,
- $this->BIZ_COLI_AgencyID,
- $this->BIZ_COLI_OrderDetailText,
- $this->BIZ_COLI_SenderIP,
- $this->BIZ_COLI_WebCode,
- $this->BIZ_COLI_servicetype,
- $this->BIZ_COLI_sourcetype,
- $this->BIZ_COLI_ConfirmType,
- $this->BIZ_COLI_State,
- 30,// $this->config->item('Site_Department'),
- $AddCode,
- $this->COLI_OrderSource,
- $this->BIZ_COLI_Memo,
- $this->BIZ_COLI_GRI_SN,
- $this->BIZ_COLI_OPI_ID,
- $this->BIZ_COLI_GroupCode,
- $this->BIZ_COLI_PayManner,
- $this->BIZ_COLI_OriginalText
- ));
- $this->BIZ_COLI_SN = $this->HT->query('select MAX(COLI_SN) as insert_id FROM BIZ_ConfirmLineInfo WHERE COLI_AddCode=' . $AddCode)->row('insert_id');
- return $this->BIZ_COLI_SN;
- }
-
- public function update_confirmLineInfo()
- {
- $sql = "UPDATE BIZ_ConfirmLineInfo SET
- COLI_GRI_SN=?,
- COLI_GroupCode=?
- WHERE COLI_SN=?
- ";
- $query = $this->HT->query($sql, array(
- $this->BIZ_COLI_GRI_SN
- ,$this->BIZ_COLI_GroupCode
- ,$this->BIZ_COLI_SN
- ));
- return $this->query;
- }
-
- var $COLD_SN;
- var $COLD_COLI_SN; // 订单主表sn
- var $COLD_ServiceType; // 服务类型
- var $COLD_StartDate; // 产品的服务的开始日期
- var $COLD_EndDate; // 产品的服务的结束日期
- var $COLD_TotalCost; // 总成本
- var $COLD_TotalPrice; // 总报价
- var $COLD_Count; // 产品数量
- var $COLD_PersonNum; // 成人数
- var $COLD_ChildNum; // 小孩数
- var $COLD_BabyNum; // 婴儿数
- var $cold_state; // 状态
- var $DeleteFlag; // 删除标志
- var $COLD_DeliveryCharge = 0; //服务费 + 快递费用 CNY
- var $COLD_PlanVEI_SN = NULL; // 默认供应商 628-火车桂林国旅
- var $COLD_SPFS = NULL; // 快递方式:1自取 2酒店 3指定地址
- var $COLD_ServiceSN = NULL; // 产品ID 除机票外 其它自基础产品库各产品ID
- var $COLD_ServiceSN2 = NULL;
- var $COLD_ServiceCity = NULL;
- var $COLD_Memo = NULL;
- var $COLD_MemoText = NULL;
-
- /**
- * 商务订单子(详细)表入库
- *
- * @return int 插入id
- */
-
- function biz_confirm_detail_save() {
- //生成一个号码,用于MAX函数来查询插入ID时避免获得其它线程插入的值
- $AddCode = $this->MakeOrderNumber();
- $sql = "INSERT INTO BIZ_ConfirmLineDetail \n"
- . "( \n"
- . " COLD_COLI_SN, \n"
- . " COLD_ServiceType, \n"
- . " COLD_StartDate, \n"
- . " COLD_EndDate, \n"
- . " COLD_TotalCost, \n"
- . " COLD_TotalPrice, \n"
- . " COLD_Count, \n"
- . " COLD_PersonNum, \n"
- . " COLD_ChildNum, \n"
- . " COLD_BabyNum, \n"
- . " cold_state, \n"
- . " DeleteFlag, \n"
- . " COLD_DeliveryCharge, \n"
- . " COLD_AddCode, \n"
- . " COLD_PlanVEI_SN, \n"
- . " COLD_SPFS, \n"
- . " COLD_Memo, \n"
- . " COLD_MemoText, \n"
- . " COLD_ServiceSN, \n"
- . " COLD_ServiceSN2, \n"
- . " COLD_ServiceCity \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ? \n"
- . ")";
- $HT1 = $this->load->database('HT', true);
- $query = $HT1->query($sql, array(
- $this->COLD_COLI_SN,
- $this->COLD_ServiceType,
- $this->COLD_StartDate,
- $this->COLD_EndDate,
- $this->COLD_TotalCost,
- $this->COLD_TotalPrice,
- $this->COLD_Count,
- $this->COLD_PersonNum,
- $this->COLD_ChildNum,
- $this->COLD_BabyNum,
- $this->cold_state,
- $this->DeleteFlag,
- $this->COLD_DeliveryCharge,
- $AddCode,
- $this->COLD_PlanVEI_SN,
- $this->COLD_SPFS,
- $this->COLD_Memo,
- $this->COLD_MemoText,
- $this->COLD_ServiceSN,
- $this->COLD_ServiceSN2,
- $this->COLD_ServiceCity)
- );
- //查出最近插入的id
- $HT2 = $this->load->database('HT', true);
- $this->COLD_SN = $HT2->query('select MAX(COLD_SN) as insert_id FROM BIZ_ConfirmLineDetail WHERE COLD_AddCode=' . $AddCode)->row('insert_id');
- return $this->COLD_SN;
- }
-
- var $BIZ_COLL_COLI_SN;
- var $BIZ_COLL_type;
- var $BIZ_COLL_COLI_Field;
- var $BIZ_COLL_COLI_value;
- var $BIZ_COLL_OPI_SN;
-
- function biz_confirm_line_log_save()
- {
- $sql = "INSERT INTO BIZ_ConfirmLineLog (
- COLL_COLI_SN,
- COLL_LogTime,
- COLL_type,
- COLL_COLI_Field,
- COLL_COLI_value,
- COLL_OPI_SN
- ) VALUES (?,GETDATE(),?,?,?,?) ";
- $HT1 = $this->load->database('HT', true);
- $query = $HT1->query($sql, array($this->BIZ_COLL_COLI_SN,
- $this->BIZ_COLL_type,
- $this->BIZ_COLL_COLI_Field,
- $this->BIZ_COLL_COLI_value,
- $this->BIZ_COLL_OPI_SN)
- );
- return $query;
- }
-
- var $POI_SN;
- var $POI_COLD_SN;
- var $POI_FlightsNo = '';
- var $POI_AirPort = '';
- var $POI_Time;
- var $POI_Hotel = '';
- var $POI_HotelAddress = '';
- var $POI_HotelPhone = '';
- var $POI_HotelCheckInName = '';
- var $POI_HotelCheckIn = '';
- var $POI_HotelCheckOut = '';
- var $POI_EndTime = '';
- var $POI_QuotationType; // 1 报价 2 网络支付价 3 促销价
- /** 包价线路订单入库 */
- public function biz_packageorder_save()
- {
- $sql = "IF NOT EXISTS(
- SELECT TOP 1 1
- FROM BIZ_PackageOrderInfo
- WHERE POI_COLD_SN = ?
- )
- INSERT INTO BIZ_PackageOrderInfo
- (POI_COLD_SN
- ,POI_FlightsNo
- ,POI_AirPort
- ,POI_Time
- ,POI_Hotel
- ,POI_QuotationType
- ,POI_HotelAddress
- ,POI_HotelPhone
- ,POI_HotelCheckInName
- ,POI_HotelCheckIn
- ,POI_HotelCheckOut
- ,POI_EndTime)
- VALUES
- (?
- ,?
- ,N?
- ,?
- ,N?
- ,?
- ,N?
- ,N?
- ,N?
- ,N?
- ,N?
- ,N?)
- ";
- $query = $this->HT->query($sql, array(
- $this->POI_COLD_SN
- ,$this->POI_COLD_SN
- ,$this->POI_FlightsNo
- ,$this->POI_AirPort
- ,$this->POI_Time
- ,$this->POI_Hotel
- ,$this->POI_QuotationType
- ,$this->POI_HotelAddress
- ,$this->POI_HotelPhone
- ,$this->POI_HotelCheckInName
- ,$this->POI_HotelCheckIn
- ,$this->POI_HotelCheckOut
- ,$this->POI_EndTime
- ));
- $this->POI_SN = $this->HT->query('select MAX(POI_SN) as insert_id FROM BIZ_PackageOrderInfo WHERE POI_COLD_SN=' . $this->POI_COLD_SN)->row('insert_id');
- return $this->POI_SN;
- }
-
- var $FOI_SN;
- var $FOI_COLD_SN; // 订单子表sn
- var $Aircompany; // 航空公司编码
- var $FlightsNo; // 航班号
- var $Cabin; // 舱位
- var $DepartAirport; // 出发机场
- var $ArrivalAirport; // 抵达机场
- var $DepartureCity; // 出发城市
- var $DepartureTime; // 出发日期
- var $ArrivalCity; // 抵达城市
- var $Arrivaltime; // 抵达时间
- var $DepartureDate; // 出发时间
- var $adultCost; // 成人成本
- var $childCost; // 小孩成倍
- var $babyCost; // 婴儿成本
- var $adultPrice; // 成人报价
- var $childPrice; // 小孩报价
- var $babyPrice; // 婴儿报价
- var $Stopover; //
- var $PriceY; // Y仓价格
- var $price_low; // 最低价格
- var $FOI_Mile; // 里程
- var $TicketAddress; // 寄送地址
- var $FOI_CostTime = ''; // 运行时间
- var $Aircraft = ''; // 12306座位编号
- var $FOI_ServiceFee_adult = NULL; // 成人服务费
- var $FOI_ServiceFee_child = NULL; // 儿童服务费
- var $FOI_DeliveryFee = NULL; // 寄票费
- var $FOI_SelectedSeat = ""; // 选座
-
- /**
- *
- * 商务机票订单入库
- *
- */
-
- function biz_flight_order_save() {
- //生成一个号码,用于MAX函数来查询插入ID时避免获得其它线程插入的值
- $AddCode = $this->MakeOrderNumber();
- $sql = "INSERT INTO BIZ_FlightsOrderInfo \n"
- . "( \n"
- . " FOI_COLD_SN, \n"
- . " Aircompany, \n"
- . " FlightsNo, \n"
- . " Cabin, \n"
- . " DepartAirport, \n"
- . " ArrivalAirport, \n"
- . " DepartureCity, \n"
- . " DepartureTime, \n"
- . " ArrivalCity, \n"
- . " Arrivaltime, \n"
- . " DepartureDate, \n"
- . " adultCost, \n"
- . " childCost, \n"
- . " babyCost, \n"
- . " adultPrice, \n"
- . " childPrice, \n"
- . " babyPrice, \n"
- . " Stopover, \n"
- . " PriceY, \n"
- . " price_low, \n"
- . " FOI_Mile, \n"
- . " TicketAddress, \n"
- . " FOI_CostTime, \n"
- . " FOI_AddCode, \n"
- . " Aircraft, \n"
- . " FOI_ServiceFee_adult, \n"
- . " FOI_ServiceFee_child, \n"
- . " FOI_SelectedSeat, \n"
- . " FOI_DeliveryFee \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ? \n"
- . ")";
- $HT1 = $this->load->database('HT', true);
- $query = $HT1->query($sql, array($this->FOI_COLD_SN,
- $this->Aircompany,
- $this->FlightsNo,
- $this->Cabin,
- $this->DepartAirport,
- $this->ArrivalAirport,
- $this->DepartureCity,
- $this->DepartureTime,
- $this->ArrivalCity,
- $this->Arrivaltime,
- $this->DepartureDate,
- $this->adultCost,
- $this->childCost,
- $this->babyCost,
- $this->adultPrice,
- $this->childPrice,
- $this->babyPrice,
- $this->Stopover,
- $this->PriceY,
- $this->price_low,
- $this->FOI_Mile,
- $this->TicketAddress,
- $this->FOI_CostTime,
- $AddCode,
- $this->Aircraft,
- $this->FOI_ServiceFee_adult,
- $this->FOI_ServiceFee_child,
- $this->FOI_SelectedSeat,
- $this->FOI_DeliveryFee
- ));
- $this->FOI_SN = $HT1->query('select MAX(FOI_SN) as insert_id FROM BIZ_FlightsOrderInfo WHERE FOI_AddCode=' . $AddCode)->row('insert_id');
- return $this->FOI_SN;
- }
-
- /*!
- * 查询是否已经写入过客人列表
- * @date 2018-04-28
- * @param [type] $cold_sn 订单字表key
- */
- public function bookpeople_exist($cold_sn)
- {
- if( ! $cold_sn) { return array(); }
- $sql = "SELECT top 1 *
- FROM BIZ_BookPeopleList BPL
- WHERE BPL_COLD_SN=? ";
- $query = $this->HT->query($sql, array($cold_sn));
- return $query->result();
- }
-
- var $BPE_SN;
- var $BPE_FirstName; //客人
- var $BPE_MiddleName; //客人
- var $BPE_LastName; //客人
- var $BPE_GuestType; //客人类型
- var $BPE_Passport; //护照
- var $BPE_imageSrc = NULL; //护照图片
- var $BPE_Nationality; //国籍
- var $BPE_SEX; //性别
- var $BPE_BirthDate; //生日
- var $BPE_PassportType = "Passport No."; //护照类型
-
- /**
- *
- * 商务订单参团客人入库
- *
- */
-
- function biz_book_people_save() {
- //生成一个号码,用于MAX函数来查询插入ID时避免获得其它线程插入的值
- $AddCode = $this->MakeOrderNumber();
- $sql = "INSERT INTO BIZ_BookPeople \n"
- . "( \n"
- . " BPE_FirstName, \n"
- . " BPE_MiddleName, \n"
- . " BPE_LastName, \n"
- . " BPE_GuestType, \n"
- . " BPE_Passport, \n"
- . " BPE_imageSrc, \n"
- . " BPE_Nationality, \n"
- . " BPE_SEX, \n"
- . " BPE_BirthDate, \n"
- . " BPE_PassportType, \n"
- . " BPE_AddCode \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " N?, \n"
- . " N?, \n"
- . " N?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ? \n"
- . ")";
- $query = $this->HT->query($sql, array(
- mb_convert_encoding($this->BPE_FirstName, 'UTF-8'),
- mb_convert_encoding($this->BPE_MiddleName, 'UTF-8'),
- mb_convert_encoding($this->BPE_LastName, 'UTF-8'), $this->BPE_GuestType,
- mb_convert_encoding($this->BPE_Passport, 'UTF-8'), $this->BPE_imageSrc,
- $this->BPE_Nationality,
- $this->BPE_SEX, $this->BPE_BirthDate, $this->BPE_PassportType, $AddCode));
- $this->BPE_SN = $this->HT->query('select MAX(BPE_SN) as insert_id FROM BIZ_BookPeople WHERE BPE_AddCode=' . $AddCode)->row('insert_id');
- return $this->BPE_SN;
- }
-
- /**
- * 参团人关联
- *
- * @param int 商务子表sn
- * @param int 参团客人sn
- */
- function biz_bookpeople_List_save($COLD_SN, $BPE_SN) {
- $sql = "INSERT INTO BIZ_BookPeopleList \n"
- . "( \n"
- . " BPL_COLD_SN, \n"
- . " BPL_BPE_SN \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " ?, \n"
- . " ? \n"
- . ")";
- $query = $this->HT->query($sql, array($COLD_SN, $BPE_SN));
- }
-
- /*
- * 生成订单号
- * 根据系统时间生成,精确到0.0001微秒
- */
-
- function MakeOrderNumber() {
- return str_replace('.', '', sprintf('%11.4f', gettimeofday(TRUE)));
- }
-
- /**
- * 生成商务订单号
- */
- function biz_make_order_number() {
- /*
- $date = date('ymd',time());
- $sql = "SELECT MAX( \n"
- . " CONVERT( \n"
- . " INT, \n"
- . " CASE \n"
- . " WHEN ISNUMERIC(RIGHT(COLI_ID, 3)) = 0 THEN LEFT(RIGHT(COLI_ID, 4), 3) \n"
- . " ELSE RIGHT(COLI_ID, 3) \n"
- . " END \n"
- . " ) \n"
- . " ) AS SN \n"
- . "FROM dbo.BIZ_ConfirmLineInfo \n"
- . "WHERE (LEFT(COLI_ID, 6) = ?)";
- $query = $this->HT->query($sql,array($date));
- $id = $query->row()->SN;
- if (is_null($id)||empty($id))
- {
- $id = 0;
- }
- $ids = $date.(sprintf('%03d',(int)$id+1));
- return $ids;
- */
- //call $conn
- include('c:/database_conn.php');
- $connection = array(
- 'UID' => $db['HT']['username'],
- 'PWD' => $db['HT']['password'],
- 'Database' => 'tourmanager',
- 'ConnectionPooling' => 1,
- 'CharacterSet' => 'utf-8',
- 'ReturnDatesAsStrings' => 1
- );
- $conn = sqlsrv_connect($db['HT']['hostname'], $connection);
- $stmt = sqlsrv_query($conn, "declare @ccid varchar(20);exec dbo.SP_GetBIZOrderNo @ccid out;select @ccid as ccid;");
- if ($stmt === false) {
- echo "Error in executing statement 3.\n";
- die(print_r(sqlsrv_errors(), true));
- } else {
- //存储过程中每一个select都会产生一个结果集,取某个结果集就需要从第一个移动到需要的那个结果集
- //如果结果集为空就移到下一个
- while (sqlsrv_has_rows($stmt) !== TRUE) {
- sqlsrv_next_result($stmt);
- }
-
- $result_object = array();
- while ($row = sqlsrv_fetch_object($stmt)) {
- $result_object[] = $row;
- }
-
- sqlsrv_free_stmt($stmt);
- sqlsrv_close($conn);
-
- return($result_object[0]->ccid);
- }
- }
-
- /*!
- * 删除收款记录以更新
- * @date 2018-04-28
- * @param [type] $coli_sn 订单key
- * @param [type] $paytype 付款方式
- */
- public function biz_groupaccountinfo_cut($coli_sn, $paytype)
- {
- $sql = "DELETE from BIZ_GroupAccountInfo
- WHERE GAI_COLI_SN=? AND GAI_Type=? AND GAI_Operator = 435";
- $query = $this->HT->query($sql, array($coli_sn, $paytype));
- return $query;
- }
-
- /**
- *
- * 插入收款记录
- *
- */
- public $GAI_COLI_SN;
- public $GAI_GRI_SN;
- public $GAI_COLI_ID;
- public $GAI_Type;
- public $GAI_SQJE;
- public $GAI_SQDate;
- public $GAI_SQJECurrency;
- public $GAI_SSJE;
- public $GAI_SSDate;
- public $GAI_Operator;
- public $GAI_Memo="";
- public function biz_groupaccountinfo_save()
- {
- $sql = "INSERT INTO BIZ_GroupAccountInfo \n"
- . " ( \n"
- . " GAI_COLI_SN, \n"
- . " GAI_GRI_SN, \n"
- . " GAI_COLI_ID, \n"
- . " GAI_Type, \n"
- . " GAI_SQJE, \n"
- . " GAI_SQDate, \n"
- . " GAI_SQJECurrency, \n"
- . " GAI_SSJE, \n"
- . " GAI_SSDate, \n"
- . " GAI_Operator, \n"
- . " GAI_Memo \n"
- . " ) \n"
- . "VALUES \n"
- . " ( \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ? \n"
- . " )";
- $query = $this->HT->query($sql, array(
- $this->GAI_COLI_SN
- ,$this->GAI_GRI_SN
- ,$this->GAI_COLI_ID
- ,$this->GAI_Type
- ,$this->GAI_SQJE
- ,$this->GAI_SQDate
- ,$this->GAI_SQJECurrency
- ,$this->GAI_SSJE
- ,$this->GAI_SSDate
- ,$this->GAI_Operator
- ,$this->GAI_Memo
- ));
- return $query;
- }
-
- function GetNationalityID($nationalityName) {
- if (!$nationalityName) {
- return 0;
- }
- if (is_numeric($nationalityName)) {
- return $nationalityName;
- } else {
- $sql = "SELECT TOP 1 ci2.COI2_COI_SN \n"
- . "FROM COuntryInfo2 ci2 \n"
- . "WHERE ci2.COI2_Country = ? ";
- $query = $this->HT->query($sql, array($nationalityName));
- if ($query->result()) {
- $row = $query->row();
- return $row->COI2_COI_SN;
- } else {
- return 0;
- }
- }
- }
-
function GetNationalityName($nationalityID) {
if (!is_numeric($nationalityID)) {
return $nationalityID;
@@ -1379,91 +208,6 @@ class BIZ_Orders_model extends CI_Model {
}
}
- /**
- *
- * 获取商务订单信息
- * @param string $order_id 订单id
- * @return mixed 订单信息
- *
- */
- public function get_flight_order_by_id($order_id) {
- $sql = "SELECT DISTINCT cli.COLI_ID, \n"
- . " cli.COLI_Price, \n"
- . " bg.GUT_FirstName, \n"
- . " bg.GUT_LastName, \n"
- . " bg.GUT_Email, \n"
- . " bg.GUT_Email2, \n"
- . " bpe.BPE_SN, \n"
- . " bpe.BPE_GuestType, \n"
- . " bpe.BPE_FirstName, \n"
- . " bpe.BPE_MiddleName, \n"
- . " bpe.BPE_LastName, \n"
- . " bpe.BPE_GuestType, \n"
- . " bpe.BPE_Passport, \n"
- . " cld.COLD_Count, \n"
- . " foi.FlightsNo, \n"
- . " foi.DepartureDate, \n"
- . " foi.DepartureTime, \n"
- . " foi.ArrivalTime, \n"
- . " cli.COLI_PayManner, \n"
- . " cli.COLI_State, \n"
- . " cli.COLI_sourcetype, \n"
- . " foi.Cabin, \n"
- . " foi.DepartAirport, \n"
- . " foi.ArrivalAirport, \n"
- . " cld.COLD_SN, \n"
- . " foi.DepartureCity, \n"
- . " foi.ArrivalCity, \n"
- . " bg.GUT_TEL, \n"
- . " bg.GUT_NationalityID, \n"
- . " cli.COLI_OrderDetailText, \n"
- . " bpe.BPE_imageSrc, \n"
- . " cli.COLI_Cost, \n"
- . " cld.COLD_TotalPrice, \n"
- . " cld.COLD_TotalCost \n"
- . "FROM BIZ_ConfirmLineInfo cli \n"
- . " INNER JOIN BIZ_ConfirmLineDetail cld \n"
- . " ON cli.COLI_SN = cld.COLD_COLI_SN \n"
- . " INNER JOIN BIZ_GUEST bg \n"
- . " ON bg.GUT_SN = cli.COLI_GUT_SN \n"
- . " INNER JOIN BIZ_BookPeopleList bpl \n"
- . " ON bpl.BPL_COLD_SN = cld.COLD_SN \n"
- . " INNER JOIN BIZ_BookPeople bpe \n"
- . " ON bpl.BPL_BPE_SN = bpe.BPE_SN \n"
- . " INNER JOIN BIZ_FlightsOrderInfo foi \n"
- . " ON foi.FOI_COLD_SN = cld.COLD_SN \n"
- . "WHERE cli.COLI_ID = ? AND isnull(cld.deleteflag,0) = 0 ";
-
- $query = $this->HT->query($sql, array($order_id));
- return $query->result();
- }
-
- /**
- *
- * 获取机票订单乘员列表
- * @param string $order_id 订单id
- * @return mixed 订单信息
- *
- */
- public function get_bpe_list_by_id($order_id) {
- $sql = "SELECT DISTINCT bpe.BPE_SN, \n"
- . " bpe.BPE_FirstName, \n"
- . " bpe.BPE_MiddleName, \n"
- . " bpe.BPE_LastName, \n"
- . " bpe.BPE_Passport \n"
- . "FROM BIZ_BookPeople bpe \n"
- . " INNER JOIN BIZ_BookPeopleList bpl \n"
- . " ON bpe.BPE_SN = bpl.BPL_BPE_SN \n"
- . " INNER JOIN BIZ_ConfirmLineDetail cold \n"
- . " ON bpl.BPL_COLD_SN = cold.COLD_SN \n"
- . " INNER JOIN BIZ_ConfirmLineInfo coli \n"
- . " ON coli.COLI_SN = cold.COLD_COLI_SN \n"
- . "WHERE coli.COLI_ID = ?";
- $query = $this->HT->query($sql, array($order_id));
- //echo('');
- return $query->result();
- }
-
/**
*
* 获取机票电子票号
@@ -1512,316 +256,6 @@ class BIZ_Orders_model extends CI_Model {
return $query;
}
- /**
- * wifi预订入库(目前仅CHT使用)
- *
- * @return int 插入id
- */
- var $WOI_COLD_SN;
- var $WOI_Device; //设备(智能手机、pad)
- var $WOI_DeviceCount; //设备数量
- var $WOI_UsersCount; //使用人数
- var $WOI_Package; //Wi-Fi套餐
- var $WOI_PackageCount; //套餐数量
- var $WOI_DeliverDate; //起租日期
- var $WOI_DeliverCity; //起租城市
- var $WOI_DeliverAddr; //起租地址
- var $WOI_ReturnDate; //归还日期
- var $WOI_ReturnCity; //归还城市
- var $WOI_ReturnAddr; //归还地址
- var $WOI_OtherService; //其他服务
- var $WOI_GroupNo; //团号
- var $WOI_ExpressNo; //快递单号
-
- public function biz_wifi_info_save() {
- $sql = "INSERT INTO BIZ_WifiOrderInfo \n"
- . "( \n"
- . " WOI_COLD_SN, \n"
- . " WOI_Device, \n"
- . " WOI_DeviceCount, \n"
- . " WOI_UsersCount, \n"
- . " WOI_Package, \n"
- . " WOI_PackageCount, \n"
- . " WOI_DeliverDate, \n"
- . " WOI_DeliverCity, \n"
- . " WOI_DeliverAddr, \n"
- . " WOI_ReturnDate, \n"
- . " WOI_ReturnCity, \n"
- . " WOI_ReturnAddr, \n"
- . " WOI_OtherService, \n"
- . " WOI_GroupNo, \n"
- . " WOI_ExpressNo \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ? \n"
- . ")";
- $HT1 = $this->load->database('HT', true);
- $query = $HT1->query($sql, array($this->WOI_COLD_SN,
- $this->WOI_Device,
- $this->WOI_DeviceCount,
- $this->WOI_UsersCount,
- $this->WOI_Package,
- $this->WOI_PackageCount,
- $this->WOI_DeliverDate,
- $this->WOI_DeliverCity,
- $this->WOI_DeliverAddr,
- $this->WOI_ReturnDate,
- $this->WOI_ReturnCity,
- $this->WOI_ReturnAddr,
- $this->WOI_OtherService,
- $this->WOI_GroupNo,
- $this->WOI_ExpressNo
- ));
- }
-
- /**
- * 酒店预订入库
- *
- * @return int 插入id
- */
- var $HOI_COLD_SN; //必选
- var $HOI_NoSmoking = null; //无烟房
- var $HOI_EarlyTime = null; //最早确认时间,已不用
- var $HOI_LastTime = null; //最晚确认时间,已不用
- var $HOI_Room_NO = null; //房号
- var $HOI_ExtraNum = 0; //加床
- var $HOI_RoomTypeName = null; //房型
- var $HOI_BreakNum = null; //早餐人数
- var $HOI_PriceType = null; //价格类型
- var $HOI_BreakType = null; //早餐类型
- var $HOI_RoomRates = null;
- var $HOI_ExtrabedRates = null;
- var $HOI_TaxFee = null;
-
- public function biz_hotel_order_save() {
- /* ASP版本
- sql="select * from BIZ_HotelOrderInfo where 1=2"
- rs2.open sql,conn,3,3,1
- rs2.addnew
- rs2("HOI_COLD_SN")=COLD_SN
- rs2("HOI_ExtraNum") = extrabed
- if clng(Smoking)<2 then
- rs2("HOI_NoSmoking")=Smoking
- end if
- rs2("HOI_EarlyTime")=earlydate
- rs2("HOI_LastTime")=""
- rs2.update
- rs2.close
- */
- $sql = "INSERT INTO BIZ_HotelOrderInfo \n"
- . "( \n"
- . " HOI_COLD_SN, \n"
- . " HOI_NoSmoking, \n"
- . " HOI_EarlyTime, \n"
- . " HOI_LastTime, \n"
- . " HOI_Room_NO, \n"
- . " HOI_ExtraNum, \n"
- . " HOI_RoomTypeName, \n"
- . " HOI_BreakNum, \n"
- . " HOI_PriceType, \n"
- . " HOI_BreakType, \n"
- . " HOI_RoomRates, \n"
- . " HOI_ExtrabedRates, \n"
- . " HOI_TaxFee \n"
- . ") \n"
- . "VALUES \n"
- . "( \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ?, \n"
- . " ? \n"
- . ")";
- $HT1 = $this->load->database('HT', true);
- $query = $HT1->query($sql, array(
- $this->HOI_COLD_SN,
- $this->HOI_NoSmoking,
- $this->HOI_EarlyTime,
- $this->HOI_LastTime,
- $this->HOI_Room_NO,
- $this->HOI_ExtraNum,
- $this->HOI_RoomTypeName,
- $this->HOI_BreakNum,
- $this->HOI_PriceType,
- $this->HOI_BreakType,
- $this->HOI_RoomRates,
- $this->HOI_ExtrabedRates,
- $this->HOI_TaxFee
- ));
- }
-
- /**
- *
- * 返回成行订单
- * 条件1:订单类型
- * 天剑2:网站来源
- *
- */
- public function get_order_info($COLI_sourcetype, $COLI_WebCode, $biz = true) {
- if ($biz) {
- $sql = "SELECT TOP 200 c.COLI_WebCode, \n"
- . " c.COLI_ID, \n"
- . " c.COLI_ConfirmDate, \n"
- . " c.COLI_ApplyDate, \n"
- . " ISNULL(c.COLI_IsSuccess, 0) AS success \n"
- . "FROM BIZ_ConfirmLineInfo c \n"
- . "WHERE c.COLI_sourcetype = ? \n"
- . " AND c.COLI_WebCode = ? \n"
- . "ORDER BY \n"
- . " c.COLI_SN DESC";
- $query = $this->HT->query($sql, array($COLI_sourcetype, $COLI_WebCode));
- } else {
- $sql = "SELECT TOP 200 c.COLI_WebCode, \n"
- . " c.COLI_ID, \n"
- . " c.COLI_ConfirmDate, \n"
- . " c.COLI_ApplyDate, \n"
- . " CASE WHEN c.COLI_Sended = 5 THEN 1 ELSE 0 END AS success \n"
- . "FROM ConfirmLineInfo c \n"
- . "WHERE c.COLI_sourcetype = ? \n"
- . " AND c.COLI_WebCode = ? \n"
- . "ORDER BY \n"
- . " c.COLI_SN DESC";
- $query = $this->HT->query($sql, array($COLI_sourcetype, $COLI_WebCode));
- }
- $this->sql = $this->HT->queries;
- return $query->result();
- }
-
- //传统订单支付之后,插入新的订单信息
- public function insert_daytrip_order($coli_sn, $pay_manner, $gri_sn, $state, $deleteflag) {
- //获取订单
- $order_info_sql = "
- SELECT confirmlineinfotmp.COLI_OrderPrice,
- memberinfotmp.MEI_FirstName,
- memberinfotmp.MEI_LastName,
- memberinfotmp.MEI_Mail
- FROM memberinfotmp
- INNER JOIN customerlisttmp
- ON memberinfotmp.mei_sn = customerlisttmp.cul_cui_sn
- INNER JOIN confirmlineinfotmp
- ON customerlisttmp.cul_coli_sn = confirmlineinfotmp.coli_sn
- WHERE (customerlisttmp.cul_coli_sn = ? )";
- $query = $this->HT->query($order_info_sql, array($coli_sn));
- $order_info = $query->row();
-
- //插入记录
- $sql = "INSERT INTO GroupAccountInfoTmp
- (
- GAI_COLI_SN,
- GAI_SQJE,
- GAI_SQDate,
- GAI_CusName,
- GAI_CusEmail,
- GAI_SQJECurrency,
- GAI_Type,
- LastEditTime,
- GAI_GRI_SN,
- GAI_State,
- DeleteFlag
- )
- VALUES (?,?,?,?,?,?,?,?,?,?,?)";
-
- $query = $this->HT->query($sql, array($coli_sn,
- $order_info->COLI_OrderPrice,
- date('Y-m-d H:i:s'),
- $order_info->MEI_FirstName . " " . $order_info->MEI_LastName,
- $order_info->MEI_Mail,
- $this->config->item('Site_Currency'),
- $pay_manner,
- date('Y-m-d H:i:s'),
- $gri_sn,
- $state,
- $deleteflag
- )
- );
- }
-
- //来源终端 tablet mobile desktop
- public function check_device() {
- if (isset($_SERVER['HTTP_USER_AGENT'])) {
- $ua = $_SERVER['HTTP_USER_AGENT'];
- } else {
- $ua = '';
- }
- ## This credit must stay intact (Unless you have a deal with @lukasmig or frimerlukas@gmail.com
- ## Made by Lukas Frimer Tholander from Made In Osted Webdesign.
- ## Price will be $2
- $iphone = strstr(strtolower($ua), 'mobile'); //Search for 'mobile' in user-agent (iPhone have that)
- $android = strstr(strtolower($ua), 'android'); //Search for 'android' in user-agent
- $windowsPhone = strstr(strtolower($ua), 'phone'); //Search for 'phone' in user-agent (Windows Phone uses that)
-
- if (!function_exists('androidTablet')) {
-
- function androidTablet($ua) { //Find out if it is a tablet
- if (strstr(strtolower($ua), 'android')) { //Search for android in user-agent
- if (!strstr(strtolower($ua), 'mobile')) { //If there is no ''mobile' in user-agent (Android have that on their phones, but not tablets)
- return true;
- }
- }
- }
-
- }
- $androidTablet = androidTablet($ua); //Do androidTablet function
- $ipad = strstr(strtolower($ua), 'ipad'); //Search for iPad in user-agent
-
- if ($androidTablet || $ipad) { //If it's a tablet (iPad / Android)
- return 'tablet';
- } elseif ($iphone && !$ipad || $android && !$androidTablet || $windowsPhone) { //If it's a phone and NOT a tablet
- return 'mobile';
- } else { //If it's not a mobile device
- return 'desktop';
- }
- }
-
- public function ip_limit($ip = "0.0.0.0")
- {
- if (strcmp($ip, "0.0.0.0") === 0 || empty($ip)) {
- return TRUE;
- }
- $sql = "SELECT COUNT(1) cnt
- FROM ConfirmLineInfoTmp
- WHERE 1=1
- AND COLI_SenderIP = ?
- AND DateDiff(dd,COLI_ApplyDate,getdate())=0";
- $query = $this->HT->query($sql, array($ip));
- $ret = $query->row();
- if ($ret->cnt > 50) {
- return FALSE;
- } else {
- return TRUE;
- }
- }
-
- public function convert_RMB_to_currency($money=0, $toCurrency='USD')
- {
- return $this->HT
- ->query("SELECT tourmanager.dbo.[ConvertCurrencyToCurrency](1,'RMB','$toCurrency',$money) as rmb ")
- ->row()->rmb;
- }
-
public function test()
{
// return NULL;
@@ -1848,5 +282,59 @@ class BIZ_Orders_model extends CI_Model {
return $this->HT->insert("BIZ_OrderOperationLog", $db_column);
}
+ /*!
+ * @Author: LYT
+ * @Date: 2019-06-04 14:16:01
+ * @Desc: 商务订单的预订详情
+ */
+ public function get_all_cold($COLD_SN_str)
+ {
+ $sql = "SELECT *
+ from BIZ_ConfirmLineDetail cold
+ inner join BIZ_ConfirmLineInfo coli on coli.COLI_SN=COLD_COLI_SN
+ where COLD_SN in (
+ $COLD_SN_str
+ ) and cold.DeleteFlag=0";
+ return $this->HT->query($sql)->result();
+ }
+ /*!
+ * @Author: LYT
+ * @Date: 2019-06-04 11:36:50
+ * @Desc: 商务订单:火车票预订;机票预订;
+ */
+ public function get_train_flight_order($COLD_SN_str)
+ {
+ $sql = "SELECT
+ [dbo].[GetStationCNName_LGC](f.DepartureCity, f.DepartAirport, 2) as depart_station
+ ,[dbo].[GetStationCNName_LGC](f.ArrivalCity, f.ArrivalAirport, 2) as arrival_station
+ ,[dbo].[GetStationCabinName_LGC](f.Cabin,2) as cabin_name
+ ,* from BIZ_FlightsOrderInfo f
+ where f.FOI_COLD_SN in (
+ $COLD_SN_str
+ )";
+ return $this->HT->query($sql)->result();
+ }
+
+ /*!
+ * @Author: LYT
+ * @Date: 2019-06-04 15:32:16
+ * @Desc: 商务订单:酒店预订
+ * @Deprecated 酒店不通过地接社预定.除桂林地接外
+ */
+ public function get_hotel_order($COLD_SN_str)
+ {
+ $sql = "SELECT VEI2_CompanyBN,ROT2_TypeName,
+ COLD_COUNT room_count,HOI_Room_NO,HOI_EarlyTime,
+ HOI_LastTime,HOI_ExtraNum,isnull(HOI_NoSmoking,0) as HOI_NoSmoking,
+ COLD_StartDate,COLD_EndDate,COLD_PersonNum,COLD_ChildNum,COLD_BabyNum ,
+ HOI_RoomTypeName
+ from biz_ConfirmLineDetail
+ left join Vendorinfo2 on COLD_ServiceSN=VEI2_VEI_SN and VEI2_LGC=2
+ left join roomtype2 on ROT2_ROT_SN = COLD_ServiceSN2 and ROT2_LGC = 2
+ left join BIZ_HotelOrderInfo on COLD_SN = HOI_COLD_SN
+ where 1=1
+ and COLD_SN in ($COLD_SN_str)";
+ return $this->HT->query($sql)->result();
+ }
}
diff --git a/webht/third_party/vendorPlanSync/models/Group_model.php b/webht/third_party/vendorPlanSync/models/Group_model.php
index 6d2e4d94..522e50ec 100644
--- a/webht/third_party/vendorPlanSync/models/Group_model.php
+++ b/webht/third_party/vendorPlanSync/models/Group_model.php
@@ -20,15 +20,14 @@ class Group_model extends CI_Model {
from VendorArrangeState vas
inner join Eva_ObjectInfo eoi on EOI_GRI_SN=VAS_GRI_SN and EOI_Type=1 and EOI_ObjSN=VAS_VEI_SN
inner join GRoupInfo gri on GRI_SN=VAS_GRI_SN
- where 1=1 ";
+ where 1=1 AND VAS_VEI_SN in ($vendor_str) ";
$sql .= $gri_sn!==0 ? $gri_sql : "
- AND VAS_IsCancel=0 AND VAS_Delete=0 AND vas.DeleteFlag=0
- AND VAS_IsSendSucceed=1 AND VAS_IsReceive=0
+ AND isnull(VAS_IsCancel,0)=0 AND isnull(VAS_Delete,0)=0 AND isnull(vas.DeleteFlag,0)=0
+ AND VAS_IsSendSucceed=1 AND isnull(VAS_IsReceive,0)=0
AND EOI_GetDate between '$start_date' AND '$end_date'
- AND VAS_VEI_SN in ($vendor_str)
-- Trippest, not confirm, not change -- for Trippest deploy
+ AND isnull(VAS_IsConfirm,0)=0 AND isnull(VAS_SendVary,0)=0
AND GRI_OrderType=227002
- AND VAS_IsConfirm=0 AND VAS_SendVary=0
AND EXISTS (
select 1 from OperatorInfo where OPI_SN=GRI_operator AND OPI_DEI_SN=30
)
@@ -68,16 +67,16 @@ class Group_model extends CI_Model {
'ReturnDatesAsStrings' => 1
);
$conn = sqlsrv_connect($db['HT']['hostname'], $connection);
- $stmt = sqlsrv_query($conn, "EXEC Tourmanager.dbo.SP_VendorPlan_GetPlanInfo $gri_sn, $vendor_id, 0 ");
+ $stmt = sqlsrv_query($conn, "SET NOCOUNT ON;EXEC Tourmanager.dbo.SP_VendorPlan_GetPlanInfo $gri_sn, $vendor_id, 0 ");
$result_object = array();
- if (false !== $stmt) { // 无权限返回false,会导致下列sqlsrv_has_rows,sqlsrv_next_result死循环
- //存储过程中每一个select都会产生一个结果集,取某个结果集就需要从第一个移动到需要的那个结果集
- //如果结果集为空就移到下一个
- while (sqlsrv_has_rows($stmt) !== TRUE) {
- sqlsrv_next_result($stmt);
- }
- while ($row = sqlsrv_fetch_object($stmt)) {
- $result_object[] = $row;
+ if (false !== $stmt ) { // 无权限或执行错误返回false
+ // 存储过程中每个select都产生结果集
+ // 设置了SET NOCOUNT ON;就只有输出的结果集
+ $a = true;
+ while ($a !== false) {
+ $row = sqlsrv_fetch_object($stmt); // Retrieves the next row of data as a PHP object.
+ $a = !empty($row);
+ $a===true ? $result_object[] = $row : null;
}
sqlsrv_free_stmt($stmt);
}
@@ -85,12 +84,25 @@ class Group_model extends CI_Model {
$grd_info = $result_object;
$all_day_no = array_map(function($ele){return $ele->GRD_DayNo;}, $grd_info);
$day_no_str = implode(",", $all_day_no);
- $all_aci = $this->get_arrange_info($gri_sn, 0, $day_no_str);
+ $all_aci = $this->get_arrange_info($gri_sn, $vendor_id, $day_no_str);
foreach ($grd_info as $kgrd => &$vgrd) {
+ $vgrd->pag_code_arr = array();
+ $vgrd->PAG_Title = $vgrd->GRD_Landscape;
foreach ($all_aci as $kaci => $vaci) {
if ($vgrd->GRD_DayNo == $vaci->ACI_DayNo) {
- $vgrd->day_no_raw = strstr($vaci->ACI_OrderDate, " ", true);
- break;
+ $vgrd->day_no_raw = strstr($vaci->ACI_OrderDate, " ", true);
+ $vgrd->tocity = $vaci->tocity;
+ $vgrd->citycode = $vaci->citycode;
+ $vgrd->ACI_PersonNum = intval($vaci->ACI_PersonNum);
+ $vgrd->ACI_ChildNum = intval($vaci->ACI_ChildNum);
+ $vgrd->ACI_BabyNum = intval($vaci->ACI_BabyNum);
+ $vgrd->PAG_DEI_SN = $vaci->PAG_DEI_SN;
+ if ( strval($vaci->ACI_ServiceType)==='D') {
+ $vgrd->PAG_Code = mb_strtoupper($vaci->PAG_Code);
+ $vgrd->PAG_ExtendType = mb_strtoupper($vaci->PAG_ExtendType);
+ $vgrd->pag_code_arr[] = mb_strtoupper($vaci->PAG_Code);
+ break;
+ }
}
}
}
@@ -122,8 +134,13 @@ class Group_model extends CI_Model {
where CII2_CII_SN=ACI_ToCity and CII2_LGC=2) as tocity,
(select CII_PKCode from CItyInfo
where CII_SN=ACI_ToCity ) as citycode,
+ PAG_Code,PAG_ExtendType,PAG_DEI_SN,
*
from ArrangeConfirmInfo aci
+ left join BIZ_PackageInfo on PAG_SN=ACI_ServiceSN
+ and ACI_ServiceType='D' and PAG_DefaultVEI_SN=ACI_VEI_SN
+ -- 增加是否目的地产品的判断
+ and SUBSTRING(CONVERT(varchar(10), PAG_SourceType) ,1,3)='132'
where 1=1
and aci.ACI_GRI_SN=?
$vendor_sql
@@ -273,8 +290,6 @@ class Group_model extends CI_Model {
return $this->HT->query($update_sql);
}
-
-
/*
* 发送邮件
*/
diff --git a/webht/third_party/vendorPlanSync/models/TuLanDuo_addOrUpdateRouteOrderContentBuilder.php b/webht/third_party/vendorPlanSync/models/TuLanDuo_addOrUpdateRouteOrderContentBuilder.php
index 93b9b595..eb7bb473 100644
--- a/webht/third_party/vendorPlanSync/models/TuLanDuo_addOrUpdateRouteOrderContentBuilder.php
+++ b/webht/third_party/vendorPlanSync/models/TuLanDuo_addOrUpdateRouteOrderContentBuilder.php
@@ -213,7 +213,10 @@ class TuLanDuo_addOrUpdateRouteOrderContentBuilder extends CI_Model
return $this;
}
- /** 行程详细数组 */
+ /**
+ * 行程详细数组
+ * 已存在的日期则拼接内容
+ */
public function setScheduleDetailsTitle($index, $title)
{
$this->orderData['scheduleDetails'][$index]['title'] = $title;
@@ -221,32 +224,38 @@ class TuLanDuo_addOrUpdateRouteOrderContentBuilder extends CI_Model
}
public function setScheduleDetailsContent($index, $content)
{
- $this->orderData['scheduleDetails'][$index]['content'] = $content;
+ $this->orderData['scheduleDetails'][$index]['content'] = isset($this->orderData['scheduleDetails'][$index]['content']) ?
+ ($this->orderData['scheduleDetails'][$index]['content'] . "\r\n" . $content) : $content;
return $this;
}
public function setScheduleDetailsTraffic($index, $traffic)
{
- $this->orderData['scheduleDetails'][$index]['traffic'] = $traffic;
+ $this->orderData['scheduleDetails'][$index]['traffic'] = isset($this->orderData['scheduleDetails'][$index]['traffic']) ?
+ ($this->orderData['scheduleDetails'][$index]['traffic'] . "\r\n" . $traffic) : $traffic;
return $this;
}
public function setScheduleDetailsAccommodation($index, $accommodation)
{
- $this->orderData['scheduleDetails'][$index]['accommodation'] = $accommodation;
+ $this->orderData['scheduleDetails'][$index]['accommodation'] = isset($this->orderData['scheduleDetails'][$index]['accommodation']) ?
+ ($this->orderData['scheduleDetails'][$index]['accommodation'] . "\r\n" . $accommodation) : $accommodation;
return $this;
}
public function setScheduleDetailsBreakFirst($index, $breakFirst)
{
- $this->orderData['scheduleDetails'][$index]['breakFirst'] = $breakFirst;
+ $this->orderData['scheduleDetails'][$index]['breakFirst'] = isset($this->orderData['scheduleDetails'][$index]['breakFirst']) ?
+ $breakFirst+$this->orderData['scheduleDetails'][$index]['breakFirst'] : $breakFirst;
return $this;
}
public function setScheduleDetailsDinner($index, $dinner)
{
- $this->orderData['scheduleDetails'][$index]['dinner'] = $dinner;
+ $this->orderData['scheduleDetails'][$index]['dinner'] = isset($this->orderData['scheduleDetails'][$index]['dinner']) ?
+ $dinner+$this->orderData['scheduleDetails'][$index]['dinner'] : $dinner;
return $this;
}
public function setScheduleDetailsLunch($index, $lunch)
{
- $this->orderData['scheduleDetails'][$index]['lunch'] = $lunch;
+ $this->orderData['scheduleDetails'][$index]['lunch'] = isset($this->orderData['scheduleDetails'][$index]['lunch']) ?
+ $lunch+$this->orderData['scheduleDetails'][$index]['lunch'] : $lunch;
return $this;
}
diff --git a/webht/third_party/vendorPlanSync/models/orders_model.php b/webht/third_party/vendorPlanSync/models/orders_model.php
index ebbcac11..02412028 100644
--- a/webht/third_party/vendorPlanSync/models/orders_model.php
+++ b/webht/third_party/vendorPlanSync/models/orders_model.php
@@ -27,10 +27,14 @@ class Orders_model extends CI_Model {
where LGC_LGC = 2
and COI_SN in (select MEI_Country from MemberInfo where MEI_SN=CUL_CUI_SN)
) as Country,
- (select MEI_PassportNo from MemberInfo where MEI_SN=CUL_CUI_SN) PassportNo,
- (select MEI_PassportValidDate from MemberInfo where MEI_SN=CUL_CUI_SN) PassportValidDate
+ MEI_Phone phone,
+ MEI_PassportNo PassportNo,
+ MEI_PassportValidDate PassportValidDate
+ -- (select MEI_PassportNo from MemberInfo where MEI_SN=CUL_CUI_SN) PassportNo,
+ -- (select MEI_PassportValidDate from MemberInfo where MEI_SN=CUL_CUI_SN) PassportValidDate
-- ,(select dbo.GetSysCodeName(MEI_Occupation,2) from MemberInfo where MEI_SN=CUL_CUI_SN) as Occupation
from CustomerList
+ inner join MemberInfo on MEI_SN=CUL_CUI_SN
where isnull(CUL_IsAgent,0)=0
and isnull(CUL_IsEmergency,0)=0
and isnull(CUL_IsTJR,0)=0