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":"验证签名失败"}'); }
} $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'); }
<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 . '"}');