Alipay增加APP组的录入;传统订单收款记录支持更新实收金额

feature/pay
lyt 6 years ago
parent 2665fcbdb9
commit 434dccc50c

@ -417,11 +417,24 @@ class AlipayTradeService extends CI_Controller
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') {
//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
// $this->Alipay_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->ALI_dealId, $ht_memo);
// if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态并且订单进度是我的订单
// $this->Alipay_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
// $this->Alipay_model->insert_biz_order_log($GAI_COLI_SN, 'BS8');
// }
$this->Alipay_model->add_account_info_forAPP(
$GAI_COLI_SN,
$advisor_info->COLI_ID,
$item->ALI_orderAmount,
$item->ALI_completeTime,
$currencyCode,
$ssje,
$item->ALI_completeTime,
$item->ALI_completeTime,
$item->ALI_completeTime,
$item->ALI_payerName,
$item->ALI_payerEmail,
$item->ALI_dealId,
$ht_memo);
if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态并且订单进度是我的订单
$this->Alipay_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
$this->Alipay_model->insert_biz_order_log($GAI_COLI_SN, 'BS8');
}
} else {
// 把订单状态设置为13-新订单已支付
if (false == $this->Alipay_model->if_biz_gai_exists($item->ALI_dealId) ) {
@ -484,19 +497,21 @@ class AlipayTradeService extends CI_Controller
//添加邮件发送记录
//给外联发送通知邮件
$fromName = 'Alipay';
$fromEmail = '';
$toName = !empty($opi_firstname) ? $opi_firstname : '';
$toEmail = !empty($opi_email) ? $opi_email : '';
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->ALI_orderAmount . $item->ALI_currencyCode . ' / ' . $fromName;
$body = $this->load->view('alipay_receipt_mail', $item, true);
$M_RelatedInfo = $item->ALI_sn;
$M_AddTime = $item->ALI_completeTime;
$M_State = 0;
$this->Alipay_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'Alipay note');
//添加邮件发送记录 end
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
if ($item->ALI_sent !== 'send') {
$fromName = 'Alipay';
$fromEmail = '';
$toName = !empty($opi_firstname) ? $opi_firstname : '';
$toEmail = !empty($opi_email) ? $opi_email : '';
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->ALI_orderAmount . $item->ALI_currencyCode . ' / ' . $fromName;
$body = $this->load->view('alipay_receipt_mail', $item, true);
$M_RelatedInfo = $item->ALI_sn;
$M_AddTime = $item->ALI_completeTime;
$M_State = 0;
$this->Alipay_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'Alipay note');
//添加邮件发送记录 end
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
}
$int++;
}
// 批量结果

@ -149,7 +149,7 @@ class Alipay_model extends CI_Model {
}
//添加收款记录(商务订单),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(
@ -164,6 +164,7 @@ class Alipay_model extends CI_Model {
,GAI_SQJE
,GAI_SQDate
,GAI_SQJECurrency
,GAI_SSJE
,GAI_SSDate
,GAI_AccountDate
,GAI_SubmitDate
@ -173,8 +174,8 @@ class Alipay_model extends CI_Model {
,GAI_Memo
,GAI_State
,DeleteFlag
) VALUES (?,?,15015,?,?,?,?,?,?,?,?,?,?,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 (?,?,15015,?,?,?,?,?,?,?,?,?,?,?,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_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('BIZ_GroupAccountInfo');
return $query;
}
@ -239,7 +240,9 @@ class Alipay_model extends CI_Model {
,GAI_Memo
,GAI_State
,DeleteFlag
) VALUES (?,15015,?,?,?,?,?,?,?,?,?,?,?,0,0)";
) VALUES (?,15015,?,?,?,?,?,?,?,?,?,?,?,0,0)
ELSE
UPDATE GroupAccountInfo SET GAI_SSJE='$GAI_SSJE' WHERE GAI_AccreditNo='$GAI_AccreditNo' ";
$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 $insertid;

Loading…
Cancel
Save