trippest 删除测试;数据库修改为传统团可用

feature/pay
lyt 7 years ago
parent 2cf4cc9c6c
commit 5c1f3664be

@ -76,14 +76,16 @@ class TulanduoApi extends CI_Controller
*/
public function get_orderlist()
{
$startOrderDate = date('Y-m-d', strtotime("-2 days"));
$endOrderDate = date('Y-m-d');
$this->tld_order->setUserId($this->userId)
->setKey($this->key)
->setPageSize(20)
->setPageIndex(1)
->setStartTravelDate("2018-04-21") // test
->setEndTravelDate("2018-04-21")
// ->setStartOrderDate("2018-04-13")
// ->setEndOrderDate("2018-04-13")
// ->setStartTravelDate("2018-04-21") // test
// ->setEndTravelDate("2018-04-21")
->setStartOrderDate($startOrderDate)
->setEndOrderDate($endOrderDate)
;
$resp = $this->excute_curl($this->list_url, $this->tld_order);
$resp_arr = json_decode($resp, true);
@ -124,6 +126,8 @@ class TulanduoApi extends CI_Controller
continue;
}
$unique_order[] = $vo['orderId'];
$this->Orders_model->BIZ_COLI_SN = null;
$this->Orders_model->GRI_SN = null;
$vo['agcOrderNo'] = mb_ereg_replace('( )', '', trim($vo['agcOrderNo'])); // 去掉中文的全角空格
$PAG_Code = $pag_sub = null;
preg_match('/[a-zA-Z]+\-[0-9\-]+/', $this->characet($vo['routeName'], "UTF-8"), $temp_array);
@ -145,7 +149,8 @@ class TulanduoApi extends CI_Controller
$COLD_MemoText = raw_json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic']));
$this->Orders_model->BIZ_COLI_SN = $this->Orders_model->GRI_SN = $this->Orders_model->GCI_SN = null;
$this->Orders_model->get_SN_by_vendorOrderId($vo['orderId']); // 查询订单是否已经录入过
$tmpv = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN'];
$this->Orders_model->get_SN_by_vendorOrderId($vo['orderId'], $tmpv); // 查询订单是否已经录入过
if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组"))) {
$real_groupCode = $this->analysis_groupCode($vo['agcOrderNo']);
// set BIZ_COLI_SN, GRI_SN at Orders_model
@ -182,7 +187,6 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步测试" . $vo["orderId"] . ";线路:" . $vo['routeName'];
$this->Orders_model->BIZ_COLI_GUT_SN = $this->Orders_model->BIZ_GUT_SN ? $this->Orders_model->BIZ_GUT_SN : null;
$coli_sn[] = $this->Orders_model->biz_confirm_save();
log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
/**BIZ_ConfirmLineDetail*/
$this->Orders_model->COLD_COLI_SN = $this->Orders_model->BIZ_COLI_SN;
$this->Orders_model->COLD_ServiceType = "D";
@ -211,6 +215,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
/*biz_groupcombineinfo*/
$this->Orders_model->GCI_combineNo = isset($vo['groupOrderNo']) ? $vo['groupOrderNo'] : '';
$this->Orders_model->GCI_GRI_SN = $this->Orders_model->GRI_SN;
$this->Orders_model->GCI_VEI_SN = $this->Orders_model->COLD_PlanVEI_SN;
$this->Orders_model->GCI_VendorOrderId = $vo['orderId'];
$this->Orders_model->GCI_FromAgc = $vo['agcName'];
$this->Orders_model->GCI_groupType = $vo['orderType'];
@ -236,10 +241,10 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
if ($coli_sn !== null) {
$to_update_list = $this->Orders_model->get_groupCombineInfo($coli_sn);
} else {
$startDate = ('2018-04-21');
$endDate = ('2018-04-22'); // test
// $startDate = date('Y-m-d');
// $endDate = date('Y-m-d', strtotime("+4 days"));
// $startDate = ('2018-04-21');
// $endDate = ('2018-04-22'); // test
$startDate = date('Y-m-d');
$endDate = date('Y-m-d', strtotime("+4 days"));
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $startDate, $endDate);
}
$unique_orderGroupCombine = array();
@ -301,6 +306,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
$this->Order_update->gci_where_update = " GCI_SN=" . $order->GCI_SN;
$gci_update_column = array(
"GCI_combineNo" => $detail_jsonResp->orderDetail->groupOrderNo
,"GCI_VEI_SN" => $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN']
,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate
,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate
);
@ -393,6 +399,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
if (isset($detail_jsonResp->orderDetail->operationDetails->sceneryOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->sceneryOperations as $ks => $vso) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo;
$this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'];
$this->Orders_model->GCOD_operationType = "sceneryOperations";
$this->Orders_model->GCOD_subType = $vso->type;
$this->Orders_model->GCOD_title = $vso->name;
@ -414,6 +421,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->restraurantOperations as $vro) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'];
$this->Orders_model->GCOD_operationType = "restraurantOperations";
$this->Orders_model->GCOD_subType = $vro->type;
$this->Orders_model->GCOD_title = $vro->name;
@ -434,6 +442,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vco) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'];
$this->Orders_model->GCOD_operationType = "touristCarOperations";
$this->Orders_model->GCOD_subType = $vco->type;
$this->Orders_model->GCOD_title = $vco->name;
@ -454,6 +463,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vgo) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'];
$this->Orders_model->GCOD_operationType = "guiderOperations";
$this->Orders_model->GCOD_subType = "";
$this->Orders_model->GCOD_title = "";
@ -498,7 +508,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
*/
public function order_push($COLI_ID="") // test
{
// exit();
exit();
/** 目的地 test */
$this->userId = "358";
$this->key = "a08f26ddc5b1bd4c8e5eafcac28fc1ec";
@ -647,7 +657,8 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
{
mb_regex_encoding("UTF-8");
preg_match('/[\w\s\-]+/', $this->characet($groupCode, "UTF-8"), $temp_array);
$tmp_groupCode = explode("-", trim(strrchr($temp_array[0], " ")));
$temp_array[0] = strrchr($temp_array[0], " ") ? strrchr($temp_array[0], " ") : $temp_array[0];
$tmp_groupCode = explode("-", trim($temp_array[0]));
$real_groupCode = $tmp_groupCode[0] . "-";
$real_groupCode .= mb_strstr($tmp_groupCode[1], "", true) ? mb_strstr($tmp_groupCode[1], "", true) : $tmp_groupCode[1];
$real_groupCode = mb_ereg_replace('( )', '', trim($real_groupCode));

@ -51,7 +51,7 @@ class Order_update extends CI_Model {
if ($this->gci_where_update == "" || empty($column_data)) {
return false;
}
$update_str = $this->HT->update_string('BIZ_GroupCombineInfo', $column_data, $this->gci_where_update);
$update_str = $this->HT->update_string('GroupCombineInfo', $column_data, $this->gci_where_update);
$update_exc = $this->HT->query($update_str);
return $update_exc;
}

@ -127,7 +127,7 @@ class Orders_model extends CI_Model {
public function get_groupCombineInfo($coli_sn=0, $startDate=null, $endDate=NULL)
{
$sql = "SELECT top 1000 coli.COLI_ID, coli.COLI_SN, coli.COLI_GRI_SN, cold.COLD_SN, coli.COLI_OrderDetailText, coli.COLI_Memo, gci.*
FROM BIZ_GroupCombineInfo gci
FROM GroupCombineInfo gci
INNER JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN
INNER JOIN BIZ_ConfirmLineDetail cold ON cold.COLD_COLI_SN=coli.COLI_SN
WHERE 1=1 ";
@ -150,12 +150,12 @@ class Orders_model extends CI_Model {
{
$sql = "SELECT coli.COLI_ID, coli.COLI_SN,opi.OPI_Email,opi.OPI_Name,
vas.VAS_ChangeText, vas.VAS_ConfirmInfo, vas.VAS_SN
FROM BIZ_GroupCombineInfo gci
FROM GroupCombineInfo gci
INNER JOIN BIZ_ConfirmLineInfo coli ON gci.GCI_GRI_SN=coli.COLI_GRI_SN
INNER JOIN VendorArrangeState vas ON vas.VAS_GRI_SN=coli.COLI_GRI_SN
LEFT JOIN OperatorInfo opi ON opi.OPI_SN=coli.COLI_OPI_ID
WHERE gci.GCI_VendorOrderId=? and vas.VAS_VEI_SN=? ";
$query = $this->HT->query($sql, array($vendorOrderId, $vei_sn));
WHERE gci.GCI_VendorOrderId=? and vas.VAS_VEI_SN=? and gci.GCI_VEI_SN=? ";
$query = $this->HT->query($sql, array($vendorOrderId, $vei_sn, $vei_sn));
return $query->result();
}
/*!
@ -239,6 +239,7 @@ class Orders_model extends CI_Model {
}
public $GCI_SN;
public $GCI_VEI_SN;
public $GCI_combineNo=''; // 拼团团号
public $GCI_GRI_SN; // 团key
public $GCI_VendorOrderId; // 地接社系统订单id
@ -252,12 +253,13 @@ class Orders_model extends CI_Model {
{
$sql = "IF NOT EXISTS(
SELECT TOP 1 1
FROM BIZ_GroupCombineInfo
WHERE GCI_VendorOrderId = ? and GCI_GRI_SN=?
FROM GroupCombineInfo
WHERE GCI_VendorOrderId = ? and GCI_GRI_SN=? and GCI_VEI_SN=?
)
INSERT INTO BIZ_GroupCombineInfo
INSERT INTO GroupCombineInfo
(GCI_combineNo
,GCI_GRI_SN
,GCI_VEI_SN
,GCI_VendorOrderId
,GCI_FromAgc
,GCI_groupType
@ -268,6 +270,7 @@ class Orders_model extends CI_Model {
(N?
,?
,?
,?
,N?
,?
,?
@ -277,8 +280,10 @@ class Orders_model extends CI_Model {
$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
@ -286,24 +291,27 @@ class Orders_model extends CI_Model {
,$this->GCI_leaveDate
,$this->GCI_createTime
));
$this->GCI_SN = $this->HT->query("select MAX(GCI_SN) as insert_id FROM BIZ_GroupCombineInfo WHERE GCI_combineNo='" . $this->GCI_combineNo . "'")->row('insert_id');
$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 BIZ_GroupCombineOperationDetail
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 BIZ_GroupCombineOperationDetail
FROM GroupCombineOperationDetail
WHERE GCOD_GCI_combineNo = N? and GCOD_operationType=?";
$query = $this->HT->query($sql, array(
$combineNo,$operation
@ -311,6 +319,7 @@ class Orders_model extends CI_Model {
return $query->result();
}
public $GCOD_SN;
public $GCOD_VEI_SN;
public $GCOD_GCI_combineNo = '';
public $GCOD_operationType = '';
public $GCOD_subType = '';
@ -330,11 +339,12 @@ class Orders_model extends CI_Model {
{
// IF NOT EXISTS(
// SELECT TOP 1 1
// FROM BIZ_GroupCombineOperationDetail
// FROM GroupCombineOperationDetail
// WHERE GCOD_GCI_combineNo = N? and GCOD_operationType=N?
// )
$sql = "INSERT INTO BIZ_GroupCombineOperationDetail
$sql = "INSERT INTO GroupCombineOperationDetail
(GCOD_GCI_combineNo
,GCOD_VEI_SN
,GCOD_operationType
,GCOD_subType
,GCOD_title
@ -351,6 +361,7 @@ class Orders_model extends CI_Model {
,GCOD_creatTime)
VALUES
(N?
,?
,N?
,N?
,N?
@ -368,6 +379,7 @@ class Orders_model extends CI_Model {
";
$query = $this->HT->query($sql, array(
$this->GCOD_GCI_combineNo
,$this->GCOD_VEI_SN
,$this->GCOD_operationType
// ,$this->GCOD_GCI_combineNo
// ,$this->GCOD_operationType
@ -452,12 +464,12 @@ class Orders_model extends CI_Model {
return $this->GUT_SN;
}
public function get_SN_by_vendorOrderId($vendorOrderId)
public function get_SN_by_vendorOrderId($vendorOrderId, $vendorID)
{
$sql = "SELECT TOP 1 coli.COLI_GRI_SN,coli.COLI_SN,gci.GCI_SN
FROM BIZ_GroupCombineInfo gci
FROM GroupCombineInfo gci
INNER JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN
WHERE gci.GCI_VendorOrderId='$vendorOrderId'";
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;

Loading…
Cancel
Save