示例#1
0
    return strstr($uri, '?', true);
}
// 得到请求方式
$method = $_SERVER['REQUEST_METHOD'];
$url_path = getUrl($_SERVER["REQUEST_URI"]);
$param = array();
if ($method == "GET") {
    $param = $_GET;
} elseif ($method == "POST") {
    $param = $_POST;
} else {
    error_log(FormatLogStr('midas', 'callback', ERROR_PARAM, 'invalidate request method : ' . $method));
    return;
}
$appkey = $appkey . '&';
if (SnsSigCheck::verifySig($method, $url_path, $param, $appkey, $param['sig'])) {
    //获取前台附加参数uin#shopid
    $shopData = explode('*', $param['appmeta']);
    if (count($shopData) < 2) {
        error_log(FormatLogStr('midas', 'callback', ERROR_PARAM, json_encode($param)));
        die('result=FAIL&resultMsg=附加参数个数不正确');
    }
    $redis = new RedisHelper($config);
    if ($redis->CheckOrder('recharge_order', $_REQUEST['billno'])) {
        error_log(FormatLogStr('midas', 'callback', ERROR_EXIST, json_encode($param)));
        die('{"ret":4,"msg": "订单已经存在"}');
    }
    $cache['Money'] = intval($param['amt']);
    $cache['Status'] = 'success';
    $cache['ExtOrderId'] = $param['billno'];
    $cache['PayTime'] = time();
示例#2
0
header("Content-type: text/html; charset=utf-8");
log::init('./log', 'tencent_log');
$uri = $_SERVER['REQUEST_URI'];
$method = strtoupper($_SERVER['REQUEST_METHOD']);
if ("GET" == $method) {
    $params = $_GET;
} else {
    if ("POST" == $method) {
        $body = file_get_contents('php://input');
        $params = $_POST;
    }
}
log::instance()->debug("new con: {$uri} {$body}");
$pf_info = $config["tencent"][stripslashes($params["appid"])];
$api = substr($uri, 0, strcspn($uri, '?'));
if (!SnsSigCheck::verifySig($method, $api, $params, $pf_info["AppKey"] . '&', $params["sig"])) {
    log::instance()->error("ret: 签名无效");
    $obj->ret = 4;
    $obj->msg = "签名无效";
    echo json_encode($obj);
    exit;
}
$just_record = true;
if ($just_record) {
    $ret = "SUCCESS";
} else {
    list($note, $t1, $t2) = split("\\*", stripslashes($params["appmeta"]));
    $note = json_decode(stripslashes($note), true);
    $ret = recharge($pf_info["PF"], stripslashes($params["zoneid"]), $note["odr"], $note["uid"], $note["item"], $params["amt"] / 100 + $params["payamt_coins"] / 10 + $params["pubacct_payamt_coins"] / 10, stripslashes($params["billno"]), 0);
}
log::instance()->debug("ret: " . $ret);
示例#3
0
<?php

require_once __DIR__ . '/lib/SnsSigCheck.php';
require_once __DIR__ . '/lib/SnsSigCheck.php';
require "config.php";
$data = '{"amt":"600","appid":"1450005915","appmeta":"1000040*14*qdqb*qq","billno":"-APPDJSX38525-20160126-1739135208","channel_id":"73213123-android-73213123-qq-1105115982-67E87013295359D1E1C300EE6BC1230F-qq","clientver":"android","ebazinga":"1","openid":"67E87013295359D1E1C300EE6BC1230F","payamt_coins":"0","payitem":"14*60*1","providetype":"5","pubacct_payamt_coins":"","token":"0CCC5F261838D6EFF846A3EA60187C6213669","ts":"1453801153","version":"v3","zoneid":"1","sig":"T5YTSP1DZ6yfs\\/XWBaI+64jWqLo="}';
$arr = json_decode($data, 1);
$sig = $arr['sig'];
SnsSigCheck::verifySig("GET", "/midas/callback.php", $arr, $appkey . '&', $sig);