trippest 同步:修正一些判断

feature/pay
lyt 7 years ago
parent 4d86c0dc25
commit 594109d75b

@ -341,18 +341,18 @@ class TulanduoApi extends CI_Controller
$getInfo_byGroupCode = $this->Orders_model->get_SN_by_groupCode($real_groupCode, $real_groupCode); $getInfo_byGroupCode = $this->Orders_model->get_SN_by_groupCode($real_groupCode, $real_groupCode);
} }
$groupSN = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->GRI_SN : $order->COLI_GRI_SN; $groupSN = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->GRI_SN : $order->COLI_GRI_SN;
$coli_sn = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_SN : $order->COLI_SN; $coli_sn = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_SN : $order->COLI_SN;
$coli_id = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_ID : $order->COLI_ID; $coli_id = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_ID : $order->COLI_ID;
$coli_memo = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_Memo : $order->COLI_Memo; $coli_memo = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_Memo : $order->COLI_Memo;
$coli_orderdetailtext = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_OrderDetailText : $order->COLI_OrderDetailText; $coli_orderdetailtext = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_OrderDetailText : $order->COLI_OrderDetailText;
$coli_state = $getInfo_byGroupCode!==null ? $coli_state = isset($getInfo_byGroupCode->COLI_SN) ?
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? 9 : $getInfo_byGroupCode->COLI_State) (intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? 9 : $getInfo_byGroupCode->COLI_State)
: 9; : 9;
$cold_sn = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLD_SN : $order->COLD_SN; $cold_sn = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLD_SN : $order->COLD_SN;
// HT 订单有重复时, 以图兰朵的团号为正确的订单, 原本已录入的设为无效 // HT 订单有重复时, 以图兰朵的团号为正确的订单, 原本已录入的设为无效
if ($getInfo_byGroupCode === null) { if ($getInfo_byGroupCode === null) {
} elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) { } elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) {
if ( $order->COLI_ID) { if ( $order->COLI_ID && $order->COLI_ID != $getInfo_byGroupCode->COLI_ID) {
$allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID; $allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID;
if (intval($order->COLI_OPI_ID) === 435 ) { if (intval($order->COLI_OPI_ID) === 435 ) {
$this->order_cancel($order->COLI_ID); $this->order_cancel($order->COLI_ID);
@ -386,10 +386,10 @@ class TulanduoApi extends CI_Controller
} }
unset($vtf); unset($vtf);
} }
$travel_fee = $getInfo_byGroupCode!==null ? $travel_fee = isset($getInfo_byGroupCode->COLI_SN) ?
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? $travel_fee : $getInfo_byGroupCode->COLI_Price) (intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? $travel_fee : $getInfo_byGroupCode->COLI_Price)
: $travel_fee; : $travel_fee;
$travel_fee_currency = $getInfo_byGroupCode!==null ? $travel_fee_currency = isset($getInfo_byGroupCode->COLI_SN) ?
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? $travel_fee_currency : $getInfo_byGroupCode->COLI_CUrrency) (intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? $travel_fee_currency : $getInfo_byGroupCode->COLI_CUrrency)
: $travel_fee_currency; : $travel_fee_currency;
$coli_update_column = array( $coli_update_column = array(
@ -401,16 +401,20 @@ class TulanduoApi extends CI_Controller
); );
$this->Order_update->biz_confirmlineinfo_update($coli_update_column); $this->Order_update->biz_confirmlineinfo_update($coli_update_column);
/** BIZ_ConfirmLineDetail */ // nothing to update /** BIZ_ConfirmLineDetail */ // nothing to update
// query latest order detail
$latest_order_detail = $this->Orders_model->get_orderinfo_detail($coli_id);
/** INSERT */ /** INSERT */
/*BIZ_BookPeople*/ /*BIZ_BookPeople*/
if ($this->Orders_model->bookpeople_exist($cold_sn) === array()) { if ($this->Orders_model->bookpeople_exist($cold_sn) === array()) {
foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) { if (isset($detail_jsonResp->orderDetail->customers)) {
$this->Orders_model->BPE_FirstName = $vd->name; foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) {
$this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2; $this->Orders_model->BPE_FirstName = $vd->name;
$this->Orders_model->BPE_Passport = $vd->documentNo; $this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2;
$bpe_sn[] = $this->Orders_model->biz_book_people_save(); $this->Orders_model->BPE_Passport = $vd->documentNo;
// BIZ_BookPeopleList $bpe_sn[] = $this->Orders_model->biz_book_people_save();
$this->Orders_model->biz_bookpeople_List_save($cold_sn, $this->Orders_model->BPE_SN); // BIZ_BookPeopleList
$this->Orders_model->biz_bookpeople_List_save($cold_sn, $this->Orders_model->BPE_SN);
}
} }
} }
/*BIZ_PackageOrderInfo*/ /*BIZ_PackageOrderInfo*/
@ -429,7 +433,7 @@ class TulanduoApi extends CI_Controller
$auto_text = "dataAutoEnter "; $auto_text = "dataAutoEnter ";
// 删除旧的录入 // 删除旧的录入
$this->Orders_model->biz_groupaccountinfo_cut($coli_sn, $paytype); $this->Orders_model->biz_groupaccountinfo_cut($coli_sn, $paytype);
if (isset($detail_jsonResp->orderDetail->travelFees) && ! in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest")) ) { if (isset($detail_jsonResp->orderDetail->travelFees) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->travelFees as $ktf => $vtf) { foreach ($detail_jsonResp->orderDetail->travelFees as $ktf => $vtf) {
// if ($vtf->reviewStatus == 0) { // 未审核的 // if ($vtf->reviewStatus == 0) { // 未审核的
// continue; // continue;
@ -449,7 +453,7 @@ class TulanduoApi extends CI_Controller
} }
// 目的地项目组的订单为了避免重复录入, 外联会沟通录入, 这里不写入. todo // 目的地项目组的订单为了避免重复录入, 外联会沟通录入, 这里不写入. todo
// 代收 // 代收
if (isset($detail_jsonResp->orderDetail->replaceCollections) && ! in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest")) ) { if (isset($detail_jsonResp->orderDetail->replaceCollections) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->replaceCollections as $krc => $vrc) { foreach ($detail_jsonResp->orderDetail->replaceCollections as $krc => $vrc) {
// if ($vrc->reviewStatus == 0) { // if ($vrc->reviewStatus == 0) {
// continue; // continue;
@ -468,7 +472,7 @@ class TulanduoApi extends CI_Controller
} }
} }
// 代付 // 代付
if (isset($detail_jsonResp->orderDetail->replacePays) && ! in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest")) ) { if (isset($detail_jsonResp->orderDetail->replacePays) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->replacePays as $krp => $vrp) { foreach ($detail_jsonResp->orderDetail->replacePays as $krp => $vrp) {
// if ($vrp->reviewStatus == 0) { // if ($vrp->reviewStatus == 0) {
// continue; // continue;
@ -830,7 +834,9 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
$temp_array[0] = strrchr($temp_array[0], " ") ? mb_strstr($temp_array[0], " ",true) : $temp_array[0]; $temp_array[0] = strrchr($temp_array[0], " ") ? mb_strstr($temp_array[0], " ",true) : $temp_array[0];
$tmp_groupCode = explode("-", trim($temp_array[0])); $tmp_groupCode = explode("-", trim($temp_array[0]));
$real_groupCode = $tmp_groupCode[0] . "-"; $real_groupCode = $tmp_groupCode[0] . "-";
$real_groupCode .= mb_strstr($tmp_groupCode[1], "", true)!==false ? mb_strstr($tmp_groupCode[1], "", true) : $tmp_groupCode[1]; if (isset($tmp_groupCode[1])) {
$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)); $real_groupCode = mb_ereg_replace('( )', '', trim($real_groupCode));
return $real_groupCode; return $real_groupCode;
} }

