/** *用户ID方式登录 */ public function getQuestionListAction() { //基础元素,必须参与验证 $Config['Time'] = abs(intval($this->request->Time)); $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = trim($this->request->sign); //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Config, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Config['Time'] - time()) <= 600) { $QuestionList = $this->oSecurityAnswer->getAll(); $result = array('return' => 1, 'QuestionList' => $QuestionList); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } if ($Config['ReturnType']) { echo json_encode($result); } else { // $r = $result['return']."|".iconv('UTF-8','GBK',$result['comment']);; // if($result['return']==1) // { // $r = $r."|".$result['LoginId']."|".$result['adult']; // } // echo $r; } }
/** *获取服务器列表登录 */ public function getServerByIpAction() { //基础元素,必须参与验证 $Config['ServerIp'] = $this->request->ServerIp; $Config['Time'] = abs(intval($this->request->Time)); $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = trim($this->request->sign); //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Config, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Config['Time'] - time()) <= 600) { if ($Config['ServerIp']) { $ServerIp = Base_Common::ip2long($Config['ServerIp']); $ServerInfo = $this->oServer->getByIp($ServerIp); if ($ServerInfo['ServerId']) { $result = array('return' => 1, 'ServerInfo' => $ServerInfo, 'comment' => '找到服务器'); } else { $result = array('return' => 2, 'comment' => '你所查询的IP不属于任何服务器'); } } else { $result = array('return' => 0, 'comment' => "请输入服务器IP"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } if ($Config['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['ServerInfo']['ServerId'] . "|" . iconv('UTF-8', 'GBK', $result['ServerInfo']['name']); } echo $r; } }
/** * 获取单个游戏信息 */ public function getAppInfoAction() { //基础元素,必须参与验证 $Config['Time'] = abs(intval($this->request->Time)); $Config['AppId'] = abs(intval($this->request->AppId)); $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = trim($this->request->sign); //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Config, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Config['Time'] - time()) <= 600) { if ($Config['AppId']) { $AppInfo = $this->oApp->getRow($Config['AppId']); if ($AppInfo['AppId']) { $result = array('return' => 1, 'AppInfo' => $AppInfo); } else { $result = array('return' => 0, 'comment' => "无此游戏"); } } else { $result = array('return' => 0, 'comment' => "请指定游戏"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } if ($Config['ReturnType']) { echo json_encode($result); } }
/** *根据用户订单号创建兑换订单 */ public function createExchangeByOrderAction() { //基础元素,必须参与验证 $Order['OrderId'] = $this->request->OrderId; $Order['Time'] = abs(intval($this->request->Time)); $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Order, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { if ($Order['OrderId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($Order['Time'] - time()) <= 600) { $OrderInfo = $this->oOrder->getRow($Order['OrderId']); //查询订单 if ($OrderInfo['OrderId']) { $create = $this->oExchange->createExchangeQueueByOrder($OrderInfo); if ($create) { $result = array('return' => 1, 'ExchangeId' => $create, 'comment' => "创建兑换成功"); } else { $result = array('return' => 2, 'comment' => "创建兑换失败"); } } else { $result = array('return' => 2, 'comment' => "无此订单"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "请输入订单号"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } else { // $r = $result['return']."|".iconv('UTF-8','GBK',$result['comment']); // if($result['return']==1) // { // $r = $r."|".$result['LoginId']."|".$result['adult']; // } // echo $r; } }
/** *获取用户订单信息 */ public function getUserOrderListAction() { //基础元素,必须参与验证 $Order['UserId'] = $this->request->UserId; $Order['AppId'] = abs(intval($this->request->AppId)); $Order['PartnerId'] = abs(intval($this->request->ParnterId)); $Order['ServerId'] = abs(intval($this->request->ServerId)); $Order['StartDate'] = $this->request->StartDate ? $this->request->StartDate : date("Y-m-01", time()); $Order['EndDate'] = $this->request->EndDate ? $this->request->EndDate : date("Y-m-d", time()); $Order['PageSize'] = abs(intval($this->request->PageSize)); $Order['Page'] = abs(intval($this->request->Page)); $Order['Time'] = abs(intval($this->request->Time)); $Order['OrderStatus'] = intval($this->request->OrderStatus); $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Order, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { if ($Order['UserId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($Order['Time'] - time()) <= 600) { $UserInfo = $this->oUser->GetUserById($Order['UserId']); if ($UserInfo['UserId']) { $OrderListInfo = $this->oOrder->getUserOrderList($Order['UserId'], $Order['AppId'], $Order['PartnerId'], $Order['ServerId'], $Order['StartDate'], $Order['EndDate'], $Order['PageSize'], ($Order['Page'] - 1) * $Order['PageSize'], $Order['OrderStatus']); $result = array('return' => 1, 'OrderList' => $OrderListInfo); } else { $result = array('return' => 2, 'comment' => "无此用户"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "请指定用户"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } else { } }
public function checkKa91OrderAction() { //基础元素,必须参与验证 $Order['Time'] = abs(intval($this->request->Time)); $Order['StageOrder'] = $this->request->StageOrder; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Order, $p_sign); //不参与验证的元素 if (in_array($_SERVER["REMOTE_ADDR"], array('61.145.117.183', '61.145.117.184', '219.136.252.38', '121.9.211.6', '58.247.169.182'))) { //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Order['Time'] - time()) <= 600) { $checkStageOrder = $this->oPay->getKa91StageOrder($Order['StageOrder']); if ($checkStageOrder['StageOrder']) { $result = array('return' => 1, 'OrderId' => $checkStageOrder['OrderId'], 'comment' => "订单执行成功"); } else { $result = array('return' => 2, 'comment' => "无此订单"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } } else { $result = array('return' => 0, 'comment' => "您的IP不在可允许的列表之内"); } echo json_encode($result); }
public function createPayAction() { //基础元素,必须参与验证 $Pay['OrderId'] = $this->request->OrderId; $Pay['PassageId'] = abs(intval($this->request->PassageId)); $Pay['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : ""; $Pay['PayTime'] = abs(intval($this->request->PayTime)) ? abs(intval($this->request->PayTime)) : time(); $Pay['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; $Pay['PayIP'] = $this->request->PayIP ? $this->request->PayIP : "127.0.0.1"; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Pay, $p_sign); //不参与验证的元素 $Pay['PayIP'] = Base_Common::ip2long($Pay['PayIP']); //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //检查订单号 if ($Pay['OrderId']) { if (abs($Pay['PayTime'] - time()) <= 600) { //查询订单 $OrderInfo = $this->oOrder->getRow($Pay['OrderId']); //如果订单未作废 if ($OrderInfo['OrderId']) { if ($OrderInfo['OrderStatus'] == 0) { //如果指定支付方 if ($OrderInfo['PayUserId']) { //查询用户 $PayUserInfo = $this->oUser->GetUserById($OrderInfo['PayUserId']); } //如果不指定支付方或者支付方确定存在 if ($PayUserInfo['UserId'] || $Order['PayUserId'] == 0) { //检查收款方用户 $AcceptUserInfo = $this->oUser->GetUserById($OrderInfo['AcceptUserId']); if ($AcceptUserInfo['UserId']) { if ($Pay['PassageId'] != $OrderInfo['PassageId']) { $PassageInfo = $this->oPassage->getRow($Pay['PassageId']); } else { $PassageInfo = $this->oPassage->getRow($OrderInfo['PassageId']); } //获取支付方式信息 if ($PassageInfo['passage_id']) { //检查服务器配置 $ServerInfo = $this->oServer->getRow($OrderInfo['ServerId']); if ($ServerInfo['ServerId']) { if ($ServerInfo['PartnerId'] && $ServerInfo['AppId']) { $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']); //验证游戏-运营商信息 $PartnerAppInfo = $this->oPartnerApp->getRow($bind); if ($PartnerAppInfo['AppId'] && $PartnerAppInfo['PartnerId']) { //验证游戏信息 $AppInfo = $this->oApp->getRow($ServerInfo['AppId']); if ($AppInfo['AppId']) { //检测运营商信息 $PartnerInfo = $this->oPartner->getRow($ServerInfo['PartnerId']); if ($PartnerInfo['PartnerId']) { //如果关联支付订单存在 if ($OrderInfo['PayId']) { $result = array('return' => 0, 'comment' => "该订单已经支付完毕"); } else { $OrderUpdateArr = array('PayIp' => $Pay['PayIP'], 'PassageId' => $Pay['PassageId'], 'PayTime' => $Pay['PayTime']); $OrderUpdate = $this->oOrder->updateOrder($Pay['OrderId'], $OrderInfo['AcceptUserId'], $OrderUpdateArr); $PassageClassName = "Lm_Pay_Passage_" . $PassageInfo['passage']; $oPayPassage = new $PassageClassName(); $PayUrl = $oPayPassage->createPay($AppInfo, $PartnerInfo, $ServerInfo, $PassageInfo, $OrderInfo, $Pay); $result = array('return' => 1, 'PayUrl' => $PayUrl, 'StageUrl' => $PassageInfo['StageUrl'], 'comment' => "该订单可以继续支付"); } } else { $result = array('return' => 0, 'comment' => "所选择的游戏不存在"); } } else { $result = array('return' => 0, 'comment' => "所选择的游戏不存在"); } } else { $result = array('return' => 0, 'comment' => "所选择的游戏-运营商不存在"); } } else { $result = array('return' => 0, 'comment' => "所选择的服务器配置不完整"); } } else { $result = array('return' => 0, 'comment' => "所选择的服务器不存在"); } } else { $result = array('return' => 0, 'comment' => "支付方式不存在"); } } else { $result = array('return' => 0, 'comment' => "收款方用户不存在"); } } else { $result = array('return' => 0, 'comment' => "支付方用户不存在"); } } else { if ($OrderInfo['OrderStatus'] == -1) { $result = array('return' => 0, 'comment' => "该订单已经作废"); } elseif ($OrderInfo['OrderStatus'] > 1) { $result = array('return' => 0, 'comment' => "该订单已经支付完毕"); } } } else { $result = array('return' => 0, 'comment' => "该订单不存在"); } } else { $result = array('return' => 0, 'comment' => "时间错误"); } } else { $result = array('return' => 0, 'comment' => "请输入订单号"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $Pay['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($Pay['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['LoginId'] . "|" . $result['adult']; } } }
/** *获取支付方式列表 */ public function getPassageInfoAction() { //基础元素,必须参与验证 $Config['PassageId'] = abs(intval($this->request->PassageId)) ? abs(intval($this->request->PassageId)) : 0; $Config['Time'] = abs(intval($this->request->Time)); $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = trim($this->request->sign); //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Config, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Config['Time'] - time()) <= 600) { if ($Config['PassageId']) { $PassageInfo = $this->oPassage->getRow($Config['PassageId']); if ($PassageInfo['passage_id']) { $result = array('return' => 1, 'PassageInfo' => $PassageInfo); } else { $result = array('return' => 0, 'comment' => "无此支付方式"); } } else { $result = array('return' => 0, 'comment' => "请指定一个支付方式"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } if ($Config['ReturnType']) { echo json_encode($result); } else { // $r = $result['return']."|".iconv('UTF-8','GBK',$result['comment']);; // if($result['return']==1) // { // $r = $r."|".$result['LoginId']."|".$result['adult']; // } // echo $r; } }