Exemplo n.º 1
0
 * 这里举例使用log文件形式记录回调信息。
*/
require '../system/system_init.php';
include_once "./log_.php";
include_once "../system/payment/Wxjspay/WxPayPubHelper.php";
$log_ = new Log_();
$log_name = "./notify_url.log";
//log文件路径
$order_id = intval($_REQUEST['order_id']);
$payment_notice_sn = trim($_REQUEST['out_trade_no']);
//获取配置信息
$payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where class_name='Wwxjspay'");
$payment_info['config'] = unserialize($payment_info['config']);
$wx_config = $payment_info['config'];
$notify = new Notify_pub();
$notify->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']);
if (empty($order_id) && empty($payment_notice_sn)) {
    //进入V3
    //存储微信的回调
    $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
    $notify->saveData($xml);
    if ($notify->checkSign() == FALSE) {
        $notify->setReturnParameter("return_code", "FAIL");
        //返回状态码
        $notify->setReturnParameter("return_msg", "签名失败");
        //返回信息
        //$log_->log_result($log_name,"【签名失败】:\n".$xml."\n");
    } else {
        $notify->setReturnParameter("return_code", "SUCCESS");
        //设置返回码
        //$log_->log_result($log_name,"【支付成功】:\n".$xml."\n");