perf: PayPal: 失败的记录按时间 处理, 避免卡住

webht/payment
Lei OT 2 years ago
parent aa2efe9f55
commit af70b69cbf

@ -602,7 +602,9 @@ class Index extends CI_Controller {
$pn_payment_date = $this->input->post('payment_date'); $pn_payment_date = $this->input->post('payment_date');
$pn_payer = $this->input->post('first_name') . ' ' . $this->input->post('last_name'); $pn_payer = $this->input->post('first_name') . ' ' . $this->input->post('last_name');
$pn_payer_email = $this->input->post('payer_email'); $pn_payer_email = $this->input->post('payer_email');
$pn_memo = json_encode($_POST); $post_data = $_POST;
$post_data['ipn_time'] = date('Y-m-d H:i:s');
$pn_memo = json_encode($post_data);
if (!empty($pn_txn_id)) { if (!empty($pn_txn_id)) {
//把PDT时间转成GMT时间 //把PDT时间转成GMT时间
$pn_payment_date = gmdate('Y-m-d H:i:s', strtotime($pn_payment_date)); $pn_payment_date = gmdate('Y-m-d H:i:s', strtotime($pn_payment_date));

@ -40,6 +40,9 @@ class Note_model extends CI_Model {
$this->init(); $this->init();
$this->topnum = $topnum; $this->topnum = $topnum;
$this->pn_send = " AND (pn_send='sendfail' OR pn_send='') AND pn_payment_status='Completed' "; $this->pn_send = " AND (pn_send='sendfail' OR pn_send='') AND pn_payment_status='Completed' ";
// 1小时前
$date = date("Y-m-d H:i:s", time() - 3600);
$this->search = " AND pn_datetime < '$date' " ;
//$this->orderby = ' ORDER BY pn.pn_sn ASC '; //$this->orderby = ' ORDER BY pn.pn_sn ASC ';
return $this->get_list(); return $this->get_list();
} }
@ -48,6 +51,9 @@ class Note_model extends CI_Model {
$this->init(); $this->init();
$this->topnum = $topnum; $this->topnum = $topnum;
$this->pn_send = " AND (pn_send='sendfail' OR pn_send='') "; $this->pn_send = " AND (pn_send='sendfail' OR pn_send='') ";
// 1小时前
$date = date("Y-m-d H:i:s", time() - 3600);
$this->search = $topnum === 20 ? " AND pn_datetime < '$date' " : '';
//$this->orderby = ' ORDER BY pn.pn_sn ASC '; //$this->orderby = ' ORDER BY pn.pn_sn ASC ';
return $this->get_list(); return $this->get_list();
} }
@ -192,12 +198,13 @@ class Note_model extends CI_Model {
$ele->fundsource = ''; $ele->fundsource = '';
} }
$ele->parent_txn_id = isset($raw->parent_txn_id) ? $raw->parent_txn_id : ''; $ele->parent_txn_id = isset($raw->parent_txn_id) ? $raw->parent_txn_id : '';
$ele->ipn_time = isset($raw->ipn_time)? $raw->ipn_time : $ele->pn_datetime;
} }
public function update_send($pn_txn_id, $pn_send, $pn_sn=NULL) { public function update_send($pn_txn_id, $pn_send, $pn_sn=NULL) {
$sql = " $sql = "
UPDATE paypal_note UPDATE paypal_note
SET pn_send = ? SET pn_send = ?, pn_datetime=GETDATE()
WHERE pn_txn_id = ? WHERE pn_txn_id = ?
"; ";
$sql .= ($pn_sn===NULL) ? "" : " and pn_sn=$pn_sn "; $sql .= ($pn_sn===NULL) ? "" : " and pn_sn=$pn_sn ";

@ -202,11 +202,11 @@
<ul class="row mail_list hidden-xs"> <ul class="row mail_list hidden-xs">
<a href="javascript:void(0);" style="cursor:default;color:#000;"> <a href="javascript:void(0);" style="cursor:default;color:#000;">
<li class="col-sm-1 "><strong>#</strong></li> <li class="col-sm-1 "><strong>#</strong></li>
<li class="col-sm-7 "><strong>主题</strong></li> <li class="col-sm-6 "><strong>主题</strong></li>
<li class="col-sm-4"><strong>客人邮箱</strong></li> <li class="col-sm-4"><strong>客人邮箱</strong></li>
<li class="col-sm-4 "><strong>交易号</strong></li> <li class="col-sm-4 "><strong>交易号</strong></li>
<li class="col-sm-3 "><strong>收款(北京)时间</strong></li> <li class="col-sm-3 "><strong>交易(北京)时间</strong></li>
<li class="col-sm-2 "><strong>通知时间</strong></li> <li class="col-sm-3 "><strong>系统通知时间</strong></li>
<li class="col-sm-3 "><strong>通知状态</strong></li> <li class="col-sm-3 "><strong>通知状态</strong></li>
</a> </a>
</ul> </ul>
@ -216,7 +216,7 @@
<ul class="row mail_list"> <ul class="row mail_list">
<li class="col-sm-1 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo ($key + 1); ?></li> <li class="col-sm-1 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo ($key + 1); ?></li>
<li class="col-sm-7 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"> <li class="col-sm-6 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;">
<span class="brand_text <?php echo strtolower(str_replace(" ","",$item->fundsource))."-color"; ?>"><?php echo $item->fundsource; ?></span> <span class="brand_text <?php echo strtolower(str_replace(" ","",$item->fundsource))."-color"; ?>"><?php echo $item->fundsource; ?></span>
@ -239,7 +239,7 @@
</li> </li>
<li class="col-sm-3 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo date('Y-m-d H:i:s', strtotime($item->pn_payment_date) + 3600 * 8); ?></li> <li class="col-sm-3 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo date('Y-m-d H:i:s', strtotime($item->pn_payment_date) + 3600 * 8); ?></li>
<li class="col-sm-2 nopadding-L" ><?php echo $item->pn_datetime; ?></li> <li class="col-sm-3 nopadding-L" ><?php echo $item->pn_datetime; ?></li>
<li class="col-sm-3" > <li class="col-sm-3" >
<?php <?php
$show_send = ''; $show_send = '';

Loading…
Cancel
Save