| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace App\Module\Game\Services;
- use App\Module\Game\Dtos\LandChangeTempDto;
- use App\Module\Game\Dtos\LandStatusTempDto;
- use App\Module\Game\Logics\LandTemp;
- /**
- * 土地临时数据服务类
- *
- * 提供土地临时数据相关的服务方法,用于外部调用
- */
- class LandTempService
- {
- /**
- * 获取用户的土地变更临时数据
- *
- * @param int $userId 用户ID
- * @return array 用户的土地变更数据,键为土地ID,值为LandChangeTempDto对象
- */
- public static function getUserLandChanges(int $userId): array
- {
- return LandTemp::getUserLandChanges($userId);
- }
- /**
- * 获取用户特定土地的变更临时数据
- *
- * @param int $userId 用户ID
- * @param int $landId 土地ID
- * @return LandChangeTempDto|null 土地变更数据,不存在时返回null
- */
- public static function getUserLandChange(int $userId, int $landId): ?LandChangeTempDto
- {
- return LandTemp::getUserLandChange($userId, $landId);
- }
- /**
- * 获取用户的土地状态变更临时数据
- *
- * @param int $userId 用户ID
- * @return array 用户的土地状态变更数据,键为土地ID,值为LandStatusTempDto对象
- */
- public static function getUserLandStatusChanges(int $userId): array
- {
- return LandTemp::getUserLandStatusChanges($userId);
- }
- /**
- * 获取用户特定土地的状态变更临时数据
- *
- * @param int $userId 用户ID
- * @param int $landId 土地ID
- * @return LandStatusTempDto|null 土地状态变更数据,不存在时返回null
- */
- public static function getUserLandStatusChange(int $userId, int $landId): ?LandStatusTempDto
- {
- return LandTemp::getUserLandStatusChange($userId, $landId);
- }
- /**
- * 清除用户的土地变更临时数据
- *
- * @param int $userId 用户ID
- * @return void
- */
- public static function clearUserLandChanges(int $userId): void
- {
- LandTemp::clearUserLandChanges($userId);
- }
- /**
- * 清除用户的土地状态变更临时数据
- *
- * @param int $userId 用户ID
- * @return void
- */
- public static function clearUserLandStatusChanges(int $userId): void
- {
- LandTemp::clearUserLandStatusChanges($userId);
- }
- /**
- * 清除用户的所有土地临时数据
- *
- * @param int $userId 用户ID
- * @return void
- */
- public static function clearUserAllLandTemp(int $userId): void
- {
- LandTemp::clearUserAllLandTemp($userId);
- }
- }
|