diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index 17cef09e..e181633c 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -50,6 +50,7 @@ class AlipayTradeService extends CI_Controller $this->load->model('AlipayTradeQueryContentBuilder'); $this->load->model('Alipay_note_model'); $this->load->model('Alipay_model'); + $this->load->model('Group_model'); $this->load->helper('payment'); $this->load->model('Online_payment_account_model', 'payment_model'); @@ -326,6 +327,14 @@ class AlipayTradeService extends CI_Controller return $result; } + // https://www.mycht.cn/webht.php/apps/pay/AlipayTradeService/test_new_function?coli_sn=962702 + public function test_new_function() { + echo 'test_new_function'; + $coli_sn = $this->input->get('coli_sn'); + $this->Group_model->update_ck_group_info($coli_sn); + echo 'update_ck_group_info'; + } + /*! * 定时执行 * 处理异步通知: 解析订单号, 邮件外联/客人; 插入付款记录 @@ -407,6 +416,10 @@ class AlipayTradeService extends CI_Controller //添加支付信息入库 //没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据 if (!empty($orderid_info)) { + // + $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; + $this->Group_model->update_ck_group_info($GAI_COLI_SN); + $currencyCode = str_replace("CNY", "RMB", trim(mb_strtoupper($item->ALI_currencyCode))); $ssje = $item->ALI_orderAmount; if (intval($item->ALI_stateCode)!==1) { @@ -417,7 +430,6 @@ class AlipayTradeService extends CI_Controller //更新还没有填的客邮和交易号de收款记录(商务订单) if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) { $ht_memo = '交易号(自动录入):' . $item->ALI_dealId; - $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; //CHTAPP订单添加记录前判断是否有记录,以前的APP版本没有交易号,只能拿金额来判断 if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP' && strstr($advisor_info->COLI_WebCode, "-") != '-biz') { //只判断前6位字符,CHTAPP-fr CHTAPP-jp等各语种都属于APP订单 diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php index 5b78b985..b546c2a2 100644 --- a/webht/third_party/pay/controllers/PaymentService.php +++ b/webht/third_party/pay/controllers/PaymentService.php @@ -16,6 +16,7 @@ class PaymentService extends CI_Controller { $this->load->library('alipay_call'); $this->load->model('Online_payment_note_model', 'note_model'); $this->load->model('Online_payment_account_model', 'account_model'); + $this->load->model('Group_model'); } private $code_brandname = array( @@ -155,6 +156,7 @@ class PaymentService extends CI_Controller { continue; } $COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; + $this->Group_model->update_ck_group_info($COLI_SN); $update_note_column = array(); if ($advisor_info->order_type == 0) { /* 商务订单 */ diff --git a/webht/third_party/pay/models/Group_model.php b/webht/third_party/pay/models/Group_model.php new file mode 100644 index 00000000..530d54c0 --- /dev/null +++ b/webht/third_party/pay/models/Group_model.php @@ -0,0 +1,36 @@ +HT = $this->load->database('HT', TRUE); + } + public function update_ck_group_info($COLI_SN) + { + $group_sn_query = + "select COLI_GRI_SN from ConfirmLineInfo where COLI_SN=? + union + select COLI_GRI_SN from BIZ_ConfirmLineInfo where COLI_SN=?"; + $group_sn_row = $this->HT->query($group_sn_query, array($COLI_SN, $COLI_SN))->row(); + var_dump($group_sn_row); + + if (!empty($group_sn_row) && $group_sn_row->COLI_GRI_SN > 0) { + $group_sn = $group_sn_row->COLI_GRI_SN; + + $check_group_query = "select CGI_SN from CK_GroupInfo where CGI_GRI_SN=?"; + $check_group_row = $this->HT->query($check_group_query, array($group_sn))->row(); + var_dump($check_group_row); + if (empty($check_group_row)) { + $update_group_query = "exec SP_CheckGroup_UpdateCKGroupInfo(?, 29)"; + // $update_group_row = $this->HT->query($update_group_query, array($group_sn)); + } + } + } + +} diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 8bd5df21..4a0c9567 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -10,6 +10,7 @@ class Index extends CI_Controller { // $this->output->enable_profiler(TRUE); $this->load->model('Paypal_model'); $this->load->model('Note_model'); + $this->load->model('Group_model'); bcscale(2); } @@ -933,10 +934,11 @@ class Index extends CI_Controller { $ssje = $this->Paypal_model->get_ssje($item->pn_mc_gross, '15002', mb_strtoupper($item->pn_mc_currency)); $ssje = $old_ssje===NULL ? $ssje : $old_ssje; $USD_amount = $this->Paypal_model->get_USD($item->pn_mc_gross, $item->pn_mc_currency); + $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; + $this->Group_model->update_ck_group_info($GAI_COLI_SN); //更新还没有填的客邮和交易号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' && strstr($advisor_info->COLI_WebCode, "-") !== '-biz') {//只判断前6位字符,CHTAPP-fr CHTAPP-jp等各语种都属于APP订单 $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, $item->pn_payer_email, $item->pn_txn_id, $ht_memo);