コード例 #1
0
ファイル: callback.php プロジェクト: tofindme/work_note
if (empty($transdata) || empty($sign)) {
    error_log(FormatLogStr('lenovo', 'callback', ERROR_PARAM, 'sign,transdata param is NULL '));
    die('FAILTURE');
}
$result = verify($transdata, $appKey, $sign);
if ($result) {
    $param = json_decode($transdata, true);
    $shopid = @$shopMap[$param['waresid']];
    if (!$shopid) {
        error_log(FormatLogStr('lenovo', 'callback', ERROR_PARAM, 'get shopid faile for waresid ' . $param['waresid']));
        die('FAILTURE');
    }
    $orderId = $param["exorderno"];
    //updat redis
    $redis = new RedisHelper($config);
    $data = $redis->HGet("recharge_order", $orderId);
    if ($data === false) {
        error_log(FormatLogStr('lenovo', 'callback', ERROR_NEXIST, "order : {$orderId} is not exist"));
        die('FAILTURE');
    }
    $cache = json_decode($data, true);
    $cache["ExtOrderId"] = $param["transid"];
    $cache['PayTime'] = strtotime($param["transtime"]);
    $cache['Uin'] = intval($param["cpprivate"]);
    $url = $config['center'] . $centerPath . '?uin=' . $param["cpprivate"] . '&orderId=' . $orderId . "&shopId=" . $shopid;
    $res = https_get($url);
    if ($res === 'callback success') {
        error_log(FormatLogStr('lenovo', 'callback', ERROR_0, $transdata . "&sign={$sign}"));
        $log = GetLogger($config['logger']);
        $log->writeFile(FormatLogStr('lenovo', 'callback', ERROR_0, $url . ' ExtOrderId : ' . $cache['ExtOrderId']));
        $cache["Status"] = "success";