|
|
|
|
@ -708,7 +708,7 @@ class Index extends CI_Controller {
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//找到没有发送的记录
|
|
|
|
|
public function send_note($pn_txn_id = false) {
|
|
|
|
|
public function send_note($pn_txn_id = false, $old_ssje=NULL) {
|
|
|
|
|
$data = array();
|
|
|
|
|
|
|
|
|
|
//优先处理指定的交易号,用于修正交易号直接发送通知
|
|
|
|
|
@ -803,23 +803,23 @@ class Index extends CI_Controller {
|
|
|
|
|
//添加支付信息入库
|
|
|
|
|
//没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据
|
|
|
|
|
if (!empty($orderid_info)) {
|
|
|
|
|
$ssje = $this->Paypal_model->get_ssje($item->pn_mc_gross, '15002', mb_strtoupper($item->pn_mc_currency));
|
|
|
|
|
$ssje = $old_ssje===NULL ? $ssje : $old_ssje;
|
|
|
|
|
//更新还没有填的客邮和交易号de收款记录(商务订单)
|
|
|
|
|
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
|
|
|
|
|
$ht_memo = '交易号(自动录入):' . $item->pn_txn_id;
|
|
|
|
|
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
|
|
|
|
|
//CHTAPP订单添加记录前判断是否有记录,以前的APP版本没有交易号,只能拿金额来判断
|
|
|
|
|
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') {//只判断前6位字符,CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
|
|
|
|
|
$ssje = $this->Paypal_model->get_ssje($item->pn_mc_gross, '15002', mb_strtoupper($item->pn_mc_currency));
|
|
|
|
|
$this->Paypal_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->pn_txn_id, $ht_memo);
|
|
|
|
|
if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态,并且订单进度是我的订单
|
|
|
|
|
$this->Paypal_model->update_biz_coli_state($GAI_COLI_SN, 13); //把订单状态改为已付款
|
|
|
|
|
$this->Paypal_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 把订单状态设置为13-新订单已支付
|
|
|
|
|
if (false == $this->Paypal_model->if_biz_gai_exists($item->pn_txn_id) ) {
|
|
|
|
|
$this->Paypal_model->update_biz_coli_state($GAI_COLI_SN, 13);
|
|
|
|
|
}
|
|
|
|
|
$ssje = $this->Paypal_model->get_ssje($item->pn_mc_gross, '15002', mb_strtoupper($item->pn_mc_currency));
|
|
|
|
|
$this->Paypal_model->add_account_info($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->pn_txn_id, $ht_memo);
|
|
|
|
|
// 更新订单主表付款方式,防止没访问thankyou-train.asp
|
|
|
|
|
$this->Paypal_model->update_paymanner($GAI_COLI_SN, '15010');
|
|
|
|
|
@ -829,7 +829,6 @@ class Index extends CI_Controller {
|
|
|
|
|
elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) {
|
|
|
|
|
$ht_memo = '交易号(自动录入):' . $item->pn_txn_id;
|
|
|
|
|
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
|
|
|
|
|
$ssje = $this->Paypal_model->get_ssje($item->pn_mc_gross, '15002', mb_strtoupper($item->pn_mc_currency));
|
|
|
|
|
$gai_sn = $this->Paypal_model->add_tour_account_info($GAI_COLI_SN, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payer, $item->pn_payer_email, $item->pn_txn_id, $ht_memo);
|
|
|
|
|
//添加汉特的订单提醒
|
|
|
|
|
$this->Paypal_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->pn_mc_currency) . $item->pn_mc_gross);
|
|
|
|
|
@ -1078,6 +1077,7 @@ class Index extends CI_Controller {
|
|
|
|
|
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');
|
|
|
|
|
@ -1088,10 +1088,16 @@ class Index extends CI_Controller {
|
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
|
if ($orderid_info->ordertype === 'T') {
|
|
|
|
|
$data['gai_info'] = $this->Paypal_model->get_money_t($pn_txn_id);
|
|
|
|
|
$this->Paypal_model->delete_money_t($pn_txn_id);
|
|
|
|
|
if ( ! empty($data['gai_info'])) {
|
|
|
|
|
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
|
|
|
|
|
$this->Paypal_model->delete_money_t($pn_txn_id);
|
|
|
|
|
}
|
|
|
|
|
} elseif ($orderid_info->ordertype === 'B') {
|
|
|
|
|
$data['gai_info'] = $this->Paypal_model->get_money_b($pn_txn_id);
|
|
|
|
|
$this->Paypal_model->delete_money_b($pn_txn_id);
|
|
|
|
|
if ( ! empty($data['gai_info'])) {
|
|
|
|
|
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
|
|
|
|
|
$this->Paypal_model->delete_money_b($pn_txn_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1102,7 +1108,7 @@ class Index extends CI_Controller {
|
|
|
|
|
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
|
|
|
|
|
if (!empty($advisor_info)) {
|
|
|
|
|
$this->Note_model->set_invoice($pn_txn_id, $neworder);
|
|
|
|
|
$this->send_note($pn_txn_id);
|
|
|
|
|
$this->send_note($pn_txn_id, $old_ssje);
|
|
|
|
|
echo json_encode('修改成功!');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|