查询bug
parent
acb8fcafa9
commit
7921462d17
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Tulanduo_sync_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';
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* 查询图兰朵订单id是否已存在
|
||||
* @param string $vendorOrderIds [description]
|
||||
*/
|
||||
public function get_exists_vendorOrderId($vendorOrderIds="")
|
||||
{
|
||||
$sql = "SELECT GCI_VendorOrderId FROM GroupCombineInfo
|
||||
WHERE GCI_VendorOrderId IN ($vendorOrderIds) ";
|
||||
return $this->HT->query($sql)->result();
|
||||
}
|
||||
/*!
|
||||
* 从图兰朵同步历史数据的日期偏移
|
||||
* 获取HT内图兰朵订单的最老出发日期
|
||||
*/
|
||||
public function get_oldest_offset()
|
||||
{
|
||||
$sql = "SELECT top 1 CAST(GCI_travelDate as DATE) old_date from GroupCombineInfo
|
||||
order by GCI_travelDate asc";
|
||||
return $this->HT->query($sql)->row()->old_date;
|
||||
}
|
||||
/*!
|
||||
* 图兰朵订单在HT内的信息
|
||||
* @param [type] $code [description]
|
||||
* @param [type] $vendorOrderId [description]
|
||||
*/
|
||||
public function get_vendorOrder_HTinfo($code, $vendorOrderId=NULL)
|
||||
{
|
||||
# code...
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file tulanduo_sync_model.php */
|
||||
/* Location: ./webht/third_party/trippestOrderSync/models/tulanduo_sync_model.php */
|
||||
Loading…
Reference in New Issue