Просмотр исходного кода

fixed: 移除角标方法中未能正确从数组中删除元素, 调用事先在stlutl中的方法后OK.

王刚 3 лет назад
Родитель
Сommit
f0a67454dd
2 измененных файлов с 11 добавлено и 8 удалено
  1. 6 5
      Gameserver/Amfphp/process/EventProc.php
  2. 5 3
      Gameserver/Amfphp/test.php

+ 6 - 5
Gameserver/Amfphp/process/EventProc.php

@@ -26,11 +26,12 @@ class EventProc {
      * [7202] 清理指定类型的角标记录
      */
     static function ClearCornerSignNotification() {
-        $ctype =req()->paras[0];
-        $e=new OperateEventType();
-        $e->isValidValue($ctype);
-        unset( req()->userInfo->game->privateState->cornerSignNotifications[$ctype]);
-        UserProc::updateUserInfo();
+        $ctype = req()->paras[0];
+        $e = new OperateEventType();
+        if ($e->isValidValue($ctype)) {
+            StlUtil::arrayRemove(req()->userInfo->game->privateState->cornerSignNotifications, $ctype); # 移除角标
+            UserProc::updateUserInfo();
+        }
         $arr = array_values(array_unique(req()->userInfo->game->privateState->cornerSignNotifications)); # 返回值去重
         //        req()->userInfo->game->privateState->cornerSignNotifications = [];       # 清理记录
         return Resp::ok(array("notifications" => $arr));                        # 返回

+ 5 - 3
Gameserver/Amfphp/test.php

@@ -2,7 +2,6 @@
 
 namespace loyalsoft;
 
-
 include __DIR__ . '/main.php';
 var_dump(__DIR__);
 echoLine("phpver: " . PHP_VERSION . PHP_EOL);
@@ -13,5 +12,8 @@ echoLine("tsDay:" . tsDay());
 //
 //
 
-CLog::err("wwww");
-unset($i);
+$arr = [12];
+$i = 12;
+
+StlUtil::arrayRemove($arr, $i);
+var_dump($arr);