From 4e2ece1a67e5ff3036bb994afdb262bd6fb899dd Mon Sep 17 00:00:00 2001 From: lyt Date: Thu, 27 Jun 2019 15:49:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=AC=BE:=E5=87=BA=E5=9B=A2=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=9C=A8=E4=B8=8A=E6=9C=88=E5=BA=95=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E9=9C=80=E8=A6=81=E5=8F=91=E9=80=81=E8=B4=A2=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/AlipayTradeService.php | 8 ++++++-- .../pay/controllers/iPayLinksService.php | 7 +++++-- .../models/Online_payment_account_model.php | 2 +- webht/third_party/paypal/controllers/index.php | 8 +++++--- .../third_party/paypal/models/paypal_model.php | 18 ++++++++++++++++++ 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index 173346c2..712309ea 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -703,8 +703,12 @@ class AlipayTradeService extends CI_Controller $this->Alipay_note_model->update_send($item->ALI_dealId, 'send-customer'); } //添加邮件发送记录 end - // TODO 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录 - if ($this->payment_model->if_finance_exists($advisor_info->COLI_GRI_SN)===true) { + // 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录 + // 更新是否需要发送财务 + $refund_finance_day = 20; + $now_day = date('d'); + $late_entry_date_set = $now_day<$refund_finance_day ? date('Y-m-01', strtotime("-1 month")) : date('Y-m-01'); + if ($this->payment_model->if_finance_done($advisor_info->COLI_GRI_SN, $late_entry_date_set) === true) { $this->Note_model->update_send($item->ALI_dealId, 'send-to-finance'); } return ; diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php index b5f5085e..a92a29d0 100644 --- a/webht/third_party/pay/controllers/iPayLinksService.php +++ b/webht/third_party/pay/controllers/iPayLinksService.php @@ -770,10 +770,13 @@ class IPayLinksService extends CI_Controller } //添加邮件发送记录 end // 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录 - if ($this->payment_model->if_finance_exists($advisor_info->COLI_GRI_SN)===true) { + // 更新是否需要发送财务 + $refund_finance_day = 20; + $now_day = date('d'); + $late_entry_date_set = $now_day<$refund_finance_day ? date('Y-m-01', strtotime("-1 month")) : date('Y-m-01'); + if ($this->payment_model->if_finance_done($advisor_info->COLI_GRI_SN, $late_entry_date_set) === true) { $this->Note_model->update_send($item->IPL_dealId, 'send-to-finance'); } - 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 599f1204..d1c33493 100644 --- a/webht/third_party/pay/models/Online_payment_account_model.php +++ b/webht/third_party/pay/models/Online_payment_account_model.php @@ -348,7 +348,6 @@ class Online_payment_account_model extends CI_Model { and cgi.CGI_GRI_SN=? "; return $this->HT->query($sql, array($gri_sn))->num_rows() > 0; } - // 商务订单没有生成团信息 public function if_finance_done($gri_sn, $late_date) { $sql = "SELECT top 1 1 @@ -356,6 +355,7 @@ class Online_payment_account_model extends CI_Model { where GRI_SN=? and GRI_EntranceDate < ? "; + // 商务订单没有生成团信息 if ($this->HT->query($sql, array($gri_sn,$late_date))->num_rows() === 0) { $sql = "SELECT top 1 1 from BIZ_ConfirmLineInfo coli diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 85bde232..924398b9 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -1003,8 +1003,6 @@ class Index extends CI_Controller { /*! * 退款处理 * @date 2019-05-05 - * TODO: - * * 退款的记录增加发送财务的状态 */ public function send_refund($item, $handpick, $old_ssje=NULL) { @@ -1136,7 +1134,11 @@ class Index extends CI_Controller { } //添加邮件发送记录 end // 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录 - if ($this->Paypal_model->if_finance_exists($advisor_info->COLI_GRI_SN)===true) { + // 更新是否需要发送财务 + $refund_finance_day = 20; + $now_day = date('d'); + $late_entry_date_set = $now_day<$refund_finance_day ? date('Y-m-01', strtotime("-1 month")) : date('Y-m-01'); + if ($this->Paypal_model->if_finance_done($advisor_info->COLI_GRI_SN, $late_entry_date_set) === true) { $this->Note_model->update_send($item->pn_txn_id, 'send-to-finance', $item->pn_sn); } return ; diff --git a/webht/third_party/paypal/models/paypal_model.php b/webht/third_party/paypal/models/paypal_model.php index 50625797..65b49d4a 100644 --- a/webht/third_party/paypal/models/paypal_model.php +++ b/webht/third_party/paypal/models/paypal_model.php @@ -687,4 +687,22 @@ class Paypal_model extends CI_Model { and cgi.CGI_GRI_SN=? "; return $this->HT->query($sql, $gri_sn)->num_rows() > 0; } + public function if_finance_done($gri_sn, $late_date) + { + $sql = "SELECT top 1 1 + from groupinfo gri + where GRI_SN=? + and GRI_EntranceDate < ? + "; + // 商务订单没有生成团信息 + if ($this->HT->query($sql, array($gri_sn,$late_date))->num_rows() === 0) { + $sql = "SELECT top 1 1 + from BIZ_ConfirmLineInfo coli + inner join BIZ_ConfirmLineDetail cold on COLD_COLI_SN=COLI_SN and isnull(cold.DeleteFlag,0)=0 + where COLI_GRI_SN=? + and COLD_StartDateHT->query($sql, array($gri_sn,$late_date))->num_rows() > 0; + } + return false; + } }