Browse Source

修复 PetTemp 类中缺少 clearUserPetUpdates 方法的问题

notfff 7 months ago
parent
commit
ff5d5e41af
1 changed files with 12 additions and 0 deletions
  1. 12 0
      app/Module/Game/Logics/PetTemp.php

+ 12 - 0
app/Module/Game/Logics/PetTemp.php

@@ -278,6 +278,18 @@ class PetTemp
         return $userPetUpdates[$petId] ?? null;
     }
 
+    /**
+     * 清除用户的宠物更新临时数据
+     *
+     * @param int $userId 用户ID
+     * @return void
+     */
+    public static function clearUserPetUpdates(int $userId): void
+    {
+        $tempKey = self::TEMP_KEY_UPDATE_PREFIX . $userId;
+        Cache::put($tempKey, [], 0);
+    }
+
     /**
      * 清除用户的宠物创建临时数据
      *