Merge branch 'master' of gitee.com:hainatravel/information-system

hotfix/远程访问多媒体中心
cyc 6 years ago
commit d049df730d

@ -330,7 +330,7 @@ class AlipayTradeService extends CI_Controller
* 处理异步通知: 解析订单号, 邮件外联/客人; 插入付款记录 * 处理异步通知: 解析订单号, 邮件外联/客人; 插入付款记录
* @author LYT <lyt@hainatravel.com> * @author LYT <lyt@hainatravel.com>
*/ */
public function send_alipay($pn_txn_id = false) public function send_alipay($pn_txn_id = false, $old_ssje=null)
{ {
$data = array(); $data = array();
$int = 0; $int = 0;
@ -365,7 +365,7 @@ class AlipayTradeService extends CI_Controller
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理 //退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->ALI_payType == 'refund') { if ($item->ALI_payType == 'refund') {
$this->send_refund($item); $this->send_refund($item, $old_ssje);
// $this->Alipay_note_model->update_send($item->ALI_dealId, 'send'); // $this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
continue; continue;
} }
@ -411,6 +411,7 @@ class AlipayTradeService extends CI_Controller
if (intval($item->ALI_stateCode)!==1) { if (intval($item->ALI_stateCode)!==1) {
$ssje = $this->Alipay_model->get_ssje($item->ALI_orderAmount, $currencyCode); $ssje = $this->Alipay_model->get_ssje($item->ALI_orderAmount, $currencyCode);
} }
$ssje = $old_ssje===null ? $ssje : $old_ssje;
$USD_amount = $this->Alipay_model->get_USD($item->ALI_orderAmount, $currencyCode); $USD_amount = $this->Alipay_model->get_USD($item->ALI_orderAmount, $currencyCode);
//更新还没有填的客邮和交易号de收款记录商务订单 //更新还没有填的客邮和交易号de收款记录商务订单
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) { if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
@ -528,7 +529,7 @@ class AlipayTradeService extends CI_Controller
* @date 2019-05-09 * @date 2019-05-09
* * TODO 线下收款之后产生的退款没有通知 * * TODO 线下收款之后产生的退款没有通知
*/ */
public function send_refund($item) public function send_refund($item, $old_ssje=null)
{ {
// raw // raw
$raw = json_decode($item->ALI_memo); $raw = json_decode($item->ALI_memo);
@ -566,6 +567,7 @@ class AlipayTradeService extends CI_Controller
$currencyCode = str_replace("CNY", "RMB", trim(mb_strtoupper($item->ALI_currencyCode))); $currencyCode = str_replace("CNY", "RMB", trim(mb_strtoupper($item->ALI_currencyCode)));
$currencyCode = mb_strtoupper(trim($currencyCode)); $currencyCode = mb_strtoupper(trim($currencyCode));
$ssje = $this->Alipay_model->get_ssje($item->ALI_orderAmount, $currencyCode, '15015'); $ssje = $this->Alipay_model->get_ssje($item->ALI_orderAmount, $currencyCode, '15015');
$ssje = $old_ssje===null ? $ssje : $old_ssje;
$USD_amount = $this->Alipay_model->get_USD($item->ALI_orderAmount, $currencyCode); $USD_amount = $this->Alipay_model->get_USD($item->ALI_orderAmount, $currencyCode);
//更新还没有填的客邮和交易号de收款记录商务订单 //更新还没有填的客邮和交易号de收款记录商务订单
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) { if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
@ -1051,29 +1053,55 @@ class AlipayTradeService extends CI_Controller
//获取note详情以便后续修改各项数据 //获取note详情以便后续修改各项数据
public function note_modal($pn_txn_id = false, $pn_invoice = false ,$notice_time = false) { public function note_modal($pn_txn_id = false, $pn_invoice = false ,$notice_time = false) {
// $this->permission->is_admin(true);
// $data = array();
// $data['IPL_orderId'] = $pn_invoice;
// if (!empty($pn_txn_id)) {
// $data['note'] = $this->Alipay_note_model->note($pn_txn_id);
// if (!empty($data['note'])) {
// if (!empty($pn_invoice)) {
// $orderid_info = analysis_orderid($pn_invoice);
// } else {
// $orderid_info = analysis_orderid($data['note']->IPL_orderId);
// }
// if (!empty($orderid_info)) {
// $orderid_info = json_decode($orderid_info);
// $data['order_info'] = $this->Alipay_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype);
// }
// $data["paytext"] = $this->payment_status();
// echo json_encode($this->load->view('alipay_note_setting', $data, true));
// return true;
// }
// }
// echo json_encode('没找到数据!');
// return;
$this->permission->is_admin(true); $this->permission->is_admin(true);
$data = array(); $data = array();
$data['IPL_orderId'] = $pn_invoice; $data['note'] = $this->Alipay_note_model->note($pn_txn_id);
if (!empty($pn_txn_id)) { $orderid_info = analysis_orderid($data['note']->ALI_orderId);
$data['note'] = $this->Alipay_note_model->note($pn_txn_id); if (!empty($orderid_info)) {
if (!empty($data['note'])) { $orderid_info = json_decode($orderid_info);
if (!empty($pn_invoice)) { if ($orderid_info->ordertype === 'T') {
$orderid_info = analysis_orderid($pn_invoice); $data['gai_info'] = $this->Alipay_model->get_money_t($pn_txn_id);
} else { } elseif ($orderid_info->ordertype === 'B') {
$orderid_info = analysis_orderid($data['note']->IPL_orderId); $data['gai_info'] = $this->Alipay_model->get_money_b($pn_txn_id);
}
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
$data['order_info'] = $this->Alipay_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype);
}
$data["paytext"] = $this->payment_status();
echo json_encode($this->load->view('alipay_note_setting', $data, true));
return true;
} }
} }
echo json_encode('没找到数据!'); $data['old_order'] = $data['note']->ALI_orderId;
return; $data['new_order'] = $pn_invoice;
$data['order_info'] = null;
if ($pn_invoice !== null) {
$neworder_id = analysis_orderid($pn_invoice);
$neworder_id = json_decode($neworder_id);
if ( ! empty($neworder_id)) {
$data['order_info'] = $this->Alipay_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype);
}
}
$data["paytext"] = $this->payment_status();
echo json_encode($this->load->view('alipay_note_setting', $data, true));
} }
public function note_order_modal($old_order,$pn_invoice = false ,$notice_time = false) { public function note_order_modal($old_order,$pn_invoice = false ,$notice_time = false) {
$data = array(); $data = array();
$data['IPL_orderId'] = $pn_invoice; $data['IPL_orderId'] = $pn_invoice;
@ -1112,13 +1140,38 @@ class AlipayTradeService extends CI_Controller
} }
//修改订单名 //修改订单名
// TODO 支持转移功能
public function note_modal_save() { public function note_modal_save() {
$data = array(); $data = array();
$old_ssje = null;
$pn_txn_id = $this->input->post('pn_txn_id'); $pn_txn_id = $this->input->post('pn_txn_id');
$pn_invoice = $this->input->post('pn_invoice'); $pn_invoice = $this->input->post('pn_invoice');
$data['note'] = $this->Alipay_note_model->note($pn_txn_id);
$orderid_info = analysis_orderid($data['note']->ALI_orderId);
// if (empty($orderid_info) && $data['note']->ALI_payType == 'refund'
// && true === $this->Alipay_model->if_APP_order($data['note']->ALI_orderId)
// ) {
// // APP 组的退款订单是没有后缀的
// $orderid_info = analysis_orderid($data['note']->ALI_orderId . '_B');
// }
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->Alipay_model->get_money_t(substr($pn_txn_id,0,30));
if ( ! empty($data['gai_info'])) {
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
$this->Alipay_model->delete_money_t(substr($pn_txn_id,0,30));
}
} elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'A') {
$data['gai_info'] = $this->Alipay_model->get_money_b(substr($pn_txn_id,0,30));
if ( ! empty($data['gai_info'])) {
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
$this->Alipay_model->delete_money_b(substr($pn_txn_id,0,30));
}
}
}
if (!empty($pn_txn_id) && !empty($pn_invoice)) { if (!empty($pn_txn_id) && !empty($pn_invoice)) {
$orderid_info = analysis_orderid($pn_invoice); $orderid_info = analysis_orderid($pn_invoice);
if (!empty($orderid_info)) { if (!empty($orderid_info)) {
@ -1126,7 +1179,7 @@ class AlipayTradeService extends CI_Controller
$advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
if (!empty($advisor_info)) { if (!empty($advisor_info)) {
$this->Alipay_note_model->set_invoice($pn_txn_id, $pn_invoice); $this->Alipay_note_model->set_invoice($pn_txn_id, $pn_invoice);
$this->send_alipay($pn_txn_id); $this->send_alipay($pn_txn_id, $old_ssje);
echo json_encode('修改成功!'); echo json_encode('修改成功!');
return true; return true;
} }

@ -155,7 +155,7 @@ class Alipay_model extends CI_Model {
IF NOT EXISTS( IF NOT EXISTS(
SELECT TOP 1 1 SELECT TOP 1 1
FROM BIZ_GroupAccountInfo FROM BIZ_GroupAccountInfo
WHERE GAI_COLI_SN = ? AND GAI_SQJE=? and GAI_Type=15015 WHERE GAI_COLI_SN = ? AND GAI_SQJE=? and GAI_Type=15015 and DeleteFlag=0
) )
INSERT INTO BIZ_GroupAccountInfo ( INSERT INTO BIZ_GroupAccountInfo (
GAI_COLI_SN GAI_COLI_SN
@ -188,7 +188,7 @@ class Alipay_model extends CI_Model {
IF NOT EXISTS( IF NOT EXISTS(
SELECT TOP 1 1 SELECT TOP 1 1
FROM BIZ_GroupAccountInfo FROM BIZ_GroupAccountInfo
WHERE GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%' WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%') and DeleteFlag=0
) )
INSERT INTO BIZ_GroupAccountInfo ( INSERT INTO BIZ_GroupAccountInfo (
GAI_COLI_SN GAI_COLI_SN
@ -222,7 +222,7 @@ class Alipay_model extends CI_Model {
IF NOT EXISTS( IF NOT EXISTS(
SELECT TOP 1 1 SELECT TOP 1 1
FROM GroupAccountInfo FROM GroupAccountInfo
WHERE GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%' WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%') and DeleteFlag=0
) )
INSERT INTO GroupAccountInfo ( INSERT INTO GroupAccountInfo (
GAI_COLI_SN GAI_COLI_SN
@ -413,4 +413,44 @@ class Alipay_model extends CI_Model {
return $this->HT->query($sql, $COLI_SN)->row(); return $this->HT->query($sql, $COLI_SN)->row();
} }
} }
//根据交易号获取收款记录(传统订单)
public function get_money_t($pn_invoice) {
$like = $this->HT->escape_like_str($pn_invoice);
$sql = "SELECT COLI_ID,GroupAccountInfo.*
from GroupAccountInfo
inner join ConfirmLineInfo coli on COLI_SN=GAI_COLI_SN
where GAI_Type='15015' and GroupAccountInfo.DeleteFlag=0 and (GAI_AccreditNo=? or GAI_Memo like '%$like%')
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
return $result;
}
//根据交易号获取收款记录(商务订单)
public function get_money_b($pn_invoice) {
$like = $this->HT->escape_like_str($pn_invoice);
$sql = "SELECT COLI_ID,BIZ_GroupAccountInfo.*
from BIZ_GroupAccountInfo
inner join BIZ_ConfirmLineInfo on COLI_SN=GAI_COLI_SN
where GAI_Type='15015' and BIZ_GroupAccountInfo.DeleteFlag=0 and (GAI_AccreditNo=? or GAI_Memo like '%$like%')
";
$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_Type='15015' and 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_Type='15015' and GAI_AccreditNo=?";
$query = $this->HT->query($sql, array($deadId));
return $query;
}
} }

@ -42,7 +42,8 @@ class Alipay_note_model extends CI_Model {
public function search_date($date) { public function search_date($date) {
$this->init(); $this->init();
$search_sql = " AND pn.ALI_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' "; $search_sql = " AND pn.ALI_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59'
OR isnull(ALI_sent,'') in ('sendfail','unsend','') ";
$this->search = $search_sql; $this->search = $search_sql;
$this->orderby=" ORDER BY CASE pn.ALI_sent WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.ALI_sn DESC "; $this->orderby=" ORDER BY CASE pn.ALI_sent WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.ALI_sn DESC ";
return $this->get_list(); return $this->get_list();
@ -198,4 +199,5 @@ class Alipay_note_model extends CI_Model {
return $this->INFO->query($sql, array($payer,$dealId)); return $this->INFO->query($sql, array($payer,$dealId));
} }
} }

@ -1,5 +1,22 @@
<form action="/webht.php/apps/pay/AlipayTradeService/note_modal_save" method="post" id="form_modal_orderid" name="form_modal_orderid"> <form action="/webht.php/apps/pay/AlipayTradeService/note_modal_save" method="post" id="form_modal_orderid" name="form_modal_orderid">
<?php if ( ! empty($gai_info)) { ?>
<p>已录入订单 <?php echo !empty($old_order) ? $old_order : ""; ?></p>
<table class="table table-hover table-bordered">
<thead>
<th>订单号</th>
<th>申请金额/币种</th>
<th>实收金额</th>
</thead>
<?php foreach ($gai_info as $key => $value) { ?>
<tr>
<td><?php echo $value->GAI_COLI_ID; ?></td>
<td><?php echo $value->GAI_SQJE; ?>&nbsp;<?php echo $value->GAI_SQJECurrency; ?></td>
<td><?php echo $value->GAI_SSJE; ?>&nbsp;CNY</td>
</tr>
<?php } ?>
</table>
<p style="color:#a31022;">撤回以上订单收款记录, 并转移到订单: (手动录入的不会撤回) </p>
<?php } else { ?>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>交易号</dt> <dt>交易号</dt>
<dd><?php echo $note->ALI_dealId ?> ( <?php echo $paytext[(trim($note->ALI_resultMsg))].".".$note->ALI_resultMsg; ?> )</dd> <dd><?php echo $note->ALI_dealId ?> ( <?php echo $paytext[(trim($note->ALI_resultMsg))].".".$note->ALI_resultMsg; ?> )</dd>
@ -12,22 +29,18 @@
<dt>付款时间</dt> <dt>付款时间</dt>
<dd><?php echo $note->ALI_acquiringTime; ?></dd> <dd><?php echo $note->ALI_acquiringTime; ?></dd>
</dl> </dl>
<?php } ?>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>订单号</dt>
<dd>
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" id="pn_invoice" name="pn_invoice" value="<?php echo!empty($ALI_orderId) ? $ALI_orderId : $note->ALI_orderId; ?>"> <input type="text" class="form-control" id="pn_invoice" name="pn_invoice" value="<?php //echo!empty($ALI_orderId) ? $ALI_orderId : $note->ALI_orderId; ?><?php echo !empty($new_order) ? $new_order : $old_order; ?>">
<span class="input-group-addon search-btn" onclick="show_order_modal('<?php echo $note->ALI_dealId; ?>', $('#pn_invoice').val(),'<?php echo $note->ALI_noticeTime; ?>','<?php echo $note->ALI_orderId; ?>')"></span> <span class="input-group-addon search-btn" onclick="show_order_modal('<?php echo $note->ALI_dealId; ?>', $('#pn_invoice').val(),'<?php echo $note->ALI_noticeTime; ?>','<?php echo $note->ALI_orderId; ?>')"></span>
</div> </div>
<label class="text-danger">订单号形如: 160414408_B , B商务订单JJ160321052_T,T传统订单请务必加上后缀</label> <label class="text-danger">订单号形如: 160414408_B , B商务订单JJ160321052_T,T传统订单请务必加上后缀</label>
</dd>
</dl> </dl>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>订单详细内容</dt> <p>订单详细内容</p>
<dd>
<?php <?php
if (!empty($order_info)) { if (!empty($order_info)) {
@ -42,11 +55,10 @@
} }
?> ?>
</dd>
</dl> </dl>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt><a href="javascript:void(0);" onclick="$('#note_original_data').toggle()" >原始数据</a></dt> <p><a href="javascript:void(0);" onclick="$('#note_original_data').toggle()" style="color:#a31022;" >原始数据&nbsp;&raquo;</a></p>
<dd> <span style="display: none;" id="note_original_data"><?php echo str_replace('","', '"<br/>"', $note->ALI_memo); ?></span></dd> <span style="display: none;" id="note_original_data"><?php echo str_replace('","', '"<br/>"', $note->ALI_memo); ?></span>
</dl> </dl>
<input type="hidden" name="pn_txn_id" id="pn_txn_id" value="<?php echo $note->ALI_dealId; ?>" /> <input type="hidden" name="pn_txn_id" id="pn_txn_id" value="<?php echo $note->ALI_dealId; ?>" />

Loading…
Cancel
Save