From 21569e4da0657b69a8b0c2a8209a5fc525b4745c Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 26 Apr 2019 11:06:34 +0800 Subject: [PATCH 1/6] =?UTF-8?q?paypal=20Trippest=E6=94=B6=E6=AC=BE?= =?UTF-8?q?=E7=9A=84=E5=8F=91=E9=80=81=E7=8A=B6=E6=80=81=E6=94=B9=E5=88=B0?= =?UTF-8?q?=E5=92=8C=E5=A4=B1=E8=B4=A5=E4=B8=80=E8=B5=B7=E5=A4=84=E7=90=86?= =?UTF-8?q?,=E9=81=BF=E5=85=8D=E5=8D=A1=E4=BD=8F=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/paypal/models/note_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php index c534e41f..0cd9ecd4 100644 --- a/webht/third_party/paypal/models/note_model.php +++ b/webht/third_party/paypal/models/note_model.php @@ -31,14 +31,14 @@ class Note_model extends CI_Model { public function unsend($topnum = 2) { $this->init(); $this->topnum = $topnum; - $this->pn_send = " AND (pn_send='unsend' OR pn_send='' OR pn_send IS NULL) "; + $this->pn_send = " AND (pn_send='unsend' OR pn_send IS NULL) "; return $this->get_list(); } public function failnote($topnum = 2) { $this->init(); $this->topnum = $topnum; - $this->pn_send = " AND pn_send='sendfail' "; + $this->pn_send = " AND (pn_send='sendfail' OR pn_send='') "; //$this->orderby = ' ORDER BY pn.pn_sn ASC '; return $this->get_list(); } From 02b64c677e6356be984c73ba4c12ee6a11fcae10 Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 26 Apr 2019 11:07:57 +0800 Subject: [PATCH 2/6] =?UTF-8?q?Alipay=20=E4=BA=A4=E6=98=93=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E7=9A=84=E5=A4=84=E7=90=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/pay/controllers/AlipayTradeService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index f9db3a3c..9800c519 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -348,7 +348,7 @@ class AlipayTradeService extends CI_Controller foreach ($data['unsend_list'] as $item) { //已经发送的不处理,防止重复发送 - if ($item->ALI_sent == 'send') { + if ($item->ALI_sent == 'send' && empty($pn_txn_id)) { continue; } @@ -359,8 +359,7 @@ class AlipayTradeService extends CI_Controller } //只处理完成状态,其他状态由陆燕处理 - if (strcmp(trim($item->ALI_resultMsg), "TRADE_SUCCESS") - || strcmp(trim($item->ALI_resultMsg), "TRADE_FINISHED")) { + if (strcmp(trim($item->ALI_resultMsg), "TRADE_SUCCESS")!==0 && strcmp(trim($item->ALI_resultMsg), "TRADE_FINISHED")!==0 ) { $this->Alipay_note_model->update_send($item->ALI_dealId, 'send'); continue; } From 8538378b43f84d5b5609566f16f87c45fefc1030 Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 26 Apr 2019 11:09:05 +0800 Subject: [PATCH 3/6] =?UTF-8?q?wxpay=20=E8=87=AA=E5=8A=A8=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E5=92=8C=E5=8F=91=E9=80=81=E6=8F=90=E9=86=92.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/PaymentService.php | 18 +++++++++--------- .../pay/controllers/WxpayService.php | 2 +- .../pay/models/Online_payment_note_model.php | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php index c01d4a43..0e39d8da 100644 --- a/webht/third_party/pay/controllers/PaymentService.php +++ b/webht/third_party/pay/controllers/PaymentService.php @@ -40,10 +40,6 @@ log_message('error','send_notify begin ----'); } // 开始处理 foreach ($data['unsend_list'] as $key => $item) { - //显示处理记录 - if (empty($transaction_id)) { - echo ++$show_index . ' ' . $item->OPN_transactionId . '
'; - } // 只处理完成状态 if ($item->OPN_transactionResult != 'completed') { continue; @@ -76,17 +72,17 @@ log_message('error','send_notify begin ----'); // 开始查找订单和录入 $handpick = empty($transaction_id) ? false : true; $advisor_info = $this->account_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); - $ssje = $this->account_model->get_ssje($item->OPN_orderAmount, $item->OPN_accountMethod, mb_strtoupper($item->OPN_currency)); + $ssje = $this->account_model->get_ssje($item->OPN_orderAmount, mb_strtoupper($item->OPN_currency), $item->OPN_accountMethod); $ssje = $old_ssje===NULL ? $ssje : $old_ssje; $ht_memo = '交易号(自动录入):' . $item->OPN_transactionId; - if ( ! isset($advisor_info->ordertype)) { + if ( empty($advisor_info)) { // record fail $this->note_model->update_send($item->OPN_SN, $item->OPN_transactionId, 'sendfail'); continue; } $COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; $update_note_column = array(); - if ($advisor_info->ordertype == 0) { + if ($advisor_info->order_type == 0) { /* 商务订单 */ if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') { /* APP */ @@ -141,7 +137,7 @@ log_message('error','send_notify begin ----'); $update_note_column['OPN_accountType'] = 'B'; $update_note_column['OPN_accountStatus'] = 'recorded'; $update_note_column['OPN_accountTime'] = date('Y-m-d H:i:s'); - } elseif ($advisor_info->ordertype == 1) { + } elseif ($advisor_info->order_type == 1) { /* 传统 */ $gai_sn = $this->account_model->add_tour_account_info( $COLI_SN, @@ -194,8 +190,12 @@ log_message('error','send_notify begin ----'); $this->account_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'payment note', 'payment note'); //添加邮件发送记录 end - $this->note_model->update_send($item->OPN_SN, $item->pn_txn_id, 'send'); + $this->note_model->update_send($item->OPN_SN, $item->OPN_transactionId, 'send'); + //显示处理记录 + if (empty($transaction_id)) { + echo ++$show_index . ' ' . $item->OPN_transactionId . '
'; + } } return; diff --git a/webht/third_party/pay/controllers/WxpayService.php b/webht/third_party/pay/controllers/WxpayService.php index 5f7f8e74..1f39a0ed 100644 --- a/webht/third_party/pay/controllers/WxpayService.php +++ b/webht/third_party/pay/controllers/WxpayService.php @@ -100,7 +100,7 @@ log_message('error','notify begin ----'); return false; } if ($this->make_sign($xml_arr) !== $xml_arr['sign']) { - log_message('error','Wxpay notify error: sign.'); + log_message('error','Wxpay notify error: sign.' . $this->make_sign($xml_arr)); return false; } if ($this->wx_site_config['app_id'] !== $xml_arr['appid']) { diff --git a/webht/third_party/pay/models/Online_payment_note_model.php b/webht/third_party/pay/models/Online_payment_note_model.php index 5d0205e3..e4eefeea 100644 --- a/webht/third_party/pay/models/Online_payment_note_model.php +++ b/webht/third_party/pay/models/Online_payment_note_model.php @@ -35,7 +35,7 @@ class Online_payment_note_model extends CI_Model { //设置订单号 public function set_invoice($id, $pn_invoice) { - $column = array("OPN_orderId" => $send); + $column = array("OPN_orderId" => $pn_invoice); $where = " OPN_SN=" . $id; return $this->update_note($where, $column); } From cf47bc32b911fd2c6cd3c5879a4e98443c9190b2 Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 26 Apr 2019 12:02:10 +0800 Subject: [PATCH 4/6] =?UTF-8?q?paypal=20Trippest=E6=94=B6=E6=AC=BE?= =?UTF-8?q?=E7=9A=84=E5=BD=95=E5=85=A5=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/paypal/controllers/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 95d898fa..3c2bdb67 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -1325,6 +1325,9 @@ class Index extends CI_Controller { $orderid_info = $this->analysis_orderid($data['note']->pn_invoice); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); + if ($orderid_info->ordertype === 'TP') { + $orderid_info->ordertype = 'B'; + } if ($orderid_info->ordertype === 'T') { $data['gai_info'] = $this->Paypal_model->get_money_t($pn_txn_id); } elseif ($orderid_info->ordertype === 'B') { @@ -1337,6 +1340,9 @@ class Index extends CI_Controller { if ($neworder !== null) { $neworder_id = $this->analysis_orderid($neworder); $neworder_id = json_decode($neworder_id); + if ($neworder_id->ordertype === 'TP') { + $neworder_id->ordertype = 'B'; + } if ( ! empty($neworder_id)) { $data['order_info'] = $this->Paypal_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype); } From 9cef2510b497e8c094ca1853bd0081bfa2802aeb Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 26 Apr 2019 17:28:03 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=94=B6=E6=AC=BE:=E5=A4=96=E8=81=94?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/PaymentService.php | 25 +++++++++++--- .../pay/models/Online_payment_note_model.php | 34 +++++++++---------- webht/third_party/pay/views/mail_advisor.php | 1 + 3 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 webht/third_party/pay/views/mail_advisor.php diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php index 0e39d8da..272a86be 100644 --- a/webht/third_party/pay/controllers/PaymentService.php +++ b/webht/third_party/pay/controllers/PaymentService.php @@ -20,6 +20,24 @@ class PaymentService extends CI_Controller { } + public function note_list() + { + $this->permission->is_admin(true); + $data = array(); + // $data["paytext"] = $this->payment_status(); + $data["method_name"] = $this->input->get_post("method_name"); + $data["keywords"] = $this->input->get_post("keywords"); + $data["date"] = $this->input->get_post("date"); + empty($data['date']) ? $data['date'] = date('Y-m-d') : false; + if (!empty($data['keywords'])) { + $data['notelist'] = $this->note_model->search_key($data['keywords']); + } else { + $data['notelist'] = $this->note_model->search_date($data['date']); + } + $this->load->view("iPayLinks_list",$data); + return; + } + public function send_notify($transaction_id=NULL, $old_ssje=NULL) { log_message('error','send_notify begin ----'); @@ -183,7 +201,7 @@ log_message('error','send_notify begin ----'); $toName = !empty($opi_firstname) ? $opi_firstname : ''; $toEmail = !empty($opi_email) ? $opi_email : ''; $subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->OPN_orderAmount . $item->OPN_currency . ' / ' . $fromName; - $body = $this->load->view('mail_templete', $item, true); //$item->pn_memo; + $body = $this->load->view('mail_advisor', $item, true); //$item->pn_memo; $M_RelatedInfo = $item->OPN_SN; $M_AddTime = $item->OPN_completeTime; $M_State = 0; @@ -203,6 +221,7 @@ log_message('error','send_notify begin ----'); } /** 支付方式参数对应的配置文件名 */ + /** @Deprecated */ public function method_name($name) { $config_name = 'paypal'; @@ -246,14 +265,12 @@ log_message('error','send_notify begin ----'); case '15016': // wxpay $orderid_info = analysis_orderid($content_obj->out_trade_no); break; - + // TODO case '15018': // iPaylinks break; - case '15015': // alipay break; - default: # code... break; diff --git a/webht/third_party/pay/models/Online_payment_note_model.php b/webht/third_party/pay/models/Online_payment_note_model.php index e4eefeea..7d5a9c4a 100644 --- a/webht/third_party/pay/models/Online_payment_note_model.php +++ b/webht/third_party/pay/models/Online_payment_note_model.php @@ -40,6 +40,23 @@ class Online_payment_note_model extends CI_Model { return $this->update_note($where, $column); } + public function unsend_note($num=2) + { + $this->init_query(); + $this->topnum = $num; + $this->send = " AND (OPN_noticeSendStatus='unsend' OR OPN_noticeSendStatus='' OR OPN_noticeSendStatus IS NULL) "; + return $this->query_note(); + } + + public function sendfail_note($num=2) + { + $this->init_query(); + $this->topnum = $num; + $this->send = " AND OPN_noticeSendStatus='sendfail' "; + return $this->query_note(); + } + + public $topnum = false; public $orderby = false; public $send = false; @@ -83,23 +100,6 @@ class Online_payment_note_model extends CI_Model { return $this->query_note(); } - public function unsend_note($num=2) - { - $this->init_query(); - $this->topnum = $num; - $this->send = " AND (OPN_noticeSendStatus='unsend' OR OPN_noticeSendStatus='' OR OPN_noticeSendStatus IS NULL) "; - return $this->query_note(); - } - - public function sendfail_note($num=2) - { - $this->init_query(); - $this->topnum = $num; - $this->send = " AND OPN_noticeSendStatus='sendfail' "; - return $this->query_note(); - } - - } diff --git a/webht/third_party/pay/views/mail_advisor.php b/webht/third_party/pay/views/mail_advisor.php new file mode 100644 index 00000000..272340c6 --- /dev/null +++ b/webht/third_party/pay/views/mail_advisor.php @@ -0,0 +1 @@ +
payment logo
Transaction ID:  
Hello Guilin China International Travel Service Co.,Ltd,
You received a payment of
Seller Protection-
Buyer


Description     Amount

From aecdf6eddf986666a1db385e09c354687184741e Mon Sep 17 00:00:00 2001 From: lyt Date: Mon, 29 Apr 2019 11:56:55 +0800 Subject: [PATCH 6/6] =?UTF-8?q?wxpay=20=E6=94=B6=E6=AC=BE=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=A4=84=E7=90=86;=E6=94=B6=E6=AC=BE=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=88=97=E8=A1=A8;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/PaymentService.php | 127 ++++++++++++++++-- .../models/Online_payment_account_model.php | 36 ++++- .../pay/models/Online_payment_note_model.php | 49 ++++++- 3 files changed, 200 insertions(+), 12 deletions(-) diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php index 272a86be..bf6180b6 100644 --- a/webht/third_party/pay/controllers/PaymentService.php +++ b/webht/third_party/pay/controllers/PaymentService.php @@ -1,8 +1,6 @@ note_model->search_date($data['date']); } - $this->load->view("iPayLinks_list",$data); + + /** + * 导出记录用的记录节点 + * TODO + */ + // $data['record_flags'] = $this->note_model->list_export_record(); + + $this->load->view("payment_list",$data); return; } - public function send_notify($transaction_id=NULL, $old_ssje=NULL) + public function note_faillist() + { + $this->permission->is_admin(true); + $data = array(); + $data['date'] = date('Y-m-d'); + $data['notelist'] = $this->note_model->failnote(100); + $this->load->view("payment_list",$data); + return; + } + + public function send_notify($opn_id=NULL, $old_ssje=NULL) { log_message('error','send_notify begin ----'); // exit(); $data = array(); $show_index = 0; //优先处理指定的交易号,用于修正交易号直接发送通知 - if ( ! empty($transaction_id)) { - $data['unsend_list'] = $this->note_model->get_note($transaction_id); + if ( ! empty($opn_id)) { + $data['unsend_list'] = $this->note_model->get_note($opn_id); } // 待处理的 if (empty($data['unsend_list'])) { @@ -88,7 +102,7 @@ log_message('error','send_notify begin ----'); } // 开始查找订单和录入 - $handpick = empty($transaction_id) ? false : true; + $handpick = empty($opn_id) ? false : true; $advisor_info = $this->account_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); $ssje = $this->account_model->get_ssje($item->OPN_orderAmount, mb_strtoupper($item->OPN_currency), $item->OPN_accountMethod); $ssje = $old_ssje===NULL ? $ssje : $old_ssje; @@ -207,11 +221,12 @@ log_message('error','send_notify begin ----'); $M_State = 0; $this->account_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'payment note', 'payment note'); //添加邮件发送记录 end + // 2. 给客人发邮件,通知账单 todo ?? 是否需要 $this->note_model->update_send($item->OPN_SN, $item->OPN_transactionId, 'send'); //显示处理记录 - if (empty($transaction_id)) { + if (empty($opn_id)) { echo ++$show_index . ' ' . $item->OPN_transactionId . '
'; } @@ -278,5 +293,99 @@ log_message('error','send_notify begin ----'); return $orderid_info; } + public function convert_send_status() + { + # code... + } + + public function gai_modal($pn_id = null, $neworder=null) + { + $this->permission->is_admin(true); + $data = array(); + $note = $this->note_model->get_note($pn_id); + $data['note'] = $note[0]; + $data['order_info'] = NULL; + $pn_invoice = $data['note']->OPN_orderId ? $data['note']->OPN_orderId : $data['note']->OPN_rawOrderId; + $pn_txn_id = $data['note']->OPN_transactionId; + $orderid_info = analysis_orderid($pn_invoice); + if (!empty($orderid_info)) { + $orderid_info = json_decode($orderid_info); + $data['order_info'] = $this->account_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype); + if ($orderid_info->ordertype === 'T') { + $data['gai_info'] = $this->account_model->get_money_t($pn_txn_id); + } elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP') { + $data['gai_info'] = $this->account_model->get_money_b($pn_txn_id); + } + } + $data['old_order'] = $pn_invoice; + $data['new_order'] = $neworder; + if ($neworder !== null ) { + $neworder_id = analysis_orderid($neworder); + $neworder_id = json_decode($neworder_id); + if ( ! empty($neworder_id)) { + $data['order_info'] = $this->account_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype); + } + } + echo json_encode($this->load->view('payment_gai_setting', $data, true)); + } + + public function gai_modal_save() + { + $data = array(); + $old_ssje = NULL; + $pn_txn_id = $this->input->post('pn_txn_id'); + $pn_id = $this->input->post('pn_id'); + $neworder = $this->input->post('pn_invoice'); + + $note = $this->note_model->get_note($pn_id); + $data['note'] = $note[0]; + $orderid_info = analysis_orderid($data['note']->OPN_orderId); + if (!empty($orderid_info)) { + $orderid_info = json_decode($orderid_info); + if ($orderid_info->ordertype === 'T') { + $data['gai_info'] = $this->account_model->get_money_t($pn_txn_id); + if ( ! empty($data['gai_info'])) { + $old_ssje = $data['gai_info'][0]->GAI_SSJE; + $this->account_model->delete_money_t($pn_txn_id); + } + } elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP') { + $data['gai_info'] = $this->account_model->get_money_b($pn_txn_id); + if ( ! empty($data['gai_info'])) { + $old_ssje = $data['gai_info'][0]->GAI_SSJE; + $this->account_model->delete_money_b($pn_txn_id); + } + } + } + + if (!empty($pn_txn_id) && !empty($neworder)) { + $orderid_info = analysis_orderid($neworder); + if (!empty($orderid_info)) { + $orderid_info = json_decode($orderid_info); + $advisor_info = $this->account_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + if (!empty($advisor_info)) { + $this->note_model->set_invoice($data['note']->OPN_SN, $neworder); + $this->send_notify($data['note']->OPN_SN, $old_ssje); + echo json_encode('修改成功!'); + return true; + } + } + } + echo json_encode('没找到数据!'); + return; + } + + public function close_gai($opn_id) + { + $data = array(); + $data['note'] = $this->note_model->get_note($opn_id); + if (!empty($data['note'])) { + $this->note_model->update_send($opn_id, $data['note'][0]->OPN_transactionId, 'closed'); + echo json_encode('该收款记录已经忽略!'); + return true; + } + echo json_encode('没找到数据!'); + return; + } + } diff --git a/webht/third_party/pay/models/Online_payment_account_model.php b/webht/third_party/pay/models/Online_payment_account_model.php index 3a42e20e..91fc6fa0 100644 --- a/webht/third_party/pay/models/Online_payment_account_model.php +++ b/webht/third_party/pay/models/Online_payment_account_model.php @@ -28,7 +28,7 @@ class Online_payment_account_model extends CI_Model { $result = ''; $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T - if ($ordertype == 'B' || $ordertype == 'A') { + if ($ordertype == 'B' || $ordertype == 'A' || $ordertype == 'TP') { $sql = "SELECT TOP 2 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 =?"; @@ -152,6 +152,40 @@ class Online_payment_account_model extends CI_Model { return $query; } + //根据交易号获取收款记录(传统订单) + public function get_money_t($pn_invoice) { + $sql = "SELECT GroupAccountInfo.* + from GroupAccountInfo + where DeleteFlag=0 and GAI_AccreditNo=? + "; + $query = $this->HT->query($sql, array($pn_invoice)); + $result = $query->result(); + return $result; + } + //根据交易号获取收款记录(商务订单) + public function get_money_b($pn_invoice) { + $sql = "SELECT BIZ_GroupAccountInfo.* + from BIZ_GroupAccountInfo + where DeleteFlag=0 and GAI_AccreditNo=? + "; + $query = $this->HT->query($sql, array($pn_invoice)); + $result = $query->result(); + return $result; + } + /** 删除收款记录 */ + public function delete_money_t($deadId) + { + $sql = "UPDATE GroupAccountInfo SET DeleteFlag=1 WHERE GAI_AccreditNo=?"; + $query = $this->HT->query($sql, array($deadId)); + return $query; + } + public function delete_money_b($deadId) + { + $sql = "UPDATE BIZ_GroupAccountInfo SET DeleteFlag=1 WHERE GAI_AccreditNo=?"; + $query = $this->HT->query($sql, array($deadId)); + return $query; + } + //添加收款记录(商务订单) public function add_account_info($GAI_COLI_SN, $payment_method, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) { //先判断是否有这条数据 diff --git a/webht/third_party/pay/models/Online_payment_note_model.php b/webht/third_party/pay/models/Online_payment_note_model.php index 7d5a9c4a..c17f0cb4 100644 --- a/webht/third_party/pay/models/Online_payment_note_model.php +++ b/webht/third_party/pay/models/Online_payment_note_model.php @@ -92,14 +92,59 @@ class Online_payment_note_model extends CI_Model { return $query->result(); } - public function get_note($transactionId) + public function get_note($opn_id) { $this->init_query(); $this->topnum=1; - $this->transactionId = " AND opn.OPN_transactionId=" . $this->info->escape($transactionId); + $this->search = " AND opn.OPN_SN=" . $this->info->escape($opn_id); return $this->query_note(); } + public function search_key($keyword) + { + $this->init_query(); + $this->topnum = 300; + $keyword = trim($keyword); + $search_sql = ""; + if ( ! empty($keyword)) { + $search_sql.=" AND ( OPN_transactionId = '$keyword' + OR OPN_orderId like '%$keyword%' + OR OPN_rawOrderId like '%$keyword%' )"; + } + $this->search = $search_sql; + return $this->query_note(); + } + + public function search_date($date) + { + $this->init_query(); + $this->search = " AND OPN_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' "; + return $this->query_note(); + } + + public function failnote($topnum = 2) { + $this->init_query(); + $this->topnum = $topnum; + $this->send = " AND OPN_noticeSendStatus='sendfail' "; + return $this->query_note(); + } + + /*! + * 导出记录 + * @date 2019-04-28 + * @param integer $sn [description] + */ + public function list_export_record($sn=0) + { + $search_sql = $sn===0 ? "" : " and TEL_SN=$sn "; + $sql = "SELECT TOP 10 * + FROM [InfoManager].[dbo].[Transaction_Export_Log] + WHERE 1=1 + $search_sql + order by TEL_SN desc"; + return $this->info->query($sql)->result(); + } + }