APP组的收款核对提醒, 用订单号和金额判断

不考虑订单多个收款的情况
如果收款记录是0条,则需要补充
feature/pay
lyt 6 years ago
parent 17ee96e325
commit 8b80b8e3e9

@ -785,21 +785,21 @@ class Index extends CI_Controller {
&& $orderid_info->ordertype == 'A' && strpos($get_order_no, 'China Train Booking') !== false) {
// APP 组的China Train Booking-开头的订单号
// 发送邮件提醒外联核对收款金额, 不写入收款记录
$this->process_notify_APP($item, $orderid_info);
continue;
$if_empty_gai = $this->process_notify_APP($item, $orderid_info);
if($if_empty_gai !== true) { continue }; // 收款记录为空, 需要补录
}
//检测是否是APP订单,默认不处理
// && $item->pn_payment_status !== 'Refunded'
if (
( (strpos($item->pn_memo, 'China Train Booking') !== false)
|| (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)
)
&& empty($pn_txn_id)
) { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->pn_txn_id, 'send');
continue;
}
// if (
// ( (strpos($item->pn_memo, 'China Train Booking') !== false)
// || (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)
// )
// && empty($pn_txn_id)
// ) { //APP自动出票的订单不需要处理
// $this->Note_model->update_send($item->pn_txn_id, 'send');
// continue;
// }
//根据订单号查找外联信息
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick);
@ -820,10 +820,10 @@ class Index extends CI_Controller {
$this->Note_model->set_invoice($item->pn_txn_id, $orderid_info->orderid . '_' . $orderid_info->ordertype);
//检测是否是APP订单,默认不处理
if ($orderid_info->ordertype == 'A' ) { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->pn_txn_id, 'send');
continue;
}
// if ($orderid_info->ordertype == 'A' ) { //APP自动出票的订单不需要处理
// $this->Note_model->update_send($item->pn_txn_id, 'send');
// continue;
// }
//添加支付信息入库
//没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据
@ -1485,8 +1485,9 @@ class Index extends CI_Controller {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
return false;
}
$order_gai_list = $this->Paypal_model->get_money_list($orderid_info->orderid, $item->pn_mc_gross, $item->pn_mc_currency);
//添加邮件发送记录
if ($item->pn_send !== 'send') {
if ($item->pn_send !== 'send' && empty($order_gai_list)) {
//给外联发送通知邮件
$fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
$fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : '';
@ -1502,7 +1503,8 @@ class Index extends CI_Controller {
//添加邮件发送记录 end
$this->Note_model->update_send($item->pn_txn_id, 'send');
}
return false;
$order_gai = $this->Paypal_model->get_money_list($orderid_info->orderid);
return empty($order_gai);
}
}

@ -87,10 +87,12 @@ class Paypal_model extends CI_Model {
}
//获取收款记录(商务订单)
public function get_money_list($GAI_COLI_ID, $GAI_SQJE, $GAI_SQJECurrency) {
public function get_money_list($GAI_COLI_ID, $GAI_SQJE=null, $GAI_SQJECurrency=null) {
$je_sql = $GAI_SQJE===null ? " " : " and GAI_SQJE=? ";
$currency_sql = $GAI_SQJECurrency===null ? " " : " and GAI_SQJECurrency=? ";
$sql = "SELECT GAI_SN,GAI_CusEmail,GAI_Memo
FROM BIZ_GroupAccountInfo bgai
WHERE bgai.GAI_COLI_ID = ? and GAI_SQJE=? and GAI_SQJECurrency=?
WHERE bgai.GAI_COLI_ID = ? $je_sql $currency_sql
ORDER BY bgai.GAI_SN ASC";
$query = $this->HT->query($sql, array($GAI_COLI_ID, $GAI_SQJE, $GAI_SQJECurrency));
$result = $query->result();

Loading…
Cancel
Save