Exemple #1
0
<?php

/**
 *  支付回调
 */
define('PIGCMS_PATH', dirname(__FILE__) . '/../');
require_once PIGCMS_PATH . 'source/init.php';
require_once 'functions.php';
if (strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
    $now = time();
    $timestamp = $_GET['request_time'];
    $sign_key = $_GET['sign_key'];
    unset($_GET['request_time']);
    unset($_GET['sign_key']);
    $_GET['salt'] = SIGN_SALT;
    if (!_checkSign($sign_key, $_GET)) {
        $error_code = 1004;
        $error_msg = '签名无效';
        $return_url = '';
    } else {
        $order_no = $_GET['order_no'];
        $error_code = $_GET['status'];
        $error_msg = $_GET['msg'];
        if (empty($error_code) || $error_code == 2) {
            $database_order = D('Order');
            $product_model = M('Product');
            $product_sku = M('Product_sku');
            $nowOrder = M('Order')->findSimple(trim($_GET['order_no']));
            $condition_order['order_no'] = $nowOrder['order_no'];
            if ($nowOrder && $nowOrder['status'] == 1) {
                $data_order['third_id'] = $_GET['third_id'];
Exemple #2
0
<?php

/**
 *  支付异步通知
 */
define('PIGCMS_PATH', dirname(__FILE__) . '/../');
require_once PIGCMS_PATH . 'source/init.php';
require_once 'functions.php';
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
    $now = time();
    $timestamp = $_POST['request_time'];
    $sign_key = $_POST['sign_key'];
    unset($_POST['request_time']);
    unset($_POST['sign_key']);
    $_POST['salt'] = SIGN_SALT;
    if (!_checkSign($sign_key, $_POST)) {
        $error_code = 1004;
        $error_msg = '签名无效';
        $return_url = '';
    } else {
        if (!empty($_POST['order_no'])) {
            $order_no = trim($_POST['order_no']);
            $database_order = D('Order');
            $product_model = M('Product');
            $product_sku = M('Product_sku');
            $nowOrder = M('Order')->findSimple($order_no);
            $condition_order['order_no'] = $nowOrder['order_no'];
            if ($nowOrder && $nowOrder['status'] == 1) {
                $pay_money = !empty($_POST['pay_money']) ? $_POST['pay_money'] : $nowOrder['total'];
                $data_order['third_id'] = $_POST['third_id'];
                $data_order['payment_method'] = !empty($_POST['payment_method']) ? $_POST['payment_method'] : $nowOrder['payment_method'];