修改发送计划的入口

feature/pay
lyt 7 years ago
parent a668669d86
commit 372be829c5

@ -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", "<br>", $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)

@ -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;
}

@ -0,0 +1,24 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Vendor
{
protected $ci;
public function __construct()
{
$this->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 */

@ -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";

Loading…
Cancel
Save