소스 검색

fixed: 1个语法错误. 补充一个防御代码.

gwang 4 년 전
부모
커밋
823dd7b0a3
3개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      Gameserver/Amfphp/process/FightProc/SweepGatesProc.php
  2. 1 0
      Gameserver/Amfphp/process/TaskProc.php
  3. 6 0
      Gameserver/Amfphp/test.php

+ 3 - 3
Gameserver/Amfphp/process/FightProc/SweepGatesProc.php

@@ -79,7 +79,7 @@ class SweepGatesProc {
         list($chapterId, $hard, $stars) = $req->paras;                          # 参数: 章节id, 难度, 分数
         list($chapterId, $hard, $stars) = $req->paras;                          # 参数: 章节id, 难度, 分数
         $hard = $hard + 1;
         $hard = $hard + 1;
         $userGates = new Info_UserGateDifficulty($req->userInfo->game->gates);
         $userGates = new Info_UserGateDifficulty($req->userInfo->game->gates);
-        if (!property_exists($userGates->chapterStarsRwd . $chapterId)) {       # 防御第一次读取本章节数据
+        if (!property_exists($userGates->chapterStarsRwd, $chapterId)) {        # 防御第一次读取本章节数据
             $userGates->chapterStarsRwd->$chapterId = ObjectInit();
             $userGates->chapterStarsRwd->$chapterId = ObjectInit();
         }
         }
         $chapterInfo = $userGates->chapterStarsRwd->$chapterId;                 # 本章节数据
         $chapterInfo = $userGates->chapterStarsRwd->$chapterId;                 # 本章节数据
@@ -91,7 +91,7 @@ class SweepGatesProc {
         $rwdCfgArr = GameConfig::gate_starreward_getItem($chapterId, $hard);    # 奖励配置数组
         $rwdCfgArr = GameConfig::gate_starreward_getItem($chapterId, $hard);    # 奖励配置数组
 //        isEditor() and $starCfg = new \sm_gate_starreward;
 //        isEditor() and $starCfg = new \sm_gate_starreward;
 //        var_dump($rwdCfgArr);
 //        var_dump($rwdCfgArr);
-        $starCfg = StlUtil::arrayFind($rwdCfgArr, function ($v, $k)use($stars) { # 在数组中查找到对应星数的奖励
+        $starCfg = StlUtil::arrayFind($rwdCfgArr, function ($v, $k)use ($stars) { # 在数组中查找到对应星数的奖励
                     return ($v->star == $stars);
                     return ($v->star == $stars);
                 });
                 });
 //        var_dump($starCfg);
 //        var_dump($starCfg);
@@ -113,7 +113,7 @@ class SweepGatesProc {
         }
         }
         my_Assert(null != $userGateL, ErrCode::err_innerfault);                 # 玩家数据有问题
         my_Assert(null != $userGateL, ErrCode::err_innerfault);                 # 玩家数据有问题
 //        var_dump($userGateL);
 //        var_dump($userGateL);
-        array_walk($userGateL->gates, function($v, $k)use(&$sumOfStars) {       # 累加星数
+        array_walk($userGateL->gates, function ($v, $k)use (&$sumOfStars) {       # 累加星数
             $sinfo = new GateStar($v->star);
             $sinfo = new GateStar($v->star);
             $sumOfStars += $sinfo->Stars();
             $sumOfStars += $sinfo->Stars();
         });
         });

+ 1 - 0
Gameserver/Amfphp/process/TaskProc.php

@@ -219,6 +219,7 @@ class TaskProc {
         list($gate_or_npc_id, $stage) = $req->paras;
         list($gate_or_npc_id, $stage) = $req->paras;
         $bUpdate = self::OnPlotOver($gate_or_npc_id, $stage);                   # 触发一下任务检查,更新任务状态
         $bUpdate = self::OnPlotOver($gate_or_npc_id, $stage);                   # 触发一下任务检查,更新任务状态
         $arr = GameConfig::plot_getItem($gate_or_npc_id, $stage);               # 查找对应的剧情
         $arr = GameConfig::plot_getItem($gate_or_npc_id, $stage);               # 查找对应的剧情
+        my_Assert(isset($arr), ErrCode::err_const_no);                          # 常量存在
         foreach ($arr as $plot) {
         foreach ($arr as $plot) {
             isEditor() and $plot = new \sm_plot();
             isEditor() and $plot = new \sm_plot();
             if (!empty($plot->presentItem)) {
             if (!empty($plot->presentItem)) {

+ 6 - 0
Gameserver/Amfphp/test.php

@@ -11,3 +11,9 @@ echoLine("phpver: " . PHP_VERSION . PHP_EOL);
 //
 //
 // 
 // 
 echo number_format(1.0125, 2, '.', '');
 echo number_format(1.0125, 2, '.', '');
+$arr = GameConfig::plot_getItem(1001, 0);               # 查找对应的剧情
+var_dump($arr);
+//foreach ($arr as $plot) {
+//    isEditor() and $plot = new \sm_plot();
+//    var_dump($plot);
+//}