/** * 组装包含支付信息的url(模式1) */ public function get_payurls() { require_once BASE_PATH . '/api/payment/wxpay/lib/WxPay.Api.php'; require_once BASE_PATH . '/api/payment/wxpay/WxPay.NativePay.php'; require_once BASE_PATH . '/api/payment/wxpay/log.php'; $logHandler = new CLogFileHandler(BASE_DATA_PATH . '/log/wxpay/' . date('Y-m-d') . '.log'); $logwx = logwx::Init($logHandler, 15); $notify = new NativePay(); return $notify->GetPrePayUrl($this->_order_info['pay_sn']); }
<?php // ini_set('date.timezone','Asia/Shanghai'); // error_reporting(E_ERROR); /** * 接收微信请求,接收productid和用户的openid等参数,执行(【统一下单API】返回prepay_id交易会话标识 */ defined('InShopNC') or exit('Access Invalid!'); require_once BASE_PATH . '/api/payment/wxpay/lib/WxPay.Api.php'; require_once BASE_PATH . '/api/payment/wxpay/lib/WxPay.Notify.php'; require_once BASE_PATH . '/api/payment/wxpay/log.php'; //初始化日志 $logHandler = new CLogFileHandler(BASE_DATA_PATH . '/log/wxpay/' . date('Y-m-d') . '.log'); $logwx = logwx::Init($logHandler, 15); class NativeNotifyCallBack extends WxPayNotify { public function unifiedorder($openId, $product_id) { //得到支付金额 $order_pay_info = Model('order')->getOrderPayInfo(array('pay_sn' => $product_id)); if (empty($order_pay_info)) { $condition = array(); $condition['order_sn'] = $product_id; $condition['order_state'] = ORDER_STATE_NEW; $order_info = Model('vr_order')->getOrderInfo($condition, 'sum(order_amount-rcb_amount-pd_amount) as order_amount'); $attach = 'v'; } else { $condition = array(); $condition['pay_sn'] = $product_id; $condition['order_state'] = ORDER_STATE_NEW; $order_info = Model('order')->getOrderInfo($condition, array(), 'sum(order_amount-rcb_amount-pd_amount) as order_amount');