You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.0 KiB
PHTML
61 lines
2.0 KiB
PHTML
7 years ago
|
<?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);
|
||
|
}
|
||
|
|
||
|
/*!
|
||
|
* 查询图兰朵订单id是否已存在
|
||
|
* @param string $vendorOrderIds [description]
|
||
|
*/
|
||
|
public function get_exists_vendorOrderId($vendorOrderIds="")
|
||
|
{
|
||
7 years ago
|
$sql = "SELECT GCI_VendorOrderId FROM GroupCombineInfo
|
||
|
WHERE GCI_VendorOrderId IN ($vendorOrderIds) ";
|
||
|
return $this->HT->query($sql)->result();
|
||
7 years ago
|
}
|
||
|
/*!
|
||
|
* 从图兰朵同步历史数据的日期偏移
|
||
|
* 获取HT内图兰朵订单的最老出发日期
|
||
7 years ago
|
* * 由于获取列表时根据发团日期或得到更早时间的发团日期
|
||
|
* * 因此这里取最早的10个, 找出不连续的为滚动日期的开始
|
||
7 years ago
|
*/
|
||
|
public function get_oldest_offset()
|
||
|
{
|
||
7 years ago
|
$sql = "SELECT DISTINCT TOP 10 CAST(GCI_travelDate as DATE) old_date from GroupCombineInfo
|
||
|
order by old_date asc";
|
||
|
$all_date = $this->HT->query($sql)->result();
|
||
|
$all_date_arr = array_map(function($ele)
|
||
|
{
|
||
|
return $ele->old_date;
|
||
|
}, $all_date);
|
||
|
for ($i=count($all_date_arr)-1; $i > 0; $i--) {
|
||
|
$d1 = new DateTime($all_date_arr[$i]);
|
||
|
$d2 = new DateTime($all_date_arr[$i-1]);
|
||
|
$date_diff = $d2->diff($d1);
|
||
|
if (intval($date_diff->format('%R%a')) > 1) {
|
||
|
return $all_date_arr[$i];
|
||
|
}
|
||
|
}
|
||
|
return $all_date_arr[0];
|
||
7 years ago
|
}
|
||
|
/*!
|
||
|
* 图兰朵订单在HT内的信息
|
||
|
* @param [type] $code [description]
|
||
|
* @param [type] $vendorOrderId [description]
|
||
|
*/
|
||
|
public function get_vendorOrder_HTinfo($code, $vendorOrderId=NULL)
|
||
|
{
|
||
|
# code...
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
/* End of file tulanduo_sync_model.php */
|
||
|
/* Location: ./webht/third_party/trippestOrderSync/models/tulanduo_sync_model.php */
|