@ -145,17 +145,18 @@ class Orders_model extends CI_Model {
if ($startDate !== NULL) { if ($startDate !== NULL) {
$sql .= " and gci.GCI_travelDate between '$startDate' and '$endDate' "; // test $sql .= " and gci.GCI_travelDate between '$startDate' and '$endDate' "; // test
} }
$sql .= "UNION SELECT top 50 // $sql .= "UNION SELECT top 50
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, // 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.* // cold.COLD_PlanVEI_SN, gci.*
FROM GroupCombineInfo gci // 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_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 // left JOIN BIZ_ConfirmLineDetail cold ON cold.COLD_COLI_SN=coli.COLI_SN
WHERE 1=1 // WHERE 1=1
and COLI_OPI_ID=435 and COLI_Price is null // and not exists (
order by GCI_travelDate"; // select * from BIZ_GroupAccountInfo where GAI_COLI_SN=COLI_SN
// -- and (GCI_combineNo='' or GCI_combineNo is null) // )
// -- and GCI_travelDate < GETDATE() // and COLI_OPI_ID=435
// order by GCI_travelDate";
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
return $query->result(); return $query->result();
} }
@ -518,12 +519,14 @@ class Orders_model extends CI_Model {
$gri_query = $this->HT->query($gri_sql); $gri_query = $this->HT->query($gri_sql);
if ($gri_query->num_rows() > 0) { if ($gri_query->num_rows() > 0) {
$this->GRI_SN = $gri_query->row()->GRI_SN; $this->GRI_SN = $gri_query->row()->GRI_SN;
$this->GRI_No = $gri_query->row()->GRI_No;
$this->GRI_operator = $gri_query->row()->GRI_operator; $this->GRI_operator = $gri_query->row()->GRI_operator;
$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 $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 FROM BIZ_ConfirmLineInfo coli
inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN
LEFT JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN LEFT JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN
where COLI_GRI_SN=" . $this->GRI_SN; where COLI_GroupCode like '%$code%' ";
// where COLI_GRI_SN=" . $this->GRI_SN;
$coli_query = $this->HT->query($coli_sql); $coli_query = $this->HT->query($coli_sql);
if ($coli_query->num_rows() > 0) { if ($coli_query->num_rows() > 0) {
$this->BIZ_COLI_SN = $coli_query->row()->COLI_SN; $this->BIZ_COLI_SN = $coli_query->row()->COLI_SN;

Loading…
Cancel
Save