diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 1619f82e..545a94be 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -786,7 +786,8 @@ class Index extends CI_Controller { //根据订单号查找外联信息 $orderid_info = json_decode($orderid_info); - $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + $handpick = empty($pn_txn_id) ? false : TRUE; + $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); // for trippest tourMaster 2018.05.28 if ($orderid_info->ordertype == 'TP') { @@ -1222,7 +1223,7 @@ class Index extends CI_Controller { $orderid_info = $this->analysis_orderid($neworder); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, TRUE); if (!empty($advisor_info)) { $this->Note_model->set_invoice($pn_txn_id, $neworder); $this->send_note($pn_txn_id, $old_ssje); diff --git a/webht/third_party/paypal/models/paypal_model.php b/webht/third_party/paypal/models/paypal_model.php index edf08fe2..5ee4b9ad 100644 --- a/webht/third_party/paypal/models/paypal_model.php +++ b/webht/third_party/paypal/models/paypal_model.php @@ -14,7 +14,7 @@ class Paypal_model extends CI_Model { } //根据订单号获取外联邮箱 - public function get_order($COLI_ID, $orderinfo = false, $ordertype = 'N') { + public function get_order($COLI_ID, $orderinfo = false, $ordertype = 'N', $handpick=false) { $result = ''; $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T @@ -29,9 +29,13 @@ class Paypal_model extends CI_Model { if (empty($result) && ($ordertype == 'T')) { $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN - where COLI_ID like '%$COLI_ID'"; + where COLI_ID like '%$COLI_ID' + order by CHARINDEX('$COLI_ID', COLI_ID) "; $query = $this->HT->query($sql); $result = $query->result(); + if ($handpick === TRUE) { + $result = array($result[0]); + } } //查传统订单add_code,网前实时支付会先生成一个临时订单号存在add_code里,如订单45103248