|
|
@ -227,6 +227,7 @@ class TulanduoApi extends CI_Controller
|
|
|
|
$this->Orders_model->biz_groupcombineinfo_save();
|
|
|
|
$this->Orders_model->biz_groupcombineinfo_save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log_message('error',"Got order list from TuLanDuo. count: " . $resp_arr["responseData"]["totalRows"] . " Insert COLI : " . $cnt);
|
|
|
|
echo "Got order list from TuLanDuo. count: " . $resp_arr["responseData"]["totalRows"] . "\r\n";
|
|
|
|
echo "Got order list from TuLanDuo. count: " . $resp_arr["responseData"]["totalRows"] . "\r\n";
|
|
|
|
echo "Insert COLI : " . $cnt . "\r\n";
|
|
|
|
echo "Insert COLI : " . $cnt . "\r\n";
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -239,6 +240,9 @@ class TulanduoApi extends CI_Controller
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function insert_HT_order_operation($coli_sn=null)
|
|
|
|
public function insert_HT_order_operation($coli_sn=null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// if ($coli_sn == null) {
|
|
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
|
|
// }
|
|
|
|
log_message('error','get_order_operation From TuLanDuo ');
|
|
|
|
log_message('error','get_order_operation From TuLanDuo ');
|
|
|
|
$this->load->model('Order_update');
|
|
|
|
$this->load->model('Order_update');
|
|
|
|
if ($coli_sn !== null) {
|
|
|
|
if ($coli_sn !== null) {
|
|
|
@ -247,11 +251,12 @@ class TulanduoApi extends CI_Controller
|
|
|
|
// $startDate = ('2018-04-21');
|
|
|
|
// $startDate = ('2018-04-21');
|
|
|
|
// $endDate = ('2018-04-22'); // test
|
|
|
|
// $endDate = ('2018-04-22'); // test
|
|
|
|
$startDate = date('Y-m-d');
|
|
|
|
$startDate = date('Y-m-d');
|
|
|
|
$endDate = date('Y-m-d', strtotime("+4 days"));
|
|
|
|
$endDate = date('Y-m-d', strtotime("+7 days"));
|
|
|
|
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $startDate, $endDate);
|
|
|
|
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $startDate, $endDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$unique_orderGroupCombine = array();
|
|
|
|
$unique_orderGroupCombine = array();
|
|
|
|
$unique_order = array();
|
|
|
|
$unique_order = array();
|
|
|
|
|
|
|
|
$cnt = 0;
|
|
|
|
foreach ($to_update_list as $key => $order) {
|
|
|
|
foreach ($to_update_list as $key => $order) {
|
|
|
|
if (in_array($order->GCI_VendorOrderId, $unique_order)) {
|
|
|
|
if (in_array($order->GCI_VendorOrderId, $unique_order)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -295,43 +300,64 @@ class TulanduoApi extends CI_Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** HT 开始 */
|
|
|
|
/** HT 开始 */
|
|
|
|
/** UPDATE */
|
|
|
|
/** UPDATE */
|
|
|
|
/** BIZ_ConfirmLineInfo */
|
|
|
|
$cnt++;
|
|
|
|
$this->Order_update->coli_where_update = " COLI_SN=" . $order->COLI_SN;
|
|
|
|
|
|
|
|
$old_memo = mb_strstr($order->COLI_Memo, "orderRemark", true)!==false ? mb_strstr($order->COLI_Memo, "orderRemark", true) : $order->COLI_Memo;
|
|
|
|
|
|
|
|
$new_memo = trim($detail_jsonResp->orderDetail->orderRemark)=="" ? $old_memo : $old_memo . " orderRemark\r\n" . $detail_jsonResp->orderDetail->orderRemark . "\r\n";
|
|
|
|
|
|
|
|
$old_detail = mb_strstr($order->COLI_OrderDetailText, "operations", true)!==false ? mb_strstr($order->COLI_OrderDetailText, "operations", true) : $order->COLI_OrderDetailText;
|
|
|
|
|
|
|
|
$new_detail = trim($allDetails_to_HT)=="" ? $old_detail : $old_detail . " operations\r\n" . $allDetails_to_HT . "\r\n";
|
|
|
|
|
|
|
|
$coli_update_column = array(
|
|
|
|
|
|
|
|
"COLI_Memo" => $new_memo
|
|
|
|
|
|
|
|
,"COLI_OrderDetailText" => $new_detail
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->Order_update->biz_confirmlineinfo_update($coli_update_column);
|
|
|
|
|
|
|
|
/** BIZ_ConfirmLineDetail */ // nothing to update
|
|
|
|
|
|
|
|
/** biz_groupcombineinfo */
|
|
|
|
|
|
|
|
$this->Order_update->gci_where_update = " GCI_SN=" . $order->GCI_SN;
|
|
|
|
|
|
|
|
$vei_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] ? $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] : $order->COLD_PlanVEI_SN;
|
|
|
|
$vei_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] ? $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] : $order->COLD_PlanVEI_SN;
|
|
|
|
|
|
|
|
$getInfo_byGroupCode = null;
|
|
|
|
|
|
|
|
if (in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) {
|
|
|
|
|
|
|
|
$real_groupCode = $this->analysis_groupCode($detail_jsonResp->orderDetail->agcOrderNo);
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
$coli_sn = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_SN : $order->COLI_SN;
|
|
|
|
|
|
|
|
$coli_id = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_ID : $order->COLI_ID;
|
|
|
|
|
|
|
|
$coli_memo = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_Memo : $order->COLI_Memo;
|
|
|
|
|
|
|
|
$coli_orderdetailtext = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_OrderDetailText : $order->COLI_OrderDetailText;
|
|
|
|
|
|
|
|
$cold_sn = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLD_SN : $order->COLD_SN;
|
|
|
|
|
|
|
|
// HT 订单有重复时, 以图兰朵的团号为正确的订单, 原本已录入的设为无效
|
|
|
|
|
|
|
|
if ($getInfo_byGroupCode === null) {
|
|
|
|
|
|
|
|
} elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) {
|
|
|
|
|
|
|
|
log_message('error','原订单' . $order->COLI_ID);
|
|
|
|
|
|
|
|
$allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID;
|
|
|
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/** biz_groupcombineinfo */
|
|
|
|
|
|
|
|
$this->Order_update->gci_where_update = " GCI_VEI_SN=$vei_SN and GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "'";
|
|
|
|
$gci_update_column = array(
|
|
|
|
$gci_update_column = array(
|
|
|
|
"GCI_combineNo" => isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : null
|
|
|
|
"GCI_combineNo" => isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : null
|
|
|
|
,"GCI_VEI_SN" => $vei_SN
|
|
|
|
,"GCI_VEI_SN" => $vei_SN
|
|
|
|
|
|
|
|
,"GCI_GRI_SN" => $groupSN
|
|
|
|
,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate
|
|
|
|
,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate
|
|
|
|
,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate
|
|
|
|
,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate
|
|
|
|
,"GCI_createTime" => date('Y-m-d H:i:s')
|
|
|
|
,"GCI_createTime" => date('Y-m-d H:i:s')
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$this->Order_update->biz_groupcombineinfo_update($gci_update_column);
|
|
|
|
$this->Order_update->biz_groupcombineinfo_update($gci_update_column);
|
|
|
|
|
|
|
|
/** BIZ_ConfirmLineInfo */
|
|
|
|
|
|
|
|
$this->Order_update->coli_where_update = " COLI_SN=" . $coli_sn;
|
|
|
|
|
|
|
|
$old_memo = mb_strstr($coli_memo, " orderRemark", true)!==false ? mb_strstr($coli_memo, " orderRemark", true) : $coli_memo;
|
|
|
|
|
|
|
|
$new_memo = trim($detail_jsonResp->orderDetail->orderRemark)=="" ? $old_memo : $old_memo . " orderRemark\r\n" . $detail_jsonResp->orderDetail->orderRemark . "\r\n";
|
|
|
|
|
|
|
|
$old_detail = mb_strstr($coli_orderdetailtext, " operations", true)!==false ? mb_strstr($coli_orderdetailtext, " operations", true) : $coli_orderdetailtext;
|
|
|
|
|
|
|
|
$new_detail = trim($allDetails_to_HT)=="" ? $old_detail : $old_detail . " operations\r\n" . $allDetails_to_HT . "\r\n";
|
|
|
|
|
|
|
|
$coli_update_column = array(
|
|
|
|
|
|
|
|
"COLI_Memo" => $new_memo
|
|
|
|
|
|
|
|
,"COLI_OrderDetailText" => $new_detail
|
|
|
|
|
|
|
|
,"COLI_State" => 7
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->Order_update->biz_confirmlineinfo_update($coli_update_column);
|
|
|
|
|
|
|
|
/** BIZ_ConfirmLineDetail */ // nothing to update
|
|
|
|
/** INSERT */
|
|
|
|
/** INSERT */
|
|
|
|
/*BIZ_BookPeople*/
|
|
|
|
/*BIZ_BookPeople*/
|
|
|
|
if ($this->Orders_model->bookpeople_exist($order->COLD_SN) === array()) {
|
|
|
|
if ($this->Orders_model->bookpeople_exist($cold_sn) === array()) {
|
|
|
|
foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) {
|
|
|
|
foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) {
|
|
|
|
$this->Orders_model->BPE_FirstName = $vd->name;
|
|
|
|
$this->Orders_model->BPE_FirstName = $vd->name;
|
|
|
|
$this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2;
|
|
|
|
$this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2;
|
|
|
|
$this->Orders_model->BPE_Passport = $vd->documentNo;
|
|
|
|
$this->Orders_model->BPE_Passport = $vd->documentNo;
|
|
|
|
$bpe_sn[] = $this->Orders_model->biz_book_people_save();
|
|
|
|
$bpe_sn[] = $this->Orders_model->biz_book_people_save();
|
|
|
|
// BIZ_BookPeopleList
|
|
|
|
// BIZ_BookPeopleList
|
|
|
|
$this->Orders_model->biz_bookpeople_List_save($order->COLD_SN, $this->Orders_model->BPE_SN);
|
|
|
|
$this->Orders_model->biz_bookpeople_List_save($cold_sn, $this->Orders_model->BPE_SN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*BIZ_PackageOrderInfo*/
|
|
|
|
/*BIZ_PackageOrderInfo*/
|
|
|
|
$this->Orders_model->POI_COLD_SN = $order->COLD_SN;
|
|
|
|
$this->Orders_model->POI_COLD_SN = $cold_sn;
|
|
|
|
$this->Orders_model->POI_Time = $detail_jsonResp->orderDetail->travelDate;
|
|
|
|
$this->Orders_model->POI_Time = $detail_jsonResp->orderDetail->travelDate;
|
|
|
|
$this->Orders_model->POI_Hotel = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodation;
|
|
|
|
$this->Orders_model->POI_Hotel = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodation;
|
|
|
|
$this->Orders_model->POI_HotelAddress = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodationAddress;
|
|
|
|
$this->Orders_model->POI_HotelAddress = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodationAddress;
|
|
|
@ -343,20 +369,24 @@ class TulanduoApi extends CI_Controller
|
|
|
|
// 团款, 只有其他社的订单, 目的地项目组的团款已经直接收入海纳账户
|
|
|
|
// 团款, 只有其他社的订单, 目的地项目组的团款已经直接收入海纳账户
|
|
|
|
$paytype = 15006; // 地接代收
|
|
|
|
$paytype = 15006; // 地接代收
|
|
|
|
$pay_currency = 'RMB';
|
|
|
|
$pay_currency = 'RMB';
|
|
|
|
|
|
|
|
$auto_text = "dataAutoEnter ";
|
|
|
|
// 删除旧的录入
|
|
|
|
// 删除旧的录入
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_cut($order->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) && ! in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest")) ) {
|
|
|
|
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;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
$this->Orders_model->GAI_COLI_SN = $order->COLI_SN;
|
|
|
|
$this->Orders_model->GAI_Operator = 435;
|
|
|
|
$this->Orders_model->GAI_GRI_SN = $order->COLI_GRI_SN;
|
|
|
|
$this->Orders_model->GAI_COLI_SN = $coli_sn;
|
|
|
|
$this->Orders_model->GAI_COLI_ID = $order->COLI_ID;
|
|
|
|
$this->Orders_model->GAI_GRI_SN = $groupSN;
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_COLI_ID = $coli_id;
|
|
|
|
$this->Orders_model->GAI_Type = $paytype;
|
|
|
|
$this->Orders_model->GAI_Type = $paytype;
|
|
|
|
$this->Orders_model->GAI_SQJE = $vtf->sumMoney;
|
|
|
|
$this->Orders_model->GAI_SQJE = $vtf->sumMoney;
|
|
|
|
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
|
|
|
|
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
|
|
|
|
$this->Orders_model->GAI_Memo = $vtf->type . ", " . $vtf->remark;
|
|
|
|
$this->Orders_model->GAI_SSJE = $vtf->sumMoney;
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_Memo = $auto_text . "团款" . $vtf->type . ", " . $vtf->remark;
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_save();
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -366,13 +396,16 @@ class TulanduoApi extends CI_Controller
|
|
|
|
// if ($vrc->reviewStatus == 0) {
|
|
|
|
// if ($vrc->reviewStatus == 0) {
|
|
|
|
// continue;
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
$this->Orders_model->GAI_COLI_SN = $order->COLI_SN;
|
|
|
|
$this->Orders_model->GAI_Operator = 435;
|
|
|
|
$this->Orders_model->GAI_GRI_SN = $order->COLI_GRI_SN;
|
|
|
|
$this->Orders_model->GAI_COLI_SN = $coli_sn;
|
|
|
|
$this->Orders_model->GAI_COLI_ID = $order->COLI_ID;
|
|
|
|
$this->Orders_model->GAI_GRI_SN = $groupSN;
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_COLI_ID = $coli_id;
|
|
|
|
$this->Orders_model->GAI_Type = $paytype;
|
|
|
|
$this->Orders_model->GAI_Type = $paytype;
|
|
|
|
$this->Orders_model->GAI_SQJE = $vrc->money;
|
|
|
|
$this->Orders_model->GAI_SQJE = $vrc->money;
|
|
|
|
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
|
|
|
|
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
|
|
|
|
$this->Orders_model->GAI_Memo = $vrc->type . ", " . $vrc->remark;
|
|
|
|
$this->Orders_model->GAI_SSJE = $vrc->money;
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_Memo = $auto_text . "代收" . $vrc->type . ", " . $vrc->remark;
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_save();
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -382,13 +415,16 @@ class TulanduoApi extends CI_Controller
|
|
|
|
// if ($vrp->reviewStatus == 0) {
|
|
|
|
// if ($vrp->reviewStatus == 0) {
|
|
|
|
// continue;
|
|
|
|
// continue;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
$this->Orders_model->GAI_COLI_SN = $order->COLI_SN;
|
|
|
|
$this->Orders_model->GAI_Operator = 435;
|
|
|
|
$this->Orders_model->GAI_GRI_SN = $order->COLI_GRI_SN;
|
|
|
|
$this->Orders_model->GAI_COLI_SN = $coli_sn;
|
|
|
|
$this->Orders_model->GAI_COLI_ID = $order->COLI_ID;
|
|
|
|
$this->Orders_model->GAI_GRI_SN = $groupSN;
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_COLI_ID = $coli_id;
|
|
|
|
$this->Orders_model->GAI_Type = $paytype;
|
|
|
|
$this->Orders_model->GAI_Type = $paytype;
|
|
|
|
$this->Orders_model->GAI_SQJE = "-" . $vrp->money;
|
|
|
|
$this->Orders_model->GAI_SQJE = "-" . $vrp->money;
|
|
|
|
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
|
|
|
|
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
|
|
|
|
$this->Orders_model->GAI_Memo = $vrp->type . ", " . $vrp->remark;
|
|
|
|
$this->Orders_model->GAI_SSJE = $vrp->money;
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
|
|
|
|
|
|
|
|
$this->Orders_model->GAI_Memo = $auto_text . $vrp->type . ", " . $vrp->remark;
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_save();
|
|
|
|
$this->Orders_model->biz_groupaccountinfo_save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -488,7 +524,8 @@ class TulanduoApi extends CI_Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // end foreach order
|
|
|
|
} // end foreach order
|
|
|
|
echo "Got order from TuLanDuo, count: " . count($to_update_list);
|
|
|
|
log_message('error',"Got order operations from TuLanDuo, count: " . count($cnt));
|
|
|
|
|
|
|
|
echo "Got order operations from TuLanDuo, count: " . count($cnt);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -499,9 +536,10 @@ class TulanduoApi extends CI_Controller
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function order_cancel($COLI_ID="")
|
|
|
|
public function order_cancel($COLI_ID="")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
log_message('error','修改为不成行 order_cancel' . $COLI_ID);
|
|
|
|
/** UPDATE HT */
|
|
|
|
/** UPDATE HT */
|
|
|
|
/** BIZ_ConfirmLineInfo */
|
|
|
|
/** BIZ_ConfirmLineInfo */
|
|
|
|
$this->Order_update->coli_where_update = " COLI_ID=" . $COLI_ID;
|
|
|
|
$this->Order_update->coli_where_update = " COLI_ID='" . $COLI_ID . "'";
|
|
|
|
$coli_update_column = array(
|
|
|
|
$coli_update_column = array(
|
|
|
|
"COLI_State" => 40
|
|
|
|
"COLI_State" => 40
|
|
|
|
);
|
|
|
|
);
|
|
|
|