} $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"; $redis->HSet("recharge_order", $orderId, $cache); die('SUCCESS'); } else { $redis->HSet("recharge_order", $orderId, $cache); error_log(FormatLogStr('lenovo', 'callback', ERROR_CENTER, $url)); die('FAILTURE'); } } else { error_log(FormatLogStr('lenovo', 'callback', ERROR_SIGN, $transdata . "&sign={$sign}")); die('FAILTURE'); }
public function processOrder(array $orderParams) { $order = $this->_getOrder($orderParams['app_order_id']); if (!$order) { error_log(FormatLogStr('qihoo', 'callback', ERROR_NEXIST, $orderParams['app_order_id'])); return false; } $config = (include dirname(__FILE__) . "/../../../utils/config.php"); global $centerPath; $url = $config['center'] . $centerPath . '?uin=' . $order["Uin"] . '&orderId=' . $order['OrderId'] . "&shopId=" . $order['ShopId']; $res = $this->notifyCenter($url); if ($res === "success") { $log = GetLogger($config['logger']); $log->writeFile(FormatLogStr('qihoo', 'callback', ERROR_0, $url)); //成功更新订单信息 $order['Status'] = "success"; //更新订单状态为success $order['ExtOrderID'] = $orderParams['order_id']; //保存第三方的订单号 $order['PayTime'] = time(); $this->redis->hSet(self::REDIS_HASH, $orderParams['app_order_id'], $order); return true; } else { error_log(FormatLogStr('qihoo', 'callback', ERROR_CENTER, $url)); return false; } }
<?php $config = (require_once dirname(__FILE__) . "/../utils/config.php"); require dirname(__FILE__) . "/../utils/order.php"; require dirname(__FILE__) . "/../utils/util.php"; //创建订单基本信息 $order = new OrderFactory('_qihoo', $config); if (!$order->ProcessParam($_REQUEST)) { error_log(FormatLogStr('qihoo', 'createorder', ERROR_PARAM, json_decode($_REQUEST))); die('{"error":"参数错误^_^"}'); } if (!$order->CheckUin($_REQUEST['uin'])) { error_log(FormatLogStr('qihoo', 'createorder', ERROR_UIN, 'uin :' . $uin)); die('{"error" : "not found for uin"}'); } $order->SaveOrder(); die('{"orderId": "' . $order->GetOrderId() . '"}');
require_once __DIR__ . '/lib/OpenApiV3.php'; require_once 'config.php'; require dirname(__FILE__) . "/../utils/util.php"; //http://wiki.open.qq.com/wiki/v3/pay/buy_goods // v3/pay/buy_goods // HTTP GET /mpay/buy_goods_m?openid=67E87013295359D1E1C300EE6BC1230F&openkey=7022343841EB434C713E16A008799AC8&pay_token=E1EB7DD2CC7459DD058B83642CECC2C8&appid=1450005915&ts=1453445462&sig=ar66I%2BxFBJ6MMi1gEr9y%2BOvm%2BVg%3D&pf=desktop_m_qq-73213123-android-73213123-qq-1105115982-67E87013295359D1E1C300EE6BC1230F&pfkey=pfkey&zoneid=1&payitem=1*1*1&goodsmeta=1*1&goodsurl=1app_metadata=10000#23 $sdk = new OpenApiV3($appid, $appkey); $sdk->setServerName($server_name); $params = array(); $cookie = array(); // 得到请求方式 $method = $_SERVER['REQUEST_METHOD']; if ($method == "GET") { $params = $_GET; } elseif ($method == "POST") { $params = $_POST; } else { error_log(FormatLogStr('midas', 'createorder', ERROR_PARAM, 'invalidate request method : ' . $method)); return; } if (isset($params['pay_token'])) { $params = array('pfkey' => 'pfkey', 'pay_token' => $params['pay_token'], 'payitem' => $params['payitem'], 'pf' => $params['pf'], 'openid' => $params['openid'], 'openkey' => $params['openkey'], 'ts' => time(), 'goodsmeta' => $params['goodsmeta'], 'goodsurl' => $params['goodsurl'], 'zoneid' => 1, 'app_metadata' => $params['app_metadata']); $cookie = array('session_id' => 'openid', 'session_type' => 'kp_actoken', 'org_loc' => urlencode('/mpay/buy_goods_m')); } else { $params = array('pfkey' => 'pfkey', 'pay_token' => '', 'payitem' => $params['payitem'], 'pf' => $params['pf'], 'openid' => $params['openid'], 'openkey' => $params['openkey'], 'ts' => time(), 'goodsmeta' => $params['goodsmeta'], 'goodsurl' => $params['goodsurl'], 'zoneid' => 1, 'app_metadata' => $params['app_metadata']); $cookie = array('session_id' => 'hy_gameid', 'session_type' => 'wc_actoken', 'org_loc' => urlencode('/mpay/buy_goods_m')); } $params['appmode'] = 1; $ret = $sdk->api('/mpay/buy_goods_m', $params, $cookie, 'get', 'http'); error_log(FormatLogStr('midas', 'createorder', ERROR_0, 'result is : ' . $ret . ' with param ' . json_encode($params))); echo $ret;
<?php error_reporting(E_ALL ^ E_NOTICE); $config = (require dirname(__FILE__) . "/../utils/config.php"); require dirname(__FILE__) . "/../utils/redis.php"; require dirname(__FILE__) . "/../utils/util.php"; //有错误状态码一定要非200!!! $orderId = trim($_REQUEST['exorderno']); if (empty($orderId)) { error_log(FormatLogStr('lenovo', 'query', ERROR_PARAM, "exorderno : {$orderId} param is null")); http_response_code(400); die('{"error":3}'); } else { $redis = new RedisHelper($config); $data = $redis->HGet("recharge_order", $orderId); if ($data) { $dtls = json_decode($data, true); if ($dtls["Status"] === "success") { return; } else { error_log(FormatLogStr('lenovo', 'query', ERROR_STATUS, "exorderno : {$orderId} status is failed")); http_response_code(400); die('{"error":"2"}'); } } else { error_log(FormatLogStr('lenovo', 'query', ERROR_NEXIST, "order : {$orderId} is not exist")); http_response_code(400); die('{"error":1}'); } }
return true; } return false; } $method = $_SERVER['REQUEST_METHOD']; $data = array(); if ($method == "GET") { $data = $_GET; } elseif ($method == "POST") { $data = $_POST; } else { error_log(FormatLogStr('gm', 'magic.php', ERROR_0, 'invalidate request method : ' . $method)); die('false'); } if (empty($data['sign'])) { //没有发现签名数据 error_log(FormatLogStr('gm', 'magic.php', ERROR_0, 'not found sign param with param ' . json_encode($data))); die('false'); } //得到请求中的sign $sign = $data['sign']; //去除sign字段 unset($data['sign']); //得到请求参数 $str = getDataStr($data); if (verify($str, $sign, $pubKey)) { echo https_get($gmaddr . '?' . $str); } else { error_log(FormatLogStr('gm', 'magic.php', ERROR_0, 'verify sign failed with param ' . $str . " with sign : {$sign}")); echo 'false'; }
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(); $cache['Time'] = time(); $cache['Uin'] = intval($shopData[0]); $cache['ShopId'] = intval($shopData[1]); $url = $config['center'] . $centerPath . '?uin=' . $shopData[0] . '&shopId=' . $shopData[1] . '&orderId=' . $cache['ExtOrderId']; $res = https_get($url); if ($res === "success") { $log = GetLogger($config['logger']); $log->writeFile(FormatLogStr('midas', 'callback', ERROR_0, $url . json_encode($param))); $redis->HSet('recharge_order', $cache['ExtOrderId'], $cache); die('{"ret":0,"msg":"OK"}'); } else { $cache['Status'] = 'fail'; $redis->HSet('recharge_order', $cache['ExtOrderId'], $cache); error_log(FormatLogStr('midas', 'callback', ERROR_CENTER, $url . json_encode($param))); die('{"ret":4,"msg":"下发商品失败"}'); } } else { error_log(FormatLogStr('midas', 'callback', ERROR_SIGN, json_encode($param))); die('{"ret":4,"msg":"验证签名失败"}'); }
<?php require dirname(__FILE__) . "/utils/util.php"; $uri = $_REQUEST['param']; error_log(FormatLogStr('61game', 'https proxy', ERROR_0, 'uri :' . $uri)); return "not found proxy https for uri: {$uri}";
<Error> <Code>USS-0540</Code> <Timestamp>2015-12-18T18:07:23+08:00</Timestamp> </Error> success: <IdentityInfo> <AccountID>10064330519</AccountID> <Username>13424208619</Username> <DeviceID>866048029139310</DeviceID> <verified>1</verified> </IdentityInfo> */ $url = $authUrl . 'lpsust=' . $lpsust . '&realm=' . $appid; $res = https_get($url); if (strchr($res, '<Error>')) { error_log(FormatLogStr('lenovo', 'createorder', ERROR_THIRD, 'auth failed ' . str_replace("\n", "", $res))); die('{"error":"3"}'); } //todo 验证是否有权限 $shopid = @$shopMap[$waresid]; if (!$shopid) { error_log(FormatLogStr('lenovo', 'createorder', ERROR_PARAM, 'get shopid faile for waresid ' . $waresid)); die('{"error":"3"}'); } $orderId = GenOrderId('_lenovo'); $data = array('waresid' => $waresid, 'Money' => $money, 'Time' => time(), 'Status' => "fail", 'ShopId' => $shopid, 'OrderId' => $orderId); $redis = new RedisHelper($config); $redis->HSet("recharge_order", $orderId, $data); //保证redis是连接的 error_log(FormatLogStr('lenovo', 'createorder', ERROR_0, $orderId)); die('{"orderId": "' . $orderId . '"}');