|
@@ -6,6 +6,7 @@ use Common_pack\EnterHall;
|
|
|
use Common_pack\ReqLogin;
|
|
|
use Common_pack\ResEnterHall;
|
|
|
use Common_pack\ResLogin;
|
|
|
+use Google\Protobuf\Internal\Message;
|
|
|
|
|
|
class GameClient {
|
|
|
private ?BinaryWebSocketClient $client = null;
|
|
@@ -28,28 +29,7 @@ class GameClient {
|
|
|
}
|
|
|
|
|
|
echo "序列化结果(HEX): " . bin2hex($binaryData) . "\n";
|
|
|
-
|
|
|
-
|
|
|
- $verifyReq = new ReqLogin();
|
|
|
- $verifyReq->mergeFromString($binaryData);
|
|
|
-
|
|
|
- // 6. 比较原始对象和反序列化对象
|
|
|
- if ($loginReq->getAccount() !== $verifyReq->getAccount() ||
|
|
|
- $loginReq->getPassword() !== $verifyReq->getPassword()) {
|
|
|
- throw new Exception("反序列化验证失败:数据不一致");
|
|
|
- }
|
|
|
-
|
|
|
- echo "✅ 序列化验证成功!\n";
|
|
|
- echo "原始数据: \n";
|
|
|
- print_r($loginReq);
|
|
|
-
|
|
|
- if (1==1) {
|
|
|
- throw new Exception("over");
|
|
|
- }else{
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
$options = [
|
|
|
'http' => [
|
|
|
'header' => [
|
|
@@ -73,7 +53,8 @@ class GameClient {
|
|
|
$userResponse = new ResLogin();
|
|
|
$userResponse->mergeFromString($response);
|
|
|
|
|
|
- if ($userResponse->hasErrMsg()) {
|
|
|
+ if ($userResponse->getErrMsg()!=NIL) {
|
|
|
+ print_r($userResponse->getErrMsg());
|
|
|
throw new Exception("登录失败: ".$userResponse->getErrMsg()->getMessage());
|
|
|
}
|
|
|
|