| | |
| | | <?php |
| | | |
| | | #创建日期:2012-5-15 下午4:26:32 |
| | | #作者:zhouliang |
| | | include_once '/Common/Logging.php'; |
| | | include_once '/ProjComm/CommonOperate.php'; |
| | | include_once '/Common/CommFunc.php'; |
| | | include_once '/Common/Socket.php'; |
| | | include_once '/Common/BufferOperate.php'; |
| | | include_once 'AuthorityInfo.php'; |
| | | include_once '/Common/MongoCommon.php'; |
| | | |
| | | #打包GM命令数据 |
| | | function PackGMCommand( $strGuid, $type, $CmdLen, $Cmd, $UserDataLen, $UserData ) |
| | | { |
| | | return pack( 'C1', $type ).pack( 'C1', strlen($strGuid) ).$strGuid.pack( 'V1', $CmdLen ).$Cmd.pack( 'V1', $UserDataLen ).$UserData; |
| | | } |
| | | |
| | | #解包GM命令数据 |
| | | function UnPackGMCommand( $buffer, &$type, &$ResultLen, &$Result, &$UserDataLen, &$UserData, &$strGUID ) |
| | | { |
| | | \Logging\LogDebug( "接收的buffer内容为:".$buffer ); |
| | | $nPos=0; |
| | | |
| | | $type=\BufferOperate\ReadBYTE( $buffer, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' type='.$type ); |
| | | |
| | | $nGUIDLen=\BufferOperate\ReadBYTE( $buffer, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' $nGUIDLen='.$nGUIDLen ); |
| | | |
| | | $strGUID=\BufferOperate\ReadString( $buffer , $nGUIDLen, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' $strGUID='.$strGUID ); |
| | | |
| | | $ResultLen=\BufferOperate\ReadDWORD( $buffer, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' $ResultLen='.$ResultLen ); |
| | | |
| | | $Result=\BufferOperate\ReadString( $buffer , $ResultLen, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' $Result='.$Result ); |
| | | |
| | | $UserDataLen=\BufferOperate\ReadDWORD( $buffer, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' $UserDataLen='.$UserDataLen ); |
| | | |
| | | $UserData=\BufferOperate\ReadString( $buffer , $UserDataLen, $nPos ); |
| | | \Logging\LogDebug( 'pos='.$nPos.' $UserData='.$UserData ); |
| | | |
| | | } |
| | | |
| | | #从配置载入验证数据 |
| | | function LoadAuthorityData() |
| | | { |
| | | if( !\CommFunc\GetKeyFromConfig( 'config.ini', 'Popedom', 'Popedom_count', $strPopedomCount, 'Read Popedom_count error!' ) ) |
| | | { |
| | | exit(); |
| | | } |
| | | |
| | | $nCount=intval( $strPopedomCount ); |
| | | |
| | | $info=new AuthorityInfo(); |
| | | |
| | | for ( $nIndex=1; $nIndex<=$nCount; $nIndex++) |
| | | { |
| | | $strSection='Popedom_'.$nIndex; |
| | | |
| | | \CommFunc\GetKeyFromConfig( 'config.ini', $strSection, 'key', $strKey, "Read $strSection key error!" ); |
| | | \CommFunc\GetKeyFromConfig( 'config.ini', $strSection, 'pack_types', $strPackTypes, "Read $strSection pack_types error!" ); |
| | | $info->AddInfo( $strKey, $strPackTypes ); |
| | | } |
| | | |
| | | return $info; |
| | | } |
| | | |
| | | function SendToDBServer($strOrderID) |
| | | { |
| | | $strDataServerIP=''; |
| | | if( !\CommFunc\GetKeyFromConfig( 'config.ini', 'Server', 'DataServerIP', $strDataServerIP, |
| | | '{"ErrorNo":"5","ErrorStr":"Read dataserver ip error"}' ) ) |
| | | { |
| | | exit(); |
| | | } |
| | | |
| | | $strDataServerPort=''; |
| | | if( !\CommFunc\GetKeyFromConfig( 'config.ini', 'Server', 'DataServerPort', $strDataServerPort, |
| | | '{"ErrorNo":"6","ErrorStr":"Read dataserver port error"}' ) ) |
| | | { |
| | | exit(); |
| | | } |
| | | |
| | | //与DataServer进行交互,获得DataServer的返回值 |
| | | |
| | | $sock=new \Socket\Socket(); |
| | | |
| | | if( !$sock->Init() ) |
| | | { |
| | | echo '{"ErrorNo":"7","ErrorStr":"Socket init error"}'; |
| | | exit(); |
| | | } |
| | | |
| | | if( !$sock->Connect( $strDataServerIP, $strDataServerPort ) ) |
| | | { |
| | | echo '{"ErrorNo":"8","ErrorStr":"Connect data server error"}'; |
| | | exit(); |
| | | } |
| | | |
| | | $bufferSend=''; |
| | | |
| | | |
| | | $bufferGmCmd=PackGMCommand( $strOrderID, 113, strlen($_POST['pack']), $_POST['pack'], 0, '' ); |
| | | |
| | | \Logging\LogDebug( \CommFunc\BinToStr($bufferGmCmd) ); |
| | | #三个类型数字是由服务端给出的,需要变动也会由服务端给出改法, |
| | | #意义大概是包类型是内部通讯封包,源是GM工具,目标是DATASERVER |
| | | $bufferSend=\CommonOperate\PackData( $bufferGmCmd, 2, 1, 11 ); |
| | | |
| | | |
| | | if( !$sock->Write( $bufferSend ) ) |
| | | { |
| | | echo '{"ErrorNo":"9","ErrorStr":"Send data to data server error"}'; |
| | | exit(); |
| | | } |
| | | |
| | | \Logging\LogInfo( '开始接收数据' ); |
| | | |
| | | $nSingleRecvMaxLen=1000; |
| | | |
| | | $strRecv=''; |
| | | |
| | | #开始循环接收 |
| | | |
| | | $type=0; |
| | | $ResultLen=0; |
| | | $Result=''; |
| | | $UserDataLen=0; |
| | | $UserData=''; |
| | | while(TRUE) |
| | | { |
| | | //接收数据,进行判断成功与否,然后进行解析 |
| | | \Logging\LogDebug( "socket开始接收数据" ); |
| | | if( !$sock->Read( $strRead ) ) |
| | | { |
| | | echo '{"ErrorNo":"10","ErrorStr":"Recv data error"}'; |
| | | exit(); |
| | | } |
| | | \Logging\LogDebug( "socket接收数据完毕" ); |
| | | $strRecv=$strRecv.$strRead; |
| | | |
| | | $customBodyBuffer=''; |
| | | if( \CommonOperate\UnPackData($strRecv, $customBodyBuffer) ) |
| | | { |
| | | #判断是不是GM工具的包类型114 |
| | | if( \CommonOperate\GetPackType($customBodyBuffer)==114 ) |
| | | { |
| | | $strRecvOrderID=''; |
| | | UnPackGMCommand( $customBodyBuffer, $type, $ResultLen, $Result, $UserDataLen, $UserData, $strRecvOrderID ); |
| | | if( $strRecvOrderID==$strOrderID ) |
| | | { |
| | | //解析成功,则不再进行接收,并且接收的数据是给自己的 |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | \Logging\LogError( "接收的数据不是自己的!原strOderID是:$strOrderID,新的是:$strRecvOrderID" ); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | \Logging\LogInfo( '数据获得并解析完毕' ); |
| | | |
| | | //返回结果给请求者 |
| | | echo $Result.$UserData; |
| | | } |
| | | |
| | | |
| | | \Logging\CreateLogging( 'GMTool' ); |
| | | |
| | | $strOrderID=\CommFunc\guid(); |
| | | \Logging\LogAddObj(\Logging\strPhpDir, 'GMTool', "GUID:$strOrderID"); |
| | | |
| | | \Logging\LogInfo( '开始处理...' ); |
| | | |
| | | |
| | | if( !\CommFunc\CheckPostParam("pack", '{"ErrorNo":"1","ErrorStr":"Param pack error"}') ) |
| | | { |
| | | exit(); |
| | | } |
| | | |
| | | if( !\CommFunc\CheckPostParam("sign", '{"ErrorNo":"2","ErrorStr":"Param sign error"}') ) |
| | | { |
| | | exit(); |
| | | } |
| | | |
| | | //验证信息是否是可允许的 |
| | | $authorityInfo=LoadAuthorityData(); |
| | | |
| | | |
| | | $arrayPack = json_decode( $_POST['pack'] , true ); |
| | | |
| | | \Logging\LogInfo( "json_decode的结果是".var_export( $arrayPack, True ) ); |
| | | |
| | | $arrayPack['pack_type']=iconv( 'utf-8' , 'gbk', $arrayPack['pack_type'] ); |
| | | |
| | | |
| | | |
| | | if( !array_key_exists( 'pack_type', $arrayPack ) ) |
| | | { |
| | | echo '{"ErrorNo":"3","ErrorStr":"Can\'t find pack_type in jsondata"}'; |
| | | $strPackRecv=$_POST['pack']; |
| | | \Logging\LogError( "收到的信息错误,收到的数据是:$strPackRecv" ); |
| | | exit(); |
| | | } |
| | | |
| | | $strKey=$authorityInfo->GetKeyFromValue( $arrayPack['pack_type'] ); |
| | | |
| | | if( md5( $_POST['pack'].$strKey )!=$_POST['sign'] ) |
| | | { |
| | | \CommFunc\LogErrorAndPrint( '{"ErrorNo":"4","ErrorStr":"Sign error, end"}' ); |
| | | exit(); |
| | | } |
| | | |
| | | $DBArray = array("GMTServer_Account", "GMTServer_Name"); |
| | | if (in_array($arrayPack['pack_type'], $DBArray)) |
| | | { |
| | | //可以直接处理 |
| | | #开始连接数据库 |
| | | $dbOpt=new \MongoCommon\MongoDBOpt( '..\\InterfaceConfig.php', "ServerName" ); |
| | | |
| | | if( !$dbOpt->Init() ) |
| | | { |
| | | #echo '数据库初始化失败!原因:'.$dbOpt->GetLastError().'请检查配置'; |
| | | $resultjson['status'] = -2; |
| | | echo json_encode($resultjson); |
| | | exit; |
| | | } |
| | | |
| | | \Logging\LogInfo( 'gmtool连接数据库成功.' ); |
| | | |
| | | $skip=0; |
| | | $perPage=20; |
| | | #查找账号是否有账户可以使用 |
| | | if($arrayPack['pack_type'] == "GMTServer_Account") |
| | | { |
| | | |
| | | if($arrayPack["accID"] == "") |
| | | { |
| | | $findArray = array(); |
| | | } |
| | | else |
| | | { |
| | | $findArray=array('AccID'=>new MongoRegex($arrayPack["accID"].".*/i")); |
| | | } |
| | | $dbName = "tagDBPlayer"; |
| | | } |
| | | else if ($arrayPack['pack_type'] == "GMTServer_Name") |
| | | { |
| | | if($arrayPack["name"] == "") |
| | | { |
| | | $findArray = array(); |
| | | } |
| | | else |
| | | { |
| | | $findArray=array('PlayerName'=>new MongoRegex("/.*".$arrayPack["name"].".*/i")); |
| | | } |
| | | $dbName = "tagDBPlayer"; |
| | | } |
| | | |
| | | if(isset($arrayPack["skip"])) |
| | | { |
| | | $skip=$arrayPack["skip"]; |
| | | } |
| | | |
| | | if(isset($arrayPack["perPage"])) |
| | | { |
| | | $perPage=$arrayPack["perPage"]; |
| | | } |
| | | |
| | | //新增排序 |
| | | $sortinfo = array(); |
| | | if(isset($arrayPack["sort"])) |
| | | { |
| | | $sortinfo = json_decode($arrayPack["sort"], true); |
| | | } |
| | | |
| | | //查询玩家表 |
| | | $retArray; |
| | | $retColumn=json_decode($arrayPack["fields"]); |
| | | |
| | | $result = $dbOpt->GetData($dbName, $findArray, $retArray, $retColumn, $skip, $perPage, $sortinfo); |
| | | |
| | | //{"ResultType": 0, "ResultMsg": {"forbidTalk": false, "forbidLogin": false}, "pack_type": "GMT_GetPlayerForbid"} |
| | | if($result) |
| | | { |
| | | echo json_encode(array("ResultType"=>0, "ResultMsg"=>$retArray, "pack_type"=>$arrayPack['pack_type'])); |
| | | //\Logging\LogInfo( '数据库直接查询结果'.print_r($retArray, true) ); |
| | | } |
| | | else |
| | | { |
| | | echo json_encode(array("ResultType"=>102)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //发送给游戏服务器DB |
| | | SendToDBServer($strOrderID); |
| | | } |
| | | |
| | | |
| | | \Logging\LogInfo( '结束处理..' ); |
| | | <?php
|
| | |
|
| | | #创建日期:2012-5-15 下午4:26:32
|
| | | #作者:zhouliang
|
| | | include_once '/Common/Logging.php';
|
| | | include_once '/ProjComm/CommonOperate.php';
|
| | | include_once '/Common/CommFunc.php';
|
| | | include_once '/Common/Socket.php';
|
| | | include_once '/Common/BufferOperate.php';
|
| | | include_once 'AuthorityInfo.php';
|
| | | include_once '/Common/MongoCommon.php';
|
| | |
|
| | | #打包GM命令数据
|
| | | function PackGMCommand( $strGuid, $type, $serverID, $CmdLen, $Cmd, $UserDataLen, $UserData )
|
| | | {
|
| | | return pack( 'C1', $type ).pack( 'V1', $serverID ).pack( 'C1', strlen($strGuid) ).$strGuid.pack( 'V1', $CmdLen ).$Cmd.pack( 'V1', $UserDataLen ).$UserData;
|
| | | }
|
| | |
|
| | | #解包GM命令数据
|
| | | function UnPackGMCommand( $buffer, &$type, &$ResultLen, &$Result, &$UserDataLen, &$UserData, &$strGUID )
|
| | | {
|
| | | \Logging\LogDebug( "接收的buffer内容为:".$buffer );
|
| | | $nPos=0;
|
| | | |
| | | $type=\BufferOperate\ReadBYTE( $buffer, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' type='.$type );
|
| | | |
| | | $nGUIDLen=\BufferOperate\ReadBYTE( $buffer, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' $nGUIDLen='.$nGUIDLen );
|
| | | |
| | | $strGUID=\BufferOperate\ReadString( $buffer , $nGUIDLen, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' $strGUID='.$strGUID );
|
| | | |
| | | $ResultLen=\BufferOperate\ReadDWORD( $buffer, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' $ResultLen='.$ResultLen );
|
| | | |
| | | $Result=\BufferOperate\ReadString( $buffer , $ResultLen, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' $Result='.$Result );
|
| | | |
| | | $UserDataLen=\BufferOperate\ReadDWORD( $buffer, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' $UserDataLen='.$UserDataLen );
|
| | | |
| | | $UserData=\BufferOperate\ReadString( $buffer , $UserDataLen, $nPos );
|
| | | \Logging\LogDebug( 'pos='.$nPos.' $UserData='.$UserData );
|
| | | |
| | | }
|
| | |
|
| | | #从配置载入验证数据
|
| | | function LoadAuthorityData()
|
| | | {
|
| | | if( !\CommFunc\GetKeyFromConfig( 'config.ini', 'Popedom', 'Popedom_count', $strPopedomCount, 'Read Popedom_count error!' ) )
|
| | | {
|
| | | exit();
|
| | | }
|
| | | |
| | | $nCount=intval( $strPopedomCount );
|
| | | |
| | | $info=new AuthorityInfo();
|
| | | |
| | | for ( $nIndex=1; $nIndex<=$nCount; $nIndex++)
|
| | | {
|
| | | $strSection='Popedom_'.$nIndex;
|
| | | |
| | | \CommFunc\GetKeyFromConfig( 'config.ini', $strSection, 'key', $strKey, "Read $strSection key error!" );
|
| | | \CommFunc\GetKeyFromConfig( 'config.ini', $strSection, 'pack_types', $strPackTypes, "Read $strSection pack_types error!" );
|
| | | $info->AddInfo( $strKey, $strPackTypes );
|
| | | }
|
| | | |
| | | return $info;
|
| | | }
|
| | |
|
| | | function SendToDBServer($strOrderID)
|
| | | {
|
| | | $strDataServerIP='';
|
| | | if( !\CommFunc\GetKeyFromConfig( 'config.ini', 'Server', 'DataServerIP', $strDataServerIP,
|
| | | '{"ErrorNo":"5","ErrorStr":"Read dataserver ip error"}' ) )
|
| | | {
|
| | | exit();
|
| | | }
|
| | |
|
| | | $strDataServerPort='';
|
| | | if( !\CommFunc\GetKeyFromConfig( 'config.ini', 'Server', 'DataServerPort', $strDataServerPort,
|
| | | '{"ErrorNo":"6","ErrorStr":"Read dataserver port error"}' ) )
|
| | | {
|
| | | exit();
|
| | | }
|
| | |
|
| | | //与DataServer进行交互,获得DataServer的返回值
|
| | |
|
| | | $sock=new \Socket\Socket();
|
| | |
|
| | | if( !$sock->Init() )
|
| | | {
|
| | | echo '{"ErrorNo":"7","ErrorStr":"Socket init error"}';
|
| | | exit();
|
| | | }
|
| | |
|
| | | if( !$sock->Connect( $strDataServerIP, $strDataServerPort ) )
|
| | | {
|
| | | echo '{"ErrorNo":"8","ErrorStr":"Connect data server error"}';
|
| | | exit();
|
| | | }
|
| | |
|
| | | $bufferSend='';
|
| | |
|
| | |
|
| | | $bufferGmCmd=PackGMCommand( $strOrderID, 113, 9006, strlen($_POST['pack']), $_POST['pack'], 0, '' );
|
| | |
|
| | | \Logging\LogDebug( \CommFunc\BinToStr($bufferGmCmd) );
|
| | | #三个类型数字是由服务端给出的,需要变动也会由服务端给出改法,
|
| | | #意义大概是包类型是内部通讯封包,源是GM工具,目标是DATASERVER
|
| | | $bufferSend=\CommonOperate\PackData( $bufferGmCmd, 2, 1, 11 );
|
| | |
|
| | |
|
| | | if( !$sock->Write( $bufferSend ) )
|
| | | {
|
| | | echo '{"ErrorNo":"9","ErrorStr":"Send data to data server error"}';
|
| | | exit();
|
| | | }
|
| | |
|
| | | \Logging\LogInfo( '开始接收数据' );
|
| | |
|
| | | $nSingleRecvMaxLen=1000;
|
| | |
|
| | | $strRecv='';
|
| | |
|
| | | #开始循环接收
|
| | |
|
| | | $type=0;
|
| | | $ResultLen=0;
|
| | | $Result='';
|
| | | $UserDataLen=0;
|
| | | $UserData='';
|
| | | while(TRUE)
|
| | | {
|
| | | //接收数据,进行判断成功与否,然后进行解析
|
| | | \Logging\LogDebug( "socket开始接收数据" );
|
| | | if( !$sock->Read( $strRead ) )
|
| | | {
|
| | | echo '{"ErrorNo":"10","ErrorStr":"Recv data error"}';
|
| | | exit();
|
| | | }
|
| | | \Logging\LogDebug( "socket接收数据完毕" );
|
| | | $strRecv=$strRecv.$strRead;
|
| | | |
| | | $customBodyBuffer='';
|
| | | if( \CommonOperate\UnPackData($strRecv, $customBodyBuffer) )
|
| | | {
|
| | | #判断是不是GM工具的包类型114
|
| | | if( \CommonOperate\GetPackType($customBodyBuffer)==114 )
|
| | | {
|
| | | $strRecvOrderID='';
|
| | | UnPackGMCommand( $customBodyBuffer, $type, $ResultLen, $Result, $UserDataLen, $UserData, $strRecvOrderID );
|
| | | if( $strRecvOrderID==$strOrderID )
|
| | | {
|
| | | //解析成功,则不再进行接收,并且接收的数据是给自己的
|
| | | break;
|
| | | }
|
| | | else
|
| | | {
|
| | | \Logging\LogError( "接收的数据不是自己的!原strOderID是:$strOrderID,新的是:$strRecvOrderID" );
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | \Logging\LogInfo( '数据获得并解析完毕' );
|
| | |
|
| | | //返回结果给请求者
|
| | | echo $Result.$UserData;
|
| | | }
|
| | |
|
| | |
|
| | | \Logging\CreateLogging( 'GMTool' );
|
| | |
|
| | | $strOrderID=\CommFunc\guid();
|
| | | \Logging\LogAddObj(\Logging\strPhpDir, 'GMTool', "GUID:$strOrderID");
|
| | |
|
| | | \Logging\LogInfo( '开始处理...' );
|
| | |
|
| | |
|
| | | if( !\CommFunc\CheckPostParam("pack", '{"ErrorNo":"1","ErrorStr":"Param pack error"}') )
|
| | | {
|
| | | exit();
|
| | | }
|
| | |
|
| | | if( !\CommFunc\CheckPostParam("sign", '{"ErrorNo":"2","ErrorStr":"Param sign error"}') )
|
| | | {
|
| | | exit();
|
| | | }
|
| | |
|
| | | //验证信息是否是可允许的
|
| | | $authorityInfo=LoadAuthorityData();
|
| | |
|
| | |
|
| | | $arrayPack = json_decode( $_POST['pack'] , true );
|
| | |
|
| | | \Logging\LogInfo( "json_decode的结果是".var_export( $arrayPack, True ) );
|
| | |
|
| | | $arrayPack['pack_type']=iconv( 'utf-8' , 'gbk', $arrayPack['pack_type'] );
|
| | |
|
| | |
|
| | |
|
| | | if( !array_key_exists( 'pack_type', $arrayPack ) )
|
| | | {
|
| | | echo '{"ErrorNo":"3","ErrorStr":"Can\'t find pack_type in jsondata"}';
|
| | | $strPackRecv=$_POST['pack'];
|
| | | \Logging\LogError( "收到的信息错误,收到的数据是:$strPackRecv" );
|
| | | exit();
|
| | | }
|
| | |
|
| | | $strKey=$authorityInfo->GetKeyFromValue( $arrayPack['pack_type'] );
|
| | |
|
| | | if( md5( $_POST['pack'].$strKey )!=$_POST['sign'] )
|
| | | {
|
| | | \CommFunc\LogErrorAndPrint( '{"ErrorNo":"4","ErrorStr":"Sign error, end"}' );
|
| | | exit();
|
| | | }
|
| | |
|
| | | $DBArray = array("GMTServer_Account", "GMTServer_Name");
|
| | | if (in_array($arrayPack['pack_type'], $DBArray))
|
| | | {
|
| | | //可以直接处理
|
| | | #开始连接数据库
|
| | | $dbOpt=new \MongoCommon\MongoDBOpt( '..\\InterfaceConfig.php', "ServerName" );
|
| | | |
| | | if( !$dbOpt->Init() )
|
| | | {
|
| | | #echo '数据库初始化失败!原因:'.$dbOpt->GetLastError().'请检查配置';
|
| | | $resultjson['status'] = -2;
|
| | | echo json_encode($resultjson);
|
| | | exit;
|
| | | }
|
| | | |
| | | \Logging\LogInfo( 'gmtool连接数据库成功.' );
|
| | | |
| | | $skip=0;
|
| | | $perPage=20;
|
| | | #查找账号是否有账户可以使用
|
| | | if($arrayPack['pack_type'] == "GMTServer_Account")
|
| | | {
|
| | | |
| | | if($arrayPack["accID"] == "")
|
| | | {
|
| | | $findArray = array();
|
| | | }
|
| | | else
|
| | | {
|
| | | $findArray=array('AccID'=>new MongoRegex($arrayPack["accID"].".*/i"));
|
| | | }
|
| | | $dbName = "tagDBPlayer";
|
| | | }
|
| | | else if ($arrayPack['pack_type'] == "GMTServer_Name")
|
| | | {
|
| | | if($arrayPack["name"] == "")
|
| | | {
|
| | | $findArray = array();
|
| | | }
|
| | | else |
| | | {
|
| | | $findArray=array('PlayerName'=>new MongoRegex("/.*".$arrayPack["name"].".*/i"));
|
| | | }
|
| | | $dbName = "tagDBPlayer";
|
| | | }
|
| | | |
| | | if(isset($arrayPack["skip"]))
|
| | | {
|
| | | $skip=$arrayPack["skip"];
|
| | | }
|
| | | |
| | | if(isset($arrayPack["perPage"]))
|
| | | {
|
| | | $perPage=$arrayPack["perPage"];
|
| | | }
|
| | | |
| | | //新增排序
|
| | | $sortinfo = array();
|
| | | if(isset($arrayPack["sort"]))
|
| | | {
|
| | | $sortinfo = json_decode($arrayPack["sort"], true);
|
| | | }
|
| | | |
| | | //查询玩家表
|
| | | $retArray;
|
| | | $retColumn=json_decode($arrayPack["fields"]);
|
| | | |
| | | $result = $dbOpt->GetData($dbName, $findArray, $retArray, $retColumn, $skip, $perPage, $sortinfo);
|
| | | |
| | | //{"ResultType": 0, "ResultMsg": {"forbidTalk": false, "forbidLogin": false}, "pack_type": "GMT_GetPlayerForbid"}
|
| | | if($result)
|
| | | {
|
| | | echo json_encode(array("ResultType"=>0, "ResultMsg"=>$retArray, "pack_type"=>$arrayPack['pack_type']));
|
| | | //\Logging\LogInfo( '数据库直接查询结果'.print_r($retArray, true) );
|
| | | }
|
| | | else
|
| | | {
|
| | | echo json_encode(array("ResultType"=>102));
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //发送给游戏服务器DB
|
| | | SendToDBServer($strOrderID);
|
| | | }
|
| | |
|
| | |
|
| | | \Logging\LogInfo( '结束处理..' );
|