cyzhao 1 rok pred
rodič
commit
445c07ad02

+ 6 - 2
Gameserver/App/base/Object_ext.php

@@ -42,8 +42,13 @@ class Object_ext {
         $para = is_array($obj) ? $obj : (array) $obj;                           # 转关联数组
         $vars = get_class_vars(get_class($this));                               # 后期绑定,获得实例的实际类名称=>属性数组
         foreach ($vars as $name => $value) {
+//            echoLine($name . " : " . ($this->$name != null && is_object($this->$name) ? get_class($this->$name) : "null"));
             if (isset($para[$name])) {
-                $this->$name = $para[$name];                                    # 取参数中的或者默认值
+                if (is_a($this->$name, __CLASS__)) {                            # 递归加载数据
+                    $this->$name->LoadFrom($para[$name]);
+                } else {
+                    $this->$name = $para[$name];                                # 取参数中的或者默认值
+                }
             }
         }
         return $this;
@@ -96,5 +101,4 @@ class Object_ext {
         }
         return (array) $mix;
     }
-
 }

+ 3 - 3
Gameserver/App/model/User/Info_Gates.php

@@ -68,12 +68,12 @@ class Info_Gates extends Object_ext {
                 $this->GateList = new \stdClass();
                 $Ins_GateInfo = new Ins_GateInfo();
                 $Ins_GateInfo->GateId = $this->CurrentGateId;
-                $this->GateList->$startId=$Ins_GateInfo;                       
+                $this->GateList->$startId = $Ins_GateInfo;
             }
-            
+
             $this->GatesChallengeRecord = new \stdClass();
         } else {
-            parent::__construct($arg);           
+            parent::__construct($arg);
         }
     }
 }

+ 12 - 14
Gameserver/App/process/UserProc.php

@@ -27,7 +27,7 @@ class UserProc {
             case CmdCode::cmd_user_gameconstinfo:                               # 6002 下载游戏配置
                 return UserProc::downloadConstInfo();  
             case CmdCode::cmd_user_setAnimation:
-                return UserProc::setAnimation();  
+                return UserProc::setAnimation();            
             default:
                 Err(ErrCode::cmd_err);
         }
@@ -174,34 +174,33 @@ class UserProc {
         $game = UserProc::getUserGame(req()->zoneid, req()->uid);
         if ($game == null) {                                                # 新用户, -> 6006创建账号
             $userID = req()->uid;
-        
+
             $id = gMem()->increment(MemKey_GameRun::Stat_UserCountByZone_int(req()->zoneid));   # 增加玩家数量计数
-            $rolename = "No." . sprintf("%03d", req()->zoneid) . sprintf("%07d", $id); # 生成编号                       
+            $rolename = "No." . sprintf("%03d", req()->zoneid) . sprintf("%07d", $id); # 生成编号
             if (self::checkRoleNameNotExist($rolename)) {                           # 记录玩家
-                $game = self::createUser($rolename);           
-                if (1 == self::regRole(req()->zoneid, $userID, $rolename, "", "","")) {                    
+                $game = self::createUser($rolename);
+                if (1 == self::regRole(req()->zoneid, $userID, $rolename, "", "", "")) {
                     $resp = Resp::ok($game);
                     self::updtateUserZoneInfo();
                 } else {
                     $resp = Resp::err(ErrCode::err_db);
                 }
-
             } else {                                                                # 昵称已存在
                 $resp = Resp::ok(array('ret' => '用户已存在.'));
             }
-             
+
             UserProc::updateUserInfo();                                         # 这一步回存操作只有在 userInfo正常存在的情况下才进行
-            
+
             return $resp;
-        } else {                                                                # 2.如果玩家已存在,则处理普通登录流程              
-            req()->game = $game;                                                # 给Req挂载玩家数据                     
+        } else {                                                                # 2.如果玩家已存在,则处理普通登录流程
+            req()->game = $game;                                                # 给Req挂载玩家数据
             UserProc::checkContidays();                                         # 连续登录,状态检查
             //PayProc::m_refreshChargeOrders();                                   # 刷新订单, 多平台版本
             //PayProc::checkDeltest();                                            # 检查内侧充值记录(函数内部会只检查一次)
             //self::checkMissOrder();                                             #校验是否有漏单
             UserProc::updateUserInfo();                                         # 这一步回存操作只有在 userInfo正常存在的情况下才进行
 
-            $resp = Resp::ok($game);                                            # 设置返回值 
+            $resp = Resp::ok($game);                                            # 设置返回值
             self::updtateUserZoneInfo();                                        # 1. 更新玩家分区记录
         }
         return $resp;
@@ -258,9 +257,8 @@ class UserProc {
         } else if ($ret >= 2) {                                                 # 隔天登录
         }
         ctx()->baseInfo->lastLogin = now();                                     # 更新下访问时间
-
         //TapDBUtil::SOnUserLogin();                                              # 向tapdb上报玩家登录 2023.5.10
-        
+
         return $ret;
     }
 
@@ -283,7 +281,7 @@ class UserProc {
         $game = new Data_UserGame();
         req()->game = $game;                                                    # 更新Req挂载的玩家数据,
         $game->initialize();                                                    # 初始化玩家数据
-        $game->baseInfo->name = $rolename;        
+        $game->baseInfo->name = $rolename;
         $game->baseInfo->headImg = "";
         $game->baseInfo->firstLogin = now();