diff --git a/webht/third_party/pay/config/paypal.php b/webht/third_party/pay/config/paypal.php index 335d05d8..70dcceaa 100644 --- a/webht/third_party/pay/config/paypal.php +++ b/webht/third_party/pay/config/paypal.php @@ -15,10 +15,9 @@ $config['currency'] = "USD"; $config['token_url'] = "https://api.paypal.com/v1/oauth2/token"; $config['web_profiles_url'] = "https://api.paypal.com/v1/payment-experience/web-profiles/"; $config['webhooks_url'] = "https://api.paypal.com/v1/notifications/webhooks"; -$config['payment_url'] = "https://api.paypal.com/v1/payments/payment/"; -$config['sale_url'] = "https://api.paypal.com/v1/payments/sale/"; -// $config['activities_url'] = "https://api.paypal.com/v1/activities/activities"; -// $config['reporting_url'] = "https://api.paypal.com/v1/reporting/transactions"; +$config['payment_url'] = "https://api.paypal.com/v1/payments/payment"; +$config['sale_url'] = "https://api.paypal.com/v1/payments/sale"; +$config['activities_url'] = "https://api.paypal.com/v1/activities/activities"; $config['return_url'] = "https://www.chinahighlights.com"; $config['cancel_url'] = "https://www.chinahighlights.com"; diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index e0cd7ccf..80b0d260 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -402,20 +402,16 @@ class AlipayTradeService extends CI_Controller $ht_memo ); // 更新订单主表付款方式,防止没访问thankyou-train.asp - if (empty($advisor_info->COLI_PayManner)) { - $this->Alipay_model->update_paymanner($GAI_COLI_SN); - } - if ($advisor_info->COLI_Department == 10) { + $this->Alipay_model->update_paymanner($GAI_COLI_SN); // 把订单状态设置为13-新订单已支付 $this->Alipay_model->update_biz_coli_state($GAI_COLI_SN, 13); - } } } //更新还没有填的客邮和交易号de收款记录(传统订单) elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) { $ht_memo = '交易号(自动录入):' . $item->ALI_dealId; $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; - $this->Alipay_model->add_tour_account_info( + $gai_sn = $this->Alipay_model->add_tour_account_info( $GAI_COLI_SN, $item->ALI_orderAmount, $item->ALI_acquiringTime, @@ -430,6 +426,8 @@ class AlipayTradeService extends CI_Controller ); //添加汉特的订单提醒 $this->Alipay_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->ALI_currencyCode) . $item->ALI_orderAmount); + // 添加HT任务 + $this->Alipay_model->exec_addToTask($gai_sn); } } diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php index 6db9d8b6..07154dd8 100644 --- a/webht/third_party/pay/controllers/iPayLinksService.php +++ b/webht/third_party/pay/controllers/iPayLinksService.php @@ -286,6 +286,18 @@ class IPayLinksService extends CI_Controller $this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp))); return; } + public function query_refund($refund_order_id) + { + $this->query_info_arr["queryOrderId"] = $this->create_guid(); + $this->query_info_arr["orderId"] = $refund_order_id; + $this->query_info_arr['mode'] = '1'; + $this->query_info_arr['type'] = '2'; + $this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr); + $resp = $this->curl($this->queryUrl,$this->query_info_arr); + $resp_obj = simplexml_load_string($resp); + $this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp))); + return; + } public function query_pay_list($day_offset = 3) { @@ -432,9 +444,23 @@ class IPayLinksService extends CI_Controller //CHTAPP订单添加记录前判断是否有记录,以前的APP版本没有交易号,只能拿金额来判断 if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') { //只判断前6位字符,CHTAPP-fr CHTAPP-jp等各语种都属于APP订单 - // $this->IPayLinks_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), $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->IPL_dealId, $ht_memo); - // if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态,并且订单进度是我的订单 - // $this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款 + $this->IPayLinks_model->add_account_info_forAPP( + $GAI_COLI_SN, + $advisor_info->COLI_ID, + $item->IPL_orderAmount, + $item->IPL_completeTime, + mb_strtoupper($item->currencyCode), + $ssje, + $item->IPL_completeTime, + $item->IPL_completeTime, + $item->IPL_acquiringTime, + $item->IPL_payerName, + $item->IPL_payerEmail, + $item->IPL_dealId, + $ht_memo); + // if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { + // //只修改APP组的订单状态,并且订单进度是我的订单 + // $this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 13); //把订单状态改为已付款 // } } else { $this->IPayLinks_model->add_account_info( @@ -452,10 +478,8 @@ class IPayLinksService extends CI_Controller $item->IPL_dealId, $ht_memo ); - if ($advisor_info->COLI_Department == 10) { // 把订单状态设置为13-新订单已支付 $this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 13); - } // 更新订单主表付款方式,防止没访问thankyou-train.asp if (empty($advisor_info->COLI_PayManner)) { $this->IPayLinks_model->update_paymanner($GAI_COLI_SN); @@ -466,7 +490,7 @@ class IPayLinksService extends CI_Controller elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) { $ht_memo = '交易号(自动录入):' . $item->IPL_dealId; $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; - $this->IPayLinks_model->add_tour_account_info( + $gai_sn = $this->IPayLinks_model->add_tour_account_info( $GAI_COLI_SN, $item->IPL_orderAmount, $item->IPL_acquiringTime, @@ -482,6 +506,8 @@ class IPayLinksService extends CI_Controller ); //添加汉特的订单提醒 $this->IPayLinks_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->IPL_currencyCode) . $item->IPL_orderAmount); + // 添加HT任务 + $this->IPayLinks_model->exec_addToTask($gai_sn); } } @@ -951,7 +977,7 @@ class IPayLinksService extends CI_Controller $neworder = $this->input->post('pn_invoice'); $data['note'] = $this->Note_model->note($pn_txn_id, $pn_id); - $orderid_info = $this->analysis_orderid($data['note'][0]->IPL_orderId); + $orderid_info = $this->analysis_orderid($data['note']->IPL_orderId); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); if ($orderid_info->ordertype === 'T') { @@ -1056,25 +1082,26 @@ class IPayLinksService extends CI_Controller //修改订单名 public function note_modal_save() { - $data = array(); - - $pn_txn_id = $this->input->post('pn_txn_id'); - $pn_invoice = $this->input->post('pn_invoice'); - - if (!empty($pn_txn_id) && !empty($pn_invoice)) { - $orderid_info = $this->analysis_orderid($pn_invoice); - if (!empty($orderid_info)) { - $orderid_info = json_decode($orderid_info); - $advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); - if (!empty($advisor_info)) { - $this->Note_model->set_invoice($pn_txn_id, $pn_invoice); - $this->batch_send_note($pn_txn_id); - echo json_encode('修改成功!'); - return true; - } - } - } - echo json_encode('没找到数据!'); + $this->gai_modal_save(); + // $data = array(); + + // $pn_txn_id = $this->input->post('pn_txn_id'); + // $pn_invoice = $this->input->post('pn_invoice'); + + // if (!empty($pn_txn_id) && !empty($pn_invoice)) { + // $orderid_info = $this->analysis_orderid($pn_invoice); + // if (!empty($orderid_info)) { + // $orderid_info = json_decode($orderid_info); + // $advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + // if (!empty($advisor_info)) { + // $this->Note_model->set_invoice($pn_txn_id, $pn_invoice); + // $this->batch_send_note($pn_txn_id); + // echo json_encode('修改成功!'); + // return true; + // } + // } + // } + // echo json_encode('没找到数据!'); return; } @@ -1106,6 +1133,7 @@ class IPayLinksService extends CI_Controller */ public function get_refund_list($daylength=3) { + return false; // ipaylinks的批量查询接口已关闭 bcscale(2); $ret = array(); $list = $this->refund_list_info($daylength); diff --git a/webht/third_party/pay/models/Alipay_model.php b/webht/third_party/pay/models/Alipay_model.php index 97600764..82deefb8 100644 --- a/webht/third_party/pay/models/Alipay_model.php +++ b/webht/third_party/pay/models/Alipay_model.php @@ -18,7 +18,7 @@ class Alipay_model extends CI_Model { $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T if ($ordertype == 'B' || $ordertype == 'A') { - $sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo + $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_ID =?"; $query = $this->HT->query($sql, array($COLI_ID)); @@ -26,7 +26,7 @@ class Alipay_model extends CI_Model { } //后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。 if (empty($result) && ($ordertype == 'T')) { - $sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo + $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_ID like '%$COLI_ID'"; $query = $this->HT->query($sql); @@ -36,7 +36,7 @@ class Alipay_model extends CI_Model { //查传统订单add_code,网前实时支付会先生成一个临时订单号存在add_code里,如订单45103248 if (empty($result) && ($ordertype == 'M')) { - $sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo + $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_AddCode =? "; $query = $this->HT->query($sql, array($COLI_ID)); @@ -44,7 +44,7 @@ class Alipay_model extends CI_Model { } if (empty($result) && ($ordertype == 'M')) { - $sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli + $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where EXISTS ( @@ -60,7 +60,7 @@ class Alipay_model extends CI_Model { //订单号查询不到尝试使用团号查询 if (empty($result) && $ordertype == 'B') { - $sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo + $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_GroupCode like '%-$COLI_ID%'"; $query = $this->HT->query($sql); @@ -68,10 +68,14 @@ class Alipay_model extends CI_Model { } //团号查询不到尝试使用客人邮箱查询(预订多次的老客户得按日期新旧排序,取最新的数据) - if (!empty($result)) { + if (!empty($result) && is_array($result) ) { //print_r($result[0]); //die(); - $result = $result[0]; + if (count($result) > 1) { + $result = array(); + } else { + $result = $result[0]; + } } return $result; @@ -119,7 +123,7 @@ class Alipay_model extends CI_Model { $sql = " UPDATE BIZ_ConfirmLineInfo SET COLI_State = ? - WHERE COLI_SN = ? + WHERE COLI_SN = ? AND COLI_State in (0,1,11,12,13,14,40,50,60,101,102,999) "; $query = $this->HT->query($sql, array($coli_state, $coli_sn)); return $query; @@ -217,7 +221,7 @@ class Alipay_model extends CI_Model { ) VALUES (?,15015,?,?,?,?,?,?,?,?,?,?,0,0)"; $query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo)); $insertid = $this->HT->last_id('GroupAccountInfo'); - return $query; + return $insertid; } //更新线路提醒 @@ -299,4 +303,15 @@ class Alipay_model extends CI_Model { $query = $this->HT->query($sql, array($paymanner, $COLI_SN)); return $query; } + + /** JJH: 添加订单收款记录之后执行 */ + public function exec_addToTask($GAI_SN) + { + $sql = " if not exists ( + select top 1 1 from Sysautotask + where SAT_Type=1 and SAT_SourceSN=$GAI_SN + ) exec SP_AddToSystask 1," . $GAI_SN; + $query = $this->HT->query($sql); + return $query; + } } diff --git a/webht/third_party/pay/models/IPayLinks_model.php b/webht/third_party/pay/models/IPayLinks_model.php index ff8af136..8ac260b2 100644 --- a/webht/third_party/pay/models/IPayLinks_model.php +++ b/webht/third_party/pay/models/IPayLinks_model.php @@ -18,7 +18,7 @@ class IPayLinks_model extends CI_Model { $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T if ($ordertype == 'B' || $ordertype == 'A') { - $sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo + $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_ID =?"; $query = $this->HT->query($sql, array($COLI_ID)); @@ -26,7 +26,7 @@ class IPayLinks_model extends CI_Model { } //后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。 if (empty($result) && ($ordertype == 'T')) { - $sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo + $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_ID like '%$COLI_ID'"; $query = $this->HT->query($sql); @@ -36,7 +36,7 @@ class IPayLinks_model extends CI_Model { //查传统订单add_code,网前实时支付会先生成一个临时订单号存在add_code里,如订单45103248 if (empty($result) && ($ordertype == 'M')) { - $sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo + $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_AddCode =? "; $query = $this->HT->query($sql, array($COLI_ID)); @@ -44,7 +44,7 @@ class IPayLinks_model extends CI_Model { } if (empty($result) && ($ordertype == 'M')) { - $sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli + $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where EXISTS ( @@ -60,7 +60,7 @@ class IPayLinks_model extends CI_Model { //订单号查询不到尝试使用团号查询 if (empty($result) && $ordertype == 'B') { - $sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo + $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN where COLI_GroupCode like '%-$COLI_ID%'"; $query = $this->HT->query($sql); @@ -68,10 +68,14 @@ class IPayLinks_model extends CI_Model { } //团号查询不到尝试使用客人邮箱查询(预订多次的老客户得按日期新旧排序,取最新的数据) - if (!empty($result)) { + if (!empty($result) && is_array($result) ) { //print_r($result[0]); //die(); - $result = $result[0]; + if (count($result) > 1) { + $result = array(); // 找到多条匹配的订单记录时,不处理 + } else { + $result = $result[0]; + } } return $result; @@ -119,20 +123,20 @@ class IPayLinks_model extends CI_Model { $sql = " UPDATE BIZ_ConfirmLineInfo SET COLI_State = ? - WHERE COLI_SN = ? + WHERE COLI_SN = ? and COLI_State in (0,1,11,12,13,14,40,50,60,101,102,999) "; $query = $this->HT->query($sql, array($coli_state, $coli_sn)); return $query; } //添加收款记录(商务订单),APP会自动增加记录,所以添加前根据金额来判断是否有重复记录 - public function add_account_info_forAPP($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) { + public function add_account_info_forAPP($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) { //先判断是否有这条数据 $sql = " IF NOT EXISTS( SELECT TOP 1 1 FROM BIZ_GroupAccountInfo - WHERE GAI_COLI_SN = ? AND GAI_SQJE=? + WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%') and DeleteFlag=0 ) INSERT INTO BIZ_GroupAccountInfo ( GAI_COLI_SN @@ -141,6 +145,7 @@ class IPayLinks_model extends CI_Model { ,GAI_SQJE ,GAI_SQDate ,GAI_SQJECurrency + ,GAI_SSJE ,GAI_SSDate ,GAI_AccountDate ,GAI_SubmitDate @@ -150,8 +155,8 @@ class IPayLinks_model extends CI_Model { ,GAI_Memo ,GAI_State ,DeleteFlag - ) VALUES (?,?,15010,?,?,?,?,?,?,?,?,?,?,0,0)"; - $query = $this->HT->query($sql, array($GAI_COLI_SN, $GAI_SQJE, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo)); + ) VALUES (?,?,15018,?,?,?,?,?,?,?,?,?,?,?,0,0)"; + $query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo)); $insertid = $this->HT->last_id('BIZ_GroupAccountInfo'); return $query; } @@ -197,7 +202,7 @@ class IPayLinks_model extends CI_Model { IF NOT EXISTS( SELECT TOP 1 1 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 ( GAI_COLI_SN @@ -218,7 +223,7 @@ class IPayLinks_model extends CI_Model { ) VALUES (?,15018,?,?,?,?,?,?,?,?,?,?,?,0,0)"; $query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo)); $insertid = $this->HT->last_id('GroupAccountInfo'); - return $query; + return $insertid; } //更新线路提醒 @@ -309,9 +314,11 @@ class IPayLinks_model extends CI_Model { //根据交易号获取收款记录(传统订单) public function get_money_t($pn_invoice) { - $sql = "SELECT GroupAccountInfo.* + $like = $this->HT->escape_like_str($pn_invoice); + $sql = "SELECT COLI_ID,GroupAccountInfo.* from GroupAccountInfo - where GAI_Type='15018' and DeleteFlag=0 and GAI_AccreditNo=? + inner join ConfirmLineInfo coli on COLI_SN=GAI_COLI_SN + where GAI_Type='15018' and GroupAccountInfo.DeleteFlag=0 and (GAI_AccreditNo=? or GAI_Memo like '%$like%') "; $query = $this->HT->query($sql, array($pn_invoice)); $result = $query->result(); @@ -319,9 +326,11 @@ class IPayLinks_model extends CI_Model { } //根据交易号获取收款记录(商务订单) public function get_money_b($pn_invoice) { - $sql = "SELECT BIZ_GroupAccountInfo.* + $like = $this->HT->escape_like_str($pn_invoice); + $sql = "SELECT COLI_ID,BIZ_GroupAccountInfo.* from BIZ_GroupAccountInfo - where GAI_Type='15018' and DeleteFlag=0 and GAI_AccreditNo=? + inner join BIZ_ConfirmLineInfo on COLI_SN=GAI_COLI_SN + where GAI_Type='15018' and BIZ_GroupAccountInfo.DeleteFlag=0 and (GAI_AccreditNo=? or GAI_Memo like '%$like%') "; $query = $this->HT->query($sql, array($pn_invoice)); $result = $query->result(); @@ -353,4 +362,14 @@ class IPayLinks_model extends CI_Model { $query = $this->HT->query($sql, array($deadId)); return $query; } + /** JJH: 添加订单收款记录之后执行 */ + public function exec_addToTask($GAI_SN) + { + $sql = " if not exists ( + select top 1 1 from Sysautotask + where SAT_Type=1 and SAT_SourceSN=$GAI_SN + ) exec SP_AddToSystask 1," . $GAI_SN; + $query = $this->HT->query($sql); + return $query; + } } diff --git a/webht/third_party/pay/views/gai_setting.php b/webht/third_party/pay/views/gai_setting.php index 70be2c9b..06808d0c 100644 --- a/webht/third_party/pay/views/gai_setting.php +++ b/webht/third_party/pay/views/gai_setting.php @@ -3,15 +3,19 @@
已录入订单
订单号 | 申请金额/币种 | 实收金额 | + $value) { ?>||
---|---|---|---|---|
GAI_SQJE; ?> GAI_SQJECurrency; ?> | -GAI_SSJE; ?> CNY | +COLI_ID; ?> | +GAI_SQJE; ?> GAI_SQJECurrency; ?> | +GAI_SSJE; ?> CNY |
撤回以上订单收款记录, 并转移到订单:
+撤回以上订单收款记录, 并转移到订单: (手动录入的不会撤回)