From decdd795b242e7ab09b41d1b4743c7657444783a Mon Sep 17 00:00:00 2001 From: lyt Date: Sun, 15 Jul 2018 12:05:11 +0800 Subject: [PATCH] =?UTF-8?q?ipaylinks=20=E6=9F=A5=E8=AF=A2=E6=9C=AA?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=9A=84=E8=AE=A2=E5=8D=95=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/AlipayTradeService.php | 1 - .../pay/controllers/iPayLinksService.php | 34 +++++++++++-------- .../pay/models/IPayLinks_model.php | 2 +- .../pay/views/alipay_note_setting.php | 2 +- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index f5a38bdc..78cc680b 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -369,7 +369,6 @@ class AlipayTradeService extends CI_Controller $this->Alipay_note_model->update_send($item->ALI_dealId, 'send'); continue; } - //添加支付信息入库 //没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据 if (!empty($orderid_info)) { diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php index 7979b89d..b29d61d9 100644 --- a/webht/third_party/pay/controllers/iPayLinksService.php +++ b/webht/third_party/pay/controllers/iPayLinksService.php @@ -257,18 +257,24 @@ class IPayLinksService extends CI_Controller return; } - public function query_pay($orderid,$day_offset = 3) + public function query_pay($day_offset = 3, $orderid=NULL) { $this->query_info_arr["queryOrderId"] = $this->create_guid(); $this->query_info_arr["orderId"] = $orderid; $this->query_info_arr["beginTime"] = date('YmdHis',strtotime("-$day_offset days")); $this->query_info_arr["endTime"] = date('YmdHis',strtotime("+$day_offset days")); - $this->query_info_arr["mode"] = 1; + $this->query_info_arr["mode"] = 2; $this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr); $resp = $this->curl($this->queryUrl,$this->query_info_arr); - // echo $resp; - var_export($resp); + $resp_obj = simplexml_load_string($resp); + foreach ($resp_obj->details->detail as $key => $query_order) { + $order = new stdClass(); + $order->check = true; + $order->data = $query_order; + $this->ipaylinks_notice($order); + } + // $this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp))); return; } @@ -335,7 +341,7 @@ class IPayLinksService extends CI_Controller foreach ($data['unsend_list'] as $item) { //已经发送的不处理,防止重复发送 - if ($item->IPL_sent == 'send') { + if ($item->IPL_sent == 'send' && empty($pn_txn_id)) { continue; } @@ -346,7 +352,7 @@ class IPayLinksService extends CI_Controller } //只处理完成状态,其他状态由陆燕处理 - if (strcmp(trim($item->IPL_resultCode), "0000")) { + if (strcmp(trim($item->IPL_resultCode), "0000") && empty($pn_txn_id)) { $this->Note_model->update_send($item->IPL_dealId, 'send'); continue; } @@ -384,7 +390,6 @@ class IPayLinksService extends CI_Controller $this->Note_model->update_send($item->IPL_dealId, 'send'); continue; } - //添加支付信息入库 //没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据 if (!empty($orderid_info)) { @@ -417,12 +422,14 @@ class IPayLinksService extends CI_Controller $item->IPL_dealId, $ht_memo ); - // 更新订单主表付款方式,防止没访问thankyou-train.asp - $this->IPayLinks_model->update_paymanner($GAI_COLI_SN); if ($advisor_info->COLI_Department == 10) { // 把订单状态设置为13-新订单已支付 $this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 13); } + // 更新订单主表付款方式,防止没访问thankyou-train.asp + if (empty($advisor_info->COLI_PayManner)) { + $this->IPayLinks_model->update_paymanner($GAI_COLI_SN); + } } } //更新还没有填的客邮和交易号de收款记录(传统订单) @@ -476,9 +483,8 @@ class IPayLinksService extends CI_Controller $subject2 = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / China Highlights'; // lang $remark_info = json_decode($item->IPL_memo); - $remark_info = json_decode($remark_info->remark); - $ln = $remark_info->ln; - $ln = $ln ? $ln : "en"; + (isset($remark_info->remark)) ? $remark_info = json_decode($remark_info->remark) : NULL; + $ln = (isset($remark_info->ln)) ? $remark_info->ln : "en"; $this->lang->load('ipl_common',$ln); $this->lang->load('ipl_buyer_email',$ln); $item->text = $this->lang->language; @@ -597,12 +603,12 @@ class IPayLinksService extends CI_Controller public function ipaylinks_notice($resp=NULL) { if ($resp !== NULL) { - $resp_arr = $resp; + $asyns_resp = $resp_arr = $resp; } else { $resp_arr = $this->input->post(); log_message('error','iPayLinks asyn notify: ' . $this->input->post("orderId")); + $asyns_resp = $this->verify_sign($resp_arr); } - $asyns_resp = $this->verify_sign($resp_arr); // 未得到结果 if (empty($asyns_resp->data->orderId)) { echo "200"; diff --git a/webht/third_party/pay/models/IPayLinks_model.php b/webht/third_party/pay/models/IPayLinks_model.php index b53568fa..49c3be6d 100644 --- a/webht/third_party/pay/models/IPayLinks_model.php +++ b/webht/third_party/pay/models/IPayLinks_model.php @@ -18,7 +18,7 @@ class IPayLinks_model extends CI_Model { $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T if ($ordertype == 'B' || $ordertype == 'A') { - $sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo + $sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_ID =?"; $query = $this->HT->query($sql, array($COLI_ID)); diff --git a/webht/third_party/pay/views/alipay_note_setting.php b/webht/third_party/pay/views/alipay_note_setting.php index 90332bba..e1bcc4bb 100644 --- a/webht/third_party/pay/views/alipay_note_setting.php +++ b/webht/third_party/pay/views/alipay_note_setting.php @@ -1,4 +1,4 @@ -
+
交易号