diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index 7f91f62e..6afa0a6f 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -51,6 +51,8 @@ class TulanduoApi extends CI_Controller public function __construct(){ parent::__construct(); + mb_regex_encoding("UTF-8"); + bcscale(4); $this->load->helper('array'); $this->load->model('Orders_model'); $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order'); @@ -67,8 +69,6 @@ class TulanduoApi extends CI_Controller // 桂林海纳国旅 // $this->userId = "18"; // $this->key = "d05c25e6e6c5d4898161e0aaf700d9c7"; - mb_regex_encoding("UTF-8"); - bcscale(4); } /*! diff --git a/webht/third_party/trippestOrderSync/controllers/api.php b/webht/third_party/trippestOrderSync/controllers/api.php index 7d2cada2..26ca2b25 100644 --- a/webht/third_party/trippestOrderSync/controllers/api.php +++ b/webht/third_party/trippestOrderSync/controllers/api.php @@ -5,9 +5,9 @@ class Api extends CI_Controller { public function __construct(){ parent::__construct(); + mb_regex_encoding("UTF-8"); $this->load->helper('array'); $this->load->model('Orders_model'); - mb_regex_encoding("UTF-8"); } public function index() @@ -38,6 +38,7 @@ class Api extends CI_Controller { { return $ele->GCI_combineNo; }, $order_project)); + $ret['operation'] = null; $operation = $this->Orders_model->get_operation($all_combine_no); // 司机, 导游 if ( ! empty($operation)) { @@ -122,7 +123,15 @@ class Api extends CI_Controller { unset($vro); } $ret['operation'] = array_values($ret['operation']); - $operator = $this->Orders_model->get_operator($order_project[0]->COLI_OPI_ID); + /** 外联信息 */ + $raw_opi_id = 0; + if (intval($order_project[0]->COLI_OPI_ID) === 435) { + $real_code = analysis_groupCode($ret['group_number']); + $raw_opi_id = $this->Orders_model->get_gri_opi_id($real_code); + } else { + $raw_opi_id = $order_project[0]->COLI_OPI_ID; + } + $operator = $this->Orders_model->get_operator($raw_opi_id); if ( ! empty($operator)) { $ret['operator']['chinese_name'] = $operator->OPI_Name; $ret['operator']['mobile'] = $operator->OPI_MoveTelephone; diff --git a/webht/third_party/trippestOrderSync/controllers/detail_for_client.md b/webht/third_party/trippestOrderSync/controllers/detail_for_client.md index 5363494b..6882369c 100644 --- a/webht/third_party/trippestOrderSync/controllers/detail_for_client.md +++ b/webht/third_party/trippestOrderSync/controllers/detail_for_client.md @@ -5,7 +5,7 @@ 参数| 类型 | 示例 | - --- | --- | --- | --- -q | string | 180601019 | 渠道订单, 不返回外联信息 +q | string | 180807025 | 渠道订单, 不返回外联信息 | | 180524043M | 单接送+Day Tour,共4天 #### RETURN JSON diff --git a/webht/third_party/trippestOrderSync/helpers/array_helper.php b/webht/third_party/trippestOrderSync/helpers/array_helper.php index 006ff0bf..2e9bf4f0 100644 --- a/webht/third_party/trippestOrderSync/helpers/array_helper.php +++ b/webht/third_party/trippestOrderSync/helpers/array_helper.php @@ -108,3 +108,36 @@ function raw_json_encode($input, $flags = 0) { }; return preg_replace_callback($pattern, $callback, json_encode($input, $flags)); } +/*! + * 目的地项目组的订单计划的团号分析 + * 去除添加的后缀, 只保留前两部分: XXXXXX-YYYYYYYYYYYY + * @date 2018-05-02 + * @param [type] $groupCode 从地接系统获取到的团号 + */ +function analysis_groupCode($groupCode) +{ + mb_regex_encoding("UTF-8"); + preg_match('/[\w\s\-]+/', characet($groupCode, "UTF-8"), $temp_array); + $temp_array[0] = strrchr($temp_array[0], " ") ? mb_strstr($temp_array[0], " ",true) : $temp_array[0]; + $tmp_groupCode = explode("-", trim($temp_array[0])); + $real_groupCode = $tmp_groupCode[0] . "-"; + $real_groupCode .= mb_strstr($tmp_groupCode[1], "(", true)!==false ? mb_strstr($tmp_groupCode[1], "(", true) : $tmp_groupCode[1]; + $real_groupCode = mb_ereg_replace('( )', '', trim($real_groupCode)); + return $real_groupCode; +} +/*! + * 转换字符集编码 + * @param $data + * @param $targetCharset + * @return string + */ +function characet($data, $targetCharset) { + if (!empty($data)) { + $fileType = "UTF-8"; + if (strcasecmp($fileType, $targetCharset) != 0) { + $data = mb_convert_encoding($data, $targetCharset, $fileType); + // $data = iconv($fileType, $targetCharset.'//IGNORE', $data); + } + } + return $data; +} diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index eda06437..2d55e17e 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -518,10 +518,10 @@ class Orders_model extends CI_Model { if ($gri_query->num_rows() > 0) { $this->GRI_SN = $gri_query->row()->GRI_SN; $this->GRI_operator = $gri_query->row()->GRI_operator; - $coli_sql = "SELECT top 1 COLI_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 + $coli_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 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 where COLI_GRI_SN=" . $this->GRI_SN; $coli_query = $this->HT->query($coli_sql); if ($coli_query->num_rows() > 0) { @@ -533,6 +533,19 @@ class Orders_model extends CI_Model { return NULL; } + /** 获取海纳团的发团人 */ + public function get_gri_opi_id($code) + { + $gri_sql = "SELECT top 1 GRI_SN,GRI_OPI_ID,isnull(GRI_operator,0) GRI_operator,GRI_No,GRI_Name + from GRoupInfo + where GRI_Name like '%$code%' "; + $gri_query = $this->HT->query($gri_sql); + if ($gri_query->num_rows() > 0) { + return $gri_query->row()->GRI_operator; + } + return 0; + } + /*! * 获取地接社接受计划的人员信息 * @param $vendorID 地接社ID @@ -1304,7 +1317,7 @@ class Orders_model extends CI_Model { return $ret; } - function get_operator($OPI_SN) + function get_operator($OPI_SN=0) { $operator_sql = "SELECT opi.OPI_SN,opi.OPI_Name,opi.OPI_FirstName,OPI_MoveTelephone,OPI_Email,opi2.OPI2_Name from OperatorInfo opi