From 1996e112eebf389cf55dffd4c1bacb46b8efd728 Mon Sep 17 00:00:00 2001 From: lyt Date: Mon, 11 Sep 2017 13:04:42 +0800 Subject: [PATCH] =?UTF-8?q?ipaylinks=E6=94=AF=E4=BB=98=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=8F=8D=E6=82=94=E4=BA=A4=E6=98=93=E5=8F=B7?= =?UTF-8?q?,=E5=AF=BC=E8=87=B4=E6=9F=A5=E8=AF=A2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/iPayLinksService.php | 51 +++++++++++++++---- webht/third_party/pay/models/note_model.php | 16 ++++-- .../third_party/pay/views/iPayLinks_list.php | 27 ++++++++-- webht/third_party/pay/views/note_setting.php | 8 +-- 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php index 52a3e8f6..d3c13f53 100644 --- a/webht/third_party/pay/controllers/iPayLinksService.php +++ b/webht/third_party/pay/controllers/iPayLinksService.php @@ -379,7 +379,7 @@ class IPayLinksService extends CI_Controller $this->IPayLinks_model->add_account_info( $GAI_COLI_SN, $advisor_info->COLI_ID, - $item->IPL_payAmount, + $item->IPL_orderAmount, $item->IPL_completeTime, mb_strtoupper($item->IPL_currencyCode), $item->IPL_completeTime, @@ -397,7 +397,7 @@ class IPayLinksService extends CI_Controller $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; $this->IPayLinks_model->add_tour_account_info( $GAI_COLI_SN, - $item->IPL_payAmount, + $item->IPL_orderAmount, $item->IPL_acquiringTime, mb_strtoupper($item->IPL_currencyCode), $item->IPL_completeTime, @@ -408,7 +408,7 @@ class IPayLinksService extends CI_Controller $ht_memo ); //添加汉特的订单提醒 - $this->IPayLinks_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->IPL_currencyCode) . $item->IPL_payAmount); + $this->IPayLinks_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->IPL_currencyCode) . $item->IPL_orderAmount); } } @@ -427,7 +427,7 @@ class IPayLinksService extends CI_Controller $fromEmail = ''; $toName = !empty($opi_firstname) ? $opi_firstname : ''; $toEmail = !empty($opi_email) ? $opi_email : ''; - $subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_payAmount . $item->IPL_currencyCode . ' / ' . $fromName; + $subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / ' . $fromName; $body = $this->load->view('receipt_mail', $item, true); $M_RelatedInfo = $item->IPL_sn; $M_AddTime = $item->IPL_completeTime; @@ -549,7 +549,7 @@ class IPayLinksService extends CI_Controller echo "200"; return; } - $dealId = trim($asyns_resp->data->dealId); + $dealId = trim($asyns_resp->data->dealId) ? trim($asyns_resp->data->dealId) : $this->create_guid(); bcscale(2); $this->Note_model->save_ipl( strval($dealId) @@ -566,7 +566,7 @@ class IPayLinksService extends CI_Controller ,strval($asyns_resp->data->resultMsg) ); // 查询支付结果;入库处理 - if ( ! empty($asyns_resp->data->dealId)) { + if ( ! empty(trim($asyns_resp->data->dealId))) { $query = $this->query_pay_result($asyns_resp->data); } // 返回状态码200 @@ -641,29 +641,32 @@ class IPayLinksService extends CI_Controller if (is_array($resp)) { // 异步通知接收到的是post数组 $ret->data = $respObject = (Object) $resp; + $ref = ""; } else { + $ref = $_SERVER['HTTP_REFERER']; $r = iconv("UTF-8", "UTF-8//IGNORE", $resp); $ret->data = $respObject = @ simplexml_load_string($resp); // test // log_message("error", "xml result: \n $resp"); if (false === $respObject) { - log_message('error','iPayLinks return ERROR ! Unknow ERROR ! Original return:'.$resp."; From: ".$_SERVER['HTTP_REFERER']); + log_message('error','iPayLinks return ERROR ! Unknow ERROR ! Original return:'.$resp."; From: ".$ref); return $ret; } } $rep_sign = $this->generate_sign((array)$respObject); if (strcmp($rep_sign,$respObject->signMsg)) { - log_message('error','iPayLinks sign ERROR ! orderId:'.$respObject->orderId.'; dealId:'.$respObject->dealId . "; Original return:".$resp."; From: ".$_SERVER['HTTP_REFERER']); + log_message('error','iPayLinks sign ERROR ! orderId:'.$respObject->orderId.'; dealId:'.$respObject->dealId . "; Original return:".$resp."; From: ".$ref); return $ret; } // partnerId if (strcmp($respObject->partnerId, $this->pay_info_arr['partnerId'])) { - log_message("error", " iPayLinks ERROR partnerId verify failed ".$respObject->partnerId." !== ".$this->pay_info_arr['partnerId'].'; orderId:'.$respObject->orderId.'; dealId:'.$respObject->dealId."; From: ".$_SERVER['HTTP_REFERER']); + log_message("error", " iPayLinks ERROR partnerId verify failed ".$respObject->partnerId." !== ".$this->pay_info_arr['partnerId'].'; orderId:'.$respObject->orderId.'; dealId:'.$respObject->dealId."; From: ".$ref); return $ret; } // resultCode payment failed + if (strcmp(strval($respObject->resultCode), "0000")) { - log_message('error',"iPayLinks payment failed! error code:".$respObject->resultCode."; result Msg: ".$respObject->resultMsg.'; orderId:'.$respObject->orderId.'; dealId:'.$respObject->dealId."; From: ".$_SERVER['HTTP_REFERER']); + log_message('error',"iPayLinks payment failed! error code:".$respObject->resultCode."; result Msg: ".$respObject->resultMsg.'; orderId:'.$respObject->orderId.'; dealId:'.$respObject->dealId."; From: ".$ref); } $ret->check = true; return $ret; @@ -783,7 +786,7 @@ class IPayLinksService extends CI_Controller } //获取note详情,以便后续修改各项数据 - public function note_modal($pn_txn_id, $pn_invoice = false) { + public function note_modal($pn_txn_id = false, $pn_invoice = false ,$notice_time = false) { $data = array(); $data['IPL_orderId'] = $pn_invoice; if (!empty($pn_txn_id)) { @@ -806,6 +809,29 @@ class IPayLinksService extends CI_Controller echo json_encode('没找到数据!'); return; } + public function note_order_modal($old_order,$pn_invoice = false ,$notice_time = false) { + $data = array(); + $data['IPL_orderId'] = $pn_invoice; + if (!empty($pn_invoice)) { + $data['note'] = $this->Note_model->note_order($old_order,$notice_time); + if (!empty($data['note'])) { + if (!empty($pn_invoice)) { + $orderid_info = $this->analysis_orderid($pn_invoice); + } else { + $orderid_info = $this->analysis_orderid($data['note']->IPL_orderId); + } + if (!empty($orderid_info)) { + $orderid_info = json_decode($orderid_info); + $data['order_info'] = $this->IPayLinks_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype); + } + $data["paytext"] = $this->payment_status(); + echo json_encode($this->load->view('note_setting', $data, true)); + return true; + } + } + echo json_encode('没找到数据!'); + return; + } //关闭note通知,用于手动处理通知后 public function close_note($pn_txn_id) { @@ -846,6 +872,9 @@ class IPayLinksService extends CI_Controller //用于HT--交易详情 public function receipt($pm_transaction_id) { + if ( ! $pm_transaction_id) { + return false; + } $data = array(); $data = $this->Note_model->note($pm_transaction_id); $this->load->view('receipt_mail', $data); diff --git a/webht/third_party/pay/models/note_model.php b/webht/third_party/pay/models/note_model.php index b3a7645e..bc71c5d8 100644 --- a/webht/third_party/pay/models/note_model.php +++ b/webht/third_party/pay/models/note_model.php @@ -42,7 +42,7 @@ class Note_model extends CI_Model { public function search_date($date) { $this->init(); - $search_sql = " AND pn.IPL_completeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' "; + $search_sql = " AND pn.IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' "; $this->search = $search_sql; $this->orderby=" ORDER BY CASE pn.IPL_sent WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.IPL_sn DESC "; return $this->get_list(); @@ -55,6 +55,14 @@ class Note_model extends CI_Model { return $this->get_list(); } + public function note_order($orderid,$notice_time) + { + $this->init(); + $this->topnum=1; + $this->dealId=" AND pn.IPL_orderId=".$this->INFO->escape($orderid)." AND pn.IPL_noticeTime=".$this->INFO->escape($notice_time); + return $this->get_list(); + } + public function search_key($search_key) { $this->init(); $this->topnum = 300; //限制最大数量,防止查询单词过短 @@ -81,7 +89,7 @@ class Note_model extends CI_Model { * @author LYT * @date 2017-08-29 */ - public function save_ipl($IPL_dealId,$IPL_orderId,$IPL_currencyCode,$IPL_orderAmount,$IPL_payAmount,$IPL_stateCode,$IPL_acquiringTime,$IPL_completeTime,$IPL_memo,$IPL_payType,$IPL_resultCode=null,$IPL_resultMsg=null) { + public function save_ipl($IPL_dealId,$IPL_orderId,$IPL_currencyCode,$IPL_orderAmount,$IPL_payAmount,$IPL_stateCode,$IPL_acquiringTime,$IPL_completeTime,$IPL_memo,$IPL_payType,$IPL_resultCode,$IPL_resultMsg) { $sql = " INSERT INTO IPayLinksLog ( @@ -89,7 +97,7 @@ class Note_model extends CI_Model { ) VALUES ( - ?,?,?,?,?,?,?,?,?,'unsend', GETDATE(),?,?,? + ?,?,?,?,?,?,?,?,?,'unsend', GETDATE(),?,?,N? ) "; $query = $this->INFO->query($sql, @@ -103,8 +111,6 @@ class Note_model extends CI_Model { ,$IPL_completeTime ,$IPL_memo ,$IPL_payType - ,$IPL_payer - ,$IPL_payerEmail ,$IPL_resultCode ,$IPL_resultMsg )); diff --git a/webht/third_party/pay/views/iPayLinks_list.php b/webht/third_party/pay/views/iPayLinks_list.php index c1c9bace..169678f9 100644 --- a/webht/third_party/pay/views/iPayLinks_list.php +++ b/webht/third_party/pay/views/iPayLinks_list.php @@ -93,7 +93,7 @@
  • #
  • 主题
  • 交易号
  • -
  • 收款(北京)时间
  • +
  • 收单时间
  • 通知时间
  • 通知状态
  • @@ -105,7 +105,11 @@
  • + IPL_dealId) { ?> + + + IPL_orderId . ' / ' . $item->IPL_payAmount . $item->IPL_currencyCode; ?>
  • @@ -126,7 +130,7 @@ $class_css = 'btn-danger'; $show_send = $item->IPL_sent; } - ?> + ?> @@ -182,11 +186,12 @@ $(".ui-datepicker").css('width', '15.7em'); }); - function show_order_modal(pn_txn_id, pn_invoice) { + function show_order_modal(pn_txn_id, pn_invoice,noticeTime,old_order) { + if (pn_txn_id) { $.ajax({ type: "get", dataType: "json", - url: 'http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_modal/' + pn_txn_id + '/' + pn_invoice, + url: 'http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_modal/' + pn_txn_id + '/' + pn_invoice + '/' + noticeTime, success: function(data, textStatus) { $('#modal_set_orderid_body').html(data); $('#modal_set_orderid').modal('show'); @@ -195,6 +200,20 @@ alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...'); } }); + } else { + $.ajax({ + type: "get", + dataType: "json", + url: '/webht.php/apps/pay/ipaylinksservice/note_order_modal/' + old_order + '/' + pn_invoice + '/' + noticeTime, + success: function(data, textStatus) { + $('#modal_set_orderid_body').html(data); + $('#modal_set_orderid').modal('show'); + }, + error: function(msg) { + alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...'); + } + }); + } } function close_note() { diff --git a/webht/third_party/pay/views/note_setting.php b/webht/third_party/pay/views/note_setting.php index e2b377bf..47280d28 100644 --- a/webht/third_party/pay/views/note_setting.php +++ b/webht/third_party/pay/views/note_setting.php @@ -2,15 +2,15 @@
    交易号
    -
    IPL_dealId ?> ( IPL_stateCode))]; ?> )
    +
    IPL_dealId ?> ( IPL_stateCode))].".".$note->IPL_resultMsg; ?> )
    付款金额
    -
    IPL_currencyCode . ' ' . $note->IPL_payAmount ?>
    +
    IPL_currencyCode . ' ' . $note->IPL_orderAmount ?>
    付款时间
    -
    IPL_completeTime; ?>
    +
    IPL_acquiringTime; ?>
    @@ -19,7 +19,7 @@
    - +