From 372be829c519c66abab2e067220ce4c6c80a6a0a Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 20 Nov 2018 11:55:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E9=80=81=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E7=9A=84=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vendorPlanSync/controllers/Tulanduo.php | 22 ++++--------- .../vendorPlanSync/controllers/index.php | 31 +++++++++++++------ .../vendorPlanSync/libraries/vendor.php | 24 ++++++++++++++ .../vendorPlanSync/models/Group_model.php | 4 +-- 4 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 webht/third_party/vendorPlanSync/libraries/vendor.php diff --git a/webht/third_party/vendorPlanSync/controllers/Tulanduo.php b/webht/third_party/vendorPlanSync/controllers/Tulanduo.php index 207d6852..ca706f63 100644 --- a/webht/third_party/vendorPlanSync/controllers/Tulanduo.php +++ b/webht/third_party/vendorPlanSync/controllers/Tulanduo.php @@ -67,16 +67,8 @@ class Tulanduo extends CI_Controller $this->vendor_ids = $this->trippest->tulanduo_vei_sn; } - public function order_push($GRI_SN=0) + public function order_push($order=null) { - $start_date = date('Y-m-d'); - $end_date = date('Y-m-d 23:59:59', strtotime("+2 months")); - $vei_sn_str = implode(",", $this->vendor_ids); - $ready_to_send = $this->Group_model->get_plan_not_received(1, $vei_sn_str, $GRI_SN, $start_date, $end_date); - if (empty($ready_to_send)) { - return; - } - $order = $ready_to_send[0]; // 目的地计划 if (strval($order->GRI_OrderType) === "227002" && strval($order->department) === "30") { return $this->push_trippest($order); @@ -88,8 +80,7 @@ class Tulanduo extends CI_Controller if (strval($order->GRI_OrderType) === "227001") { } - return $this->output->set_output("not trippest"); - // return $this->output->set_content_type('application/json')->set_output(json_encode($order)); + return "[Tulanduo>order_push] No function match. "; } /*! @@ -99,8 +90,8 @@ class Tulanduo extends CI_Controller */ public function push_trippest($vas=null) { - // exit(); - /** 目的地 test */ + return "[Tulanduo>push_trippest] Done. "; + /** 目的地 */ $userId = $this->send_host["30"]["userId"]; $userKey = $this->send_host["30"]["key"]; @@ -116,7 +107,7 @@ class Tulanduo extends CI_Controller $change_info = str_replace("\n", "
", $change_info); $vei_sn_str = implode(",", $this->vendor_ids); $orderinfo = $this->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str); - if(empty($orderinfo)) {return;} + if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";} $COLI_ID = $orderinfo[0]->COLI_ID; $set_pvt = strval($orderinfo[0]->COLI_PVT); $travelFees = $this->BIZ_order->get_paymentDetails($COLI_ID); @@ -372,8 +363,7 @@ class Tulanduo extends CI_Controller $this->Group_model->set_plan_received($vas_sn); } } - echo "Order Push done."; - return; + return "Order Push done. "; } public function tourguide_update($input, $vps, $eva) diff --git a/webht/third_party/vendorPlanSync/controllers/index.php b/webht/third_party/vendorPlanSync/controllers/index.php index 82e4cb6a..92071230 100644 --- a/webht/third_party/vendorPlanSync/controllers/index.php +++ b/webht/third_party/vendorPlanSync/controllers/index.php @@ -8,7 +8,7 @@ class Index extends CI_Controller { mb_regex_encoding("UTF-8"); bcscale(4); $this->load->helper('array'); - $this->load->library('trippest'); + $this->load->library('vendor'); $this->load->model('BIZ_Orders_model'); $this->load->model('Group_model'); } @@ -19,11 +19,23 @@ class Index extends CI_Controller { return $this->output->set_content_type('application/json')->set_output(json_encode($vendor_plan)); } - public function push($COLI_ID) + public function push($GRI_SN=0) { - $orderinfo = $this->BIZ_Orders_model->get_orderinfo_detail($COLI_ID); - if(empty($orderinfo)) {return;} - return $this->output->set_content_type('application/json')->set_output(json_encode($orderinfo)); + $start_date = date('Y-m-d'); + $end_date = date('Y-m-d 23:59:59', strtotime("+2 months")); + $ready_to_send = $this->Group_model->get_plan_not_received(1, $GRI_SN, $start_date, $end_date); + if (empty($ready_to_send)) { + return $this->output->set_output("empty"); + } + $order = $ready_to_send[0]; + if (isset($this->vendor->vendor_fun[strval($order->VAS_VEI_SN)])) { + $controller_name = $this->vendor->vendor_fun[strval($order->VAS_VEI_SN)]; + require_once($controller_name . ".php"); + $vendor_class = new $controller_name(); + $call_fun = $vendor_class->order_push($order); + return $this->output->set_output($call_fun . $order->GRI_SN); + } + return $this->output->set_output("Not found vendor function. " . $order->GRI_SN); } /** @@ -131,10 +143,11 @@ class Index extends CI_Controller { return $ret; } // 需要填写导游, 则根据不同的供应商调用相应的方法 - if (in_array($input['openId'], $this->trippest->tulanduo_vei_sn)) { - require_once('Tulanduo.php'); - $tulanduo_fun = new Tulanduo(); - return $tulanduo_fun->tourguide_update($input, $vps, $eva); + if (isset($this->vendor->vendor_fun[strval($input['openId'])])) { + $controller_name = $this->vendor->vendor_fun[strval($input['openId'])]; + require_once($controller_name . '.php'); + $vendor_class = new $controller_name(); + return $vendor_class->tourguide_update($input, $vps, $eva); } return $ret; } diff --git a/webht/third_party/vendorPlanSync/libraries/vendor.php b/webht/third_party/vendorPlanSync/libraries/vendor.php new file mode 100644 index 00000000..935e0ba8 --- /dev/null +++ b/webht/third_party/vendorPlanSync/libraries/vendor.php @@ -0,0 +1,24 @@ +ci =& get_instance(); + } + + public $vendor_fun = array( + "1343" => "Tulanduo" + ,"29188" => "Tulanduo" + ,"30548" => "Tulanduo" + ); + + + +} + +/* End of file vendor.php */ +/* Location: ./third_party/vendorPlanSync/libraries/vendor.php */ diff --git a/webht/third_party/vendorPlanSync/models/Group_model.php b/webht/third_party/vendorPlanSync/models/Group_model.php index d15a8f31..e7aa68c1 100644 --- a/webht/third_party/vendorPlanSync/models/Group_model.php +++ b/webht/third_party/vendorPlanSync/models/Group_model.php @@ -8,7 +8,7 @@ class Group_model extends CI_Model { $this->HT = $this->load->database('HT', TRUE); } - public function get_plan_not_received($top=1, $vei_sn_str, $gri_sn=0, $start_date=null, $end_date=null) + public function get_plan_not_received($top=1, $gri_sn=0, $start_date=null, $end_date=null) { $top_sql = $top>0 ? " TOP $top " : ""; $gri_sql = $gri_sn===0 ? "" : " and GRI_SN=$gri_sn "; @@ -25,7 +25,7 @@ class Group_model extends CI_Model { and VAS_IsSendSucceed=1 and VAS_IsConfirm=0 and EOI_GetDate between '$start_date' and '$end_date' - and VAS_VEI_SN in ($vei_sn_str) + -- and VAS_VEI_SN in (29188, 1343, 30548) -- test and GRI_OrderType=227002 -- test and (VAS_IsReceive=0 or (VAS_SendTime > ISNULL(VAS_ReceiveTime,0))) "; $sql .= " order by EOI_GetDate asc, vas.VAS_IsConfirm asc";