支付分成两部分
1.订单信息
2.支付日志ID
3.生成支付代码
一次性支付完成
// 支付信息 include_once('includes/lib_payment.php'); $order['log_id'] = insert_pay_log($order['order_id'], $order['order_amount'], PAY_ORDER); /* 取得支付信息,生成支付代码 */ if ($order['order_amount'] > 0) { $payment = payment_info($order['pay_id']); include_once('includes/modules/payment/' . $payment['pay_code'] . '.php'); $pay_obj = new $payment['pay_code']; $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config'])); $order['pay_desc'] = $payment['pay_desc']; $smarty->assign('pay_online', $pay_online); }
隔断时间支付
// 支付信息 include_once('includes/lib_payment.php'); //print_r($order['order_sn']); $log = $db->getRow("select p.log_id from ".$ecs->table('depot_order')." AS o,".$ecs->table('pay_log')." AS p where o.order_id = p.order_id and o.order_sn = ".$order['order_sn']); $order['log_id'] = $log['log_id']; /* 取得支付信息,生成支付代码 */ if ($order['pay_status'] == 0) { $payment = payment_info($order['pay_id']); //print_r($payment); include_once('includes/modules/payment/' . $payment['pay_code'] . '.php'); $pay_obj = new $payment['pay_code']; $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config'])); // print_r($order); $smarty->assign('pay_online', $pay_online); } // 支付信息 End
两种支付的区别在$order['log_id'] 的生成方式,第一种是生成支付日志,然后返回生成的ID;第二种是根据订单order_sn读出order_id,关联log_id,
关键位置
1.生成支付代码function get_code (alipay.php第132行)
'out_trade_no' => $order['order_sn'] . $order['log_id'], 订单ID+支付日志ID
$button ,生成的支付按钮信息
2.响应操作function respond( alipay.php第168行)
$order_sn = str_replace($_GET['subject'], '', $_GET['out_trade_no']); // 根据两条件获取,获取支付日志ID