public function notify()
    {
        include_once LIB_PATH . "ORG/Wpay/WxPayPubHelper.php";
        //存储微信的回调
        $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
        Log::record('wxpay notify get:' . print_r($xml, true));
        Log::save();
        //使用通用通知接口
        $notify = new Notify_pub();
        $notify->saveData($xml);
        $bak_params = $notify->getData();
        try {
            $sql = 'SELECT `pay_config` 
				FROM `' . C('DB_PREFIX') . 'b2c_wxtrade`
				INNER JOIN `' . C('DB_PREFIX') . 'b2c_payment` ON (`' . C('DB_PREFIX') . 'b2c_wxtrade`.`token` = `' . C('DB_PREFIX') . 'b2c_payment`.`token` AND `pay_code` = \'wxpay\' AND `enabled` = 1)
				WHERE `order_sn` = \'' . $bak_params['out_trade_no'] . '\' AND `wecha_id` = \'' . $bak_params['openid'] . '\'';
            $model = new Model();
            $payment = $model->query($sql);
            $wxpay_config = unserialize($payment[0]['pay_config']);
            $notify->setAppkey($wxpay_config['APPKEY']);
        } catch (Exception $e) {
            Log::record('get wxpay configuration params error:' . print_r($e, true));
            Log::save();
            exit;
        }
        //验证签名,并回应微信。
        //对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败,
        //微信会通过一定的策略(如30分钟共8次)定期重新发起通知,
        //尽可能提高通知的成功率,但微信不保证通知最终能成功。
        if ($notify->checkSign() == FALSE) {
            $notify->setReturnParameter("return_code", "FAIL");
            //返回状态码
            $notify->setReturnParameter("return_msg", "签名失败");
            //返回信息
        } else {
            $notify->setReturnParameter("return_code", "SUCCESS");
            //设置返回码
        }
        $returnXml = $notify->returnXml();
        Log::record('wxpay notify get:' . print_r($returnXml, true));
        Log::save();
        //==商户根据实际情况设置相应的处理流程,此处仅作举例=======
        if ($notify->checkSign() == TRUE) {
            if ($notify->data["return_code"] == "FAIL") {
                //此处应该更新一下订单状态,商户自行增删操作
                Log::record('【通信出错】:\\n' . $xml . '\\n');
                Log::save();
                echo 'fail';
                exit;
            } elseif ($notify->data["result_code"] == "FAIL") {
                //此处应该更新一下订单状态,商户自行增删操作
                Log::record('【通信出错】:\\n' . $xml . '\\n');
                Log::save();
                echo 'fail';
                exit;
            } else {
                $this->change_order($bak_params);
                Log::record('【支付成功】:\\n' . $xml . '\\n');
                Log::save();
            }
        }
    }