"'BJSIC-41','BJSIC-42'" ,"BJSIC-43" => "'BJSIC-41','BJSIC-42','BJSIC-43'" ); public $special_route_name = array( "BJSIC-42" => "北京精品两日游(目的地)" ,"BJSIC-43" => "北京精品三日游(目的地)" ); public $city_info = array( "北京分公司" => array( "PlanVEI_SN" => 1343, "COLI_sourcetype" => 32090, "routeType" => "北京目的地线路", "GRI_after" => "BJ" ), "西安分公司" => array( "PlanVEI_SN" => 30548, "COLI_sourcetype" => 32116, "routeType" => "西安目的地线路", "GRI_after" => "XA" ), "上海分公司" => array( "PlanVEI_SN" => 29188, "COLI_sourcetype" => 32112, "routeType" => "上海目的地线路", "GRI_after" => "SH" ) ); // test // public $list_url = "http://dj.ltsoftware.net:9901/action/api/searchRouteOrder/"; // public $detail_url = "http://dj.ltsoftware.net:9901/action/api/detailRouteOrder/"; public $neworder_url = "http://dj.ltsoftware.net:9901/action/api/addOrUpdateRouteOrder/"; // Live public $list_url = "http://djb3c.ltsoftware.net:9921/action/api/searchRouteOrder/"; public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/"; // public $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/"; // 发送到图兰朵系统接口的参数jsonParams public $params; public function __construct(){ parent::__construct(); $this->load->model('Orders_model'); $this->load->model('Order_insert'); $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order'); $this->load->helper('array'); // $this->output->enable_profiler(TRUE); $this->params = new stdClass(); /** test */ // $this->userId = "358"; // $this->key = "a08f26ddc5b1bd4c8e5eafcac28fc1ec"; /** Live */ // 目的地 $this->userId = "1134"; $this->key = "73d180d05d425fd192e1c5b3097e75ff"; // 桂林海纳国旅 // $this->userId = "18"; // $this->key = "d05c25e6e6c5d4898161e0aaf700d9c7"; } public function get_orderlist() { $this->tld_order->setUserId($this->userId) ->setKey($this->key) ->setPageSize(20) ->setPageIndex(1) ->setStartTravelDate("2018-04-18") ->setEndTravelDate("2018-04-18") // ->setStartOrderDate("2018-04-13") // ->setEndOrderDate("2018-04-13") ; $resp = $this->excute_curl($this->list_url, $this->tld_order); $resp_arr = json_decode($resp, true); if ($resp_arr['status'] !== 1) { log_message('error','TulanduoApi get_orderlist failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent())); return; } $all_list = $resp_arr["responseData"]["orders"]; $order_to_HT = array_map( function($ele){ if ( ! in_array($ele['agcName'], array("D目的地桂林组")) ) { return $ele; } },$resp_arr["responseData"]["orders"]); for($pi=2; $pi <= $resp_arr['responseData']['pageCount']; $pi++) { $this->tld_order->setPageIndex($pi); $f_resp = $this->excute_curl($this->list_url, $this->tld_order); $f_resp_arr = json_decode($f_resp, true); if ($resp_arr['status'] !== 1) { log_message('error','TulanduoApi get_orderlist failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent())); continue; } $f_order_to_HT = array_map( function($ele){ if ( ! in_array($ele['agcName'], array("D目的地桂林组")) ) { return $ele; } },$f_resp_arr["responseData"]["orders"]); $order_to_HT = array_filter(array_merge($order_to_HT, $f_order_to_HT)); $all_list = array_merge($all_list, $f_resp_arr["responseData"]["orders"]); } $cnt = 0; foreach ($all_list as $k => $vo) { $vo['agcOrderNo'] = mb_ereg_replace('(\s| )', '', $vo['agcOrderNo']); // 去掉中文的全角空格 $PAG_Code = $pag_sub = null; preg_match('^[a-zA-Z]+\-[0-9\-]+^', $this->characet($vo['routeName'], "UTF-8"), $temp_array); if (empty($temp_array) && isset($this->pag_no_tmp()[$vo['routeName']])) { // 旧的数据没有线路代号 $PAG_Code = $pag_sub = $this->pag_no_tmp()[$vo['routeName']]; $split_code = explode("-", $PAG_Code); $PAG_Code = $split_code[0] . "-" . $split_code[1]; isset($split_code[2]) ? $pag_sub=$split_code[2] : null; } else { log_message('error','未识别的线路名称 ' . $vo['orderId'] . " " . $vo['routeName'] . var_export($temp_array, 1)); $PAG_Code = $pag_sub = null; $split_code = explode("-", $temp_array[0]); $PAG_Code = $split_code[0] . "-" . $split_code[1]; isset($split_code[2]) ? $pag_sub=$split_code[2] : null; } $serviceSN = $this->Orders_model->get_packageSN($PAG_Code); $COLD_MemoText = 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']); // 查询订单是否已经录入过 if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组"))) { $tmp_groupCode = explode("-", $vo['agcOrderNo']); $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('(\s| )', '', $real_groupCode); // set BIZ_COLI_SN, GRI_SN at Orders_model $this->Orders_model->get_SN_by_groupCode($real_groupCode); } /** insert HT */ if ($this->Orders_model->BIZ_COLI_SN === null) { /** BIZ_Guest */ $this->Orders_model->GUT_LastName = $vo['customerName']; $this->Orders_model->biz_guest_save(); /** GRoupInfo */ $travelDate = new DateTime($vo['travelDate']); $leaveDate = new DateTime($vo['leaveDate']); $date_diff = $travelDate->diff($leaveDate); $this->Orders_model->GRI_No = $vo['agcOrderNo']; $this->Orders_model->GRI_OrderType = 227002; // 商务 $this->Orders_model->GRI_Name = ""; $this->Orders_model->GRI_PersonNum = $vo['adultNum']+$vo['childNum']; $this->Orders_model->GRI_Days = intval($date_diff->format('%R%a')+1); $this->Orders_model->GRI_IsCancel = 0; $this->Orders_model->DeleteFlag = 0; $this->Orders_model->groupinfo_save(); /**BIZ_ConfirmLineInfo*/ $this->Orders_model->BIZ_COLI_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null; $this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_No : ""; $this->Orders_model->BIZ_GUT_SN = $this->Orders_model->GUT_SN; $this->Orders_model->BIZ_COLI_ID = $this->Orders_model->biz_make_order_number(); $this->Orders_model->BIZ_COLI_ApplyDate = $vo['orderDate']; $this->Orders_model->BIZ_COLI_sourcetype = empty($this->city_info[$vo['operationDep']]) ? 32090 : $this->city_info[$vo['operationDep']]['COLI_sourcetype']; $this->Orders_model->BIZ_COLI_State = $vo['orderStatus'] == 1 ? 7 : 4; $this->Orders_model->BIZ_COLI_servicetype = 'D'; $this->Orders_model->BIZ_COLI_ConfirmType = 52001; $this->Orders_model->BIZ_COLI_Memo = ""; $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"; $this->Orders_model->COLD_ServiceSN = $serviceSN->PAG2_SN; $this->Orders_model->COLD_ServiceSN2 = $pag_sub; $this->Orders_model->COLD_ServiceCity = $serviceSN->PAG_CII_SN; $this->Orders_model->COLD_StartDate = $vo['travelDate']; $this->Orders_model->COLD_EndDate = $vo['leaveDate']; $this->Orders_model->COLD_PersonNum = $vo['adultNum']; $this->Orders_model->COLD_ChildNum = $vo['childNum']; $this->Orders_model->cold_state = $vo['orderStatus']==1 ? 7 : 4; // 7已确认(已收款) // 4 下计划未确认(已收款) $this->Orders_model->DeleteFlag = 0; $this->Orders_model->COLD_PlanVEI_SN = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN']; $this->Orders_model->COLD_MemoText = $COLD_MemoText; $this->Orders_model->biz_confirm_detail_save(); /** VendorArrangeState */ $vendor_contact = $this->Orders_model->get_vendorContact($this->Orders_model->COLD_PlanVEI_SN); $this->Order_insert->VAS_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null; $this->Order_insert->VAS_VEI_SN = $this->Orders_model->COLD_PlanVEI_SN; $this->Order_insert->VAS_IsSendSucceed = 1; $this->Order_insert->VAS_IsConfirm = $vo['orderStatus']; $this->Order_insert->VAS_IsCancel = 0; $this->Order_insert->VAS_SendTime = $vo['orderDate']; $this->Order_insert->VAS_ConfirmTime = $vo['orderStatus'] == 1 ? $vo['orderDate'] : null; $this->Order_insert->VAS_LMI_SN = !empty($vendor_contact) ? $vendor_contact->LMI_SN : null; $this->Order_insert->VAS_FaxNo = !empty($vendor_contact) ? $vendor_contact->LMI_AutoFax : null; $this->Order_insert->VAS_VendorEmail = !empty($vendor_contact) ? $vendor_contact->LMI_ListMail : null; $this->Order_insert->vendorarrangestate_save(); $cnt++; } if ($this->Orders_model->GCI_SN === null) { /*biz_groupcombineinfo*/ $this->Orders_model->GCI_combineNo = isset($vo['groupOrderNo']) ? $vo['groupOrderNo'] : ''; $this->Orders_model->GCI_COLI_SN = $this->Orders_model->BIZ_COLI_SN; $this->Orders_model->GCI_VendorOrderId = $vo['orderId']; $this->Orders_model->GCI_FromAgc = $vo['agcName']; $this->Orders_model->GCI_groupType = $vo['orderType']; $this->Orders_model->GCI_travelDate = $vo['travelDate']; $this->Orders_model->GCI_leaveDate = $vo['leaveDate']; $this->Orders_model->GCI_createTime = $vo['orderDate']; $this->Orders_model->biz_groupcombineinfo_save(); } } echo "Got order list from 图兰朵. count: " . $resp_arr["responseData"]["totalRows"] . "\r\n"; echo "Insert COLI : " . $cnt . "\r\n"; return; } public function update_HT_order_operation($coli_sn=null) { $this->load->model('Order_update'); if ($coli_sn !== null) { $to_update_list = $this->Orders_model->get_groupCombineInfo($coli_sn); } else { $startDate = date('Y-m-d'); $endDate = date('Y-m-d', strtotime("+1 days")); // test // $endDate = date('Y-m-d', strtotime("+4 days")); $to_update_list = $this->Orders_model->get_groupCombineInfo(0, $startDate, $endDate); } foreach ($to_update_list as $key => $order) { $this->tld_order->setOrderId($order->GCI_VendorOrderId) ->setUserId($this->userId) ->setKey($this->key); $detail_resp = $this->excute_curl($this->detail_url, $this->tld_order); $detail_jsonResp = json_decode($detail_resp); if ($detail_jsonResp->status !== 1) { log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . $this->tld_order->getBizContent()); return; } $allDetails_to_HT = "日程: "; foreach ($detail_jsonResp->orderDetail->scheduleDetails as $vsd) { $allDetails_to_HT .= $vsd->travelDate .": ". $vsd->title . "; "; } /** HT 开始 */ /** UPDATE */ /** BIZ_ConfirmLineInfo */ $this->Order_update->coli_where_update = " COLI_SN=" . $order->GCI_COLI_SN; $coli_update_column = array( "COLI_Memo" => $order->COLI_Memo . "\r\n" . $detail_jsonResp->orderDetail->orderRemark ,"COLI_OrderDetailText" => $order->COLI_OrderDetailText . "\r\n" // 调度信息加上以便在HT界面上显示 todo ); $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; $gci_update_column = array( "GCI_combineNo" => $detail_jsonResp->orderDetail->groupOrderNo ,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate ,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate ); $this->Order_update->biz_groupcombineinfo_update($gci_update_column); /** INSERT */ /*BIZ_BookPeople*/ foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) { $this->Orders_model->BPE_FirstName = $vd->name; $this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2; $this->Orders_model->BPE_Passport = $vd->documentNo; $bpe_sn[] = $this->Orders_model->biz_book_people_save(); // BIZ_BookPeopleList $this->Orders_model->biz_bookpeople_List_save($order->COLD_SN, $this->Orders_model->BPE_SN); } /*BIZ_PackageOrderInfo*/ $this->Orders_model->POI_COLD_SN = $order->COLD_SN; $this->Orders_model->POI_Time = $detail_jsonResp->orderDetail->travelDate; $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_HotelPhone = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodationTelNo; $this->Orders_model->POI_EndTime = $detail_jsonResp->orderDetail->leaveDate; $this->Orders_model->POI_QuotationType = 1; // 1 报价 2 网络支付价 3 促销价 $this->Orders_model->biz_packageorder_save(); /*BIZ_GroupCombineOperationDetail*/ // 门票 if (isset($detail_jsonResp->orderDetail->operationDetails->sceneryOperations) && empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "sceneryOperations")) ) { foreach ($detail_jsonResp->orderDetail->operationDetails->sceneryOperations as $ks => $vso) { $this->Orders_model->GCOD_GCI_combineNo = isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : ""; $this->Orders_model->GCOD_operationType = "sceneryOperations"; $this->Orders_model->GCOD_subType = $vso->type; $this->Orders_model->GCOD_title = $vso->name; $this->Orders_model->GCOD_startDate = $vso->useDate; $this->Orders_model->GCOD_endDate = $vso->useDate; $this->Orders_model->GCOD_useNum = $vso->useNum; $this->Orders_model->GCOD_sumMoney = $vso->sumMoney; $this->Orders_model->GCOD_remark = $vso->remark; $this->Orders_model->GCOD_dutyName = ""; $this->Orders_model->GCOD_dutyTel = null; $this->Orders_model->GCOD_dutyPhoto = null; $this->Orders_model->GCOD_standard = ""; $this->Orders_model->GCOD_carLicense = ""; $this->Orders_model->biz_groupcombineoperationdetail_save(); } } // 用房 ... // 用餐 if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) && empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "restraurantOperations"))) { foreach ($detail_jsonResp->orderDetail->operationDetails->restraurantOperations as $vro) { $this->Orders_model->GCOD_GCI_combineNo = isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : ""; $this->Orders_model->GCOD_operationType = "restraurantOperations"; $this->Orders_model->GCOD_subType = $vro->type; $this->Orders_model->GCOD_title = $vro->name; $this->Orders_model->GCOD_startDate = $vro->useDate; $this->Orders_model->GCOD_endDate = $vro->useDate; $this->Orders_model->GCOD_useNum = $vro->useNum; $this->Orders_model->GCOD_sumMoney = $vro->sumMoney; $this->Orders_model->GCOD_standard = $vro->standard; $this->Orders_model->GCOD_remark = $vro->remark; $this->Orders_model->GCOD_dutyName = ""; $this->Orders_model->GCOD_dutyTel = null; $this->Orders_model->GCOD_dutyPhoto = null; $this->Orders_model->GCOD_carLicense = ""; $this->Orders_model->biz_groupcombineoperationdetail_save(); } } // 用车 if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations) && empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "touristCarOperations"))) { foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vco) { $this->Orders_model->GCOD_GCI_combineNo = isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : ""; $this->Orders_model->GCOD_operationType = "touristCarOperations"; $this->Orders_model->GCOD_subType = $vco->type; $this->Orders_model->GCOD_title = $vco->name; $this->Orders_model->GCOD_dutyName = $vco->driver; $this->Orders_model->GCOD_dutyTel = $vco->driverTel; $this->Orders_model->GCOD_startDate = $vco->startDate; $this->Orders_model->GCOD_endDate = $vco->endDate; $this->Orders_model->GCOD_sumMoney = $vco->sumMoney; $this->Orders_model->GCOD_carLicense = $vco->carLicense; $this->Orders_model->GCOD_useNum = 1; $this->Orders_model->GCOD_standard = ""; $this->Orders_model->GCOD_dutyPhoto = null; $this->Orders_model->GCOD_remark = $vco->remark; $this->Orders_model->biz_groupcombineoperationdetail_save(); } } // 导游服务 if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) && empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "guiderOperations"))) { foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vgo) { $this->Orders_model->GCOD_GCI_combineNo = isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : ""; $this->Orders_model->GCOD_operationType = "guiderOperations"; $this->Orders_model->GCOD_subType = ""; $this->Orders_model->GCOD_title = ""; $this->Orders_model->GCOD_dutyName = $vgo->name; $this->Orders_model->GCOD_dutyTel = $vgo->mobelPhone; $this->Orders_model->GCOD_dutyPhoto = isset($vgo->guiderPhoto) ? $vgo->guiderPhoto : ''; $this->Orders_model->GCOD_startDate = $vgo->startDate; $this->Orders_model->GCOD_endDate = $vgo->endDate; $this->Orders_model->GCOD_sumMoney = $vgo->sumMoney; $this->Orders_model->GCOD_carLicense = ""; $this->Orders_model->GCOD_standard = ""; $this->Orders_model->GCOD_remark = $vgo->remark; $this->Orders_model->GCOD_useNum = 1; $this->Orders_model->biz_groupcombineoperationdetail_save(); } } } // end foreach order echo "Got order from 图兰朵, count: " . count($to_update_list); return; } public function order_push($COLI_ID='170809390') // test { // exit(); /** test */ $this->userId = "358"; $this->key = "a08f26ddc5b1bd4c8e5eafcac28fc1ec"; $this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder'); $orderinfo = $this->Orders_model->get_orderinfo_detail($COLI_ID); if(empty($orderinfo)) {return;} $COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $orderinfo )) ; $guestlist = $this->Orders_model->get_guestlist($COLD_SN_str); $scheduleDetails = $this->Orders_model->get_scheduleDetails($COLD_SN_str); $routeName = isset($this->special_route_name[$scheduleDetails[0]->PAG_Code]) ? $this->special_route_name[$scheduleDetails[0]->PAG_Code] : $scheduleDetails[0]->PAG2_Name; if (isset($this->special_route[$scheduleDetails[0]->PAG_Code])) { $scheduleDetails = $this->Orders_model->get_packageDetails($this->special_route[$scheduleDetails[0]->PAG_Code]); } $travelFees = $this->Orders_model->get_paymentDetails($COLI_ID); bcscale(4); $this->tldOrderBuilder->setUserId($this->userId) ->setKey($this->key) ->setOrderType(2) // todo ->setRouteName($routeName) ->setRouteType("北京目的地线路") // todo ->setAgcOrderNo($orderinfo[0]->COLI_GroupCode) // todo 加上 -BJ,-SH, -XA ->setAdultNum($orderinfo[0]->COLD_PersonNum) ->setChildNum($orderinfo[0]->COLD_ChildNum) ->setDestination("北京") // todo ->setTravelDate(strstr($orderinfo[0]->COLD_StartDate, " ", true)) ->setLeavedDate(strstr($orderinfo[0]->COLD_EndDate, " ", true)); foreach ($guestlist as $key => $vg) { $this->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName) ->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童")) ->setCustomersDocumentType($key, "护照") // Passport No. ->setCustomersDocumentNo($key, $vg->BPE_Passport) ->setCustomersOtherInfo($key, $this->Orders_model->GetNationalityName($orderinfo[0]->GUT_NationalityID)); } foreach ($scheduleDetails as $ks => $vs) { $this->tldOrderBuilder->setScheduleDetailsContent($ks, $vs->PAG2_Title) ->setScheduleDetailsTitle($ks, $vs->PAG2_Name) // ->set_scheduleDetails($ks, "traffic", ($vs->PAG_Vehicle>60001 ? 1 : 0)) ->setScheduleDetailsBreakFirst($ks, 0 ) ->setScheduleDetailsDinner($ks, (in_array($vs->PAG_Meal, array('61002', '61004')) ? 1 : 0) ) ->setScheduleDetailsLunch($ks, (in_array($vs->PAG_Meal, array('61003', '61004')) ? 1 : 0)); } foreach ($travelFees as $kf => $vf) { $this->tldOrderBuilder->setTravelFeesType($kf, "Per Group") ->setTravelFeesMoney($kf, $vf->GAI_SQJE) ->setTravelFeesNum($kf, 1) ->setTravelFeesUnit($kf, bcdiv($vf->GAI_SSJE, $vf->GAI_SQJE)) ->setTravelFeesSumMoney($kf, $vf->GAI_SSJE) ->setTravelFeesRemark($kf, $vf->GAI_Memo); } $resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder); /** BIZ_GroupCombineInfo */ if (json_decode($resp)->status == 1) { log_message('error','in GCI ' . json_decode($resp)->responseData->orderId); $this->Orders_model->GCI_COLI_SN = $orderinfo[0]->COLI_SN; $this->Orders_model->GCI_GRI_SN = $orderinfo[0]->COLI_GRI_SN; $this->Orders_model->GCI_VendorOrderId = json_decode($resp)->responseData->orderId; $this->Orders_model->GCI_FromAgc = ""; $this->Orders_model->biz_groupcombineinfo_save(); } return; } protected function excute_curl($url, $content_builder) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FAILONERROR, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Accept: application/json" )); // $params_str = ($this->characet(json_encode($this->params), "UTF-8")); $params_str = $content_builder->getBizContent(); $postBody = array('jsonParams' => $params_str, "notHander" => 1); if (is_string($params_str) && 0 < mb_strlen($params_str)) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postBody); } $reponse = curl_exec($ch); $eval_resp = json_decode($reponse); log_message('error', " curl postBodyString: ".json_encode($postBody)); if (curl_errno($ch) || $eval_resp->status == 0) { log_message('error', "curl error code: ".curl_error($ch) . $eval_resp->errMsg . "; curl postBodyString: ".json_encode($postBody)); } else { $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (200 !== $httpStatusCode) { log_message('error', "Request html Status Code: ".$httpStatusCode."; curl postBodyString: ".json_encode($postBody)); } } curl_close($ch); return $reponse; } /*! * 转换字符集编码 * @param $data * @param $targetCharset * @return string */ protected function characet($data, $targetCharset) { if (!empty($data)) { $fileType = "UTF-8"; if (strcasecmp($fileType, $targetCharset) != 0) { $data = mb_convert_encoding($data, $targetCharset, $fileType); // $data = iconv($fileType, $targetCharset.'//IGNORE', $data); } } return $data; } public function pag_no_tmp($routeName='') { return array( "故宫深度一日游(目的地)" => "BJSIC-44" ,"故宫深度游拼团(目的地)" => "BJSIC-44" ,"北京精品一日游(目的地)" => "BJSIC-41" ,"北京精品两日游(目的地)" => "BJSIC-42" ,"北京精品三日游(目的地)" => "BJSIC-43" ,"北京精品游D2(目的地)" => "BJSIC-42" ,"北京精品游D3(目的地)" => "BJSIC-43" ,"北京单租车服务(目的地)" => "BJALC-209" ,"北京市内-天津新港大车接送(目的地)" => "BJSIC-16" ,"天津新港-北京市内大车接送(目的地)" => "BJSIC-16" ,"箭扣-慕田峪徒步一日游(目的地)" => "BJSIC-45" ,"箭扣-慕田峪长城徒步拼团(目的地)" => "BJSIC-45" ,"司马台西-金山岭徒步一日游(目的地)" => "BJSIC-46" ,"司马台西-金山岭长城徒步拼团(目的地)" => "BJSIC-46" ,"慕田峪半日游拼团(目的地)" => "BJSIC-47" ,"古北口长城徒步一日游(目的地)" => "BJSIC-48" ,"半日游广场故宫拼团(目的地)" => "BJSIC-41" // ,=> ,"西安精品一日游(目的地)" => "XASIC-41" ,"西安精品两日游(目的地)" => "XASIC-42" ,"西安单租车服务(目的地)" => "XASIC-17" ,"西安单租车接送服务(目的地)" => "XASIC-17" ,"西安兵马俑精品一日游(目的地)" => "XASIC-41" ,"西安兵马俑精品半日游(目的地)" => "XASIC-15" ,"西安汉阳陵市内精品一日游(目的地)" => "XASIC-42" // ,=> ,"上海精品一日游(目的地)" => "SHSIC-41" ,"上海市内精品一日游(目的地)" => "SHSIC-42" ,"周庄锦溪精品一日游(目的地)" => "SHSIC-43" ,"上海单租车(目的地)" => "SHSIC-45" //"SHALC-6,7,8,9" ); } }