浏览代码

改进FertilizerHandler:验证后获取作物ID并传递给服务层进行施肥效果处理

notfff 7 月之前
父节点
当前提交
1409c907ff
共有 1 个文件被更改,包括 9 次插入14 次删除
  1. 9 14
      app/Module/Game/Logics/LandTemp.php

+ 9 - 14
app/Module/Game/Logics/LandTemp.php

@@ -124,22 +124,17 @@ class LandTemp
             }
 
             // 构建统一的土地变更数据
-            $landData = [
-                'land_id' => $land->id,
-                'position' => $land->position,
-                'land_type' => $land->landType,
-                'old_type' => $event->oldType,
-                'new_type' => $event->newType,
-                'old_status' => null,
-                'new_status' => null,
-                'crop_id' => null,
-                'seed_id' => null,
-                'change_type' => 'type',
-                'updated_at' => time(),
-            ];
+
+
+            $LandChangeTempDto = new LandChangeTempDto();
+            $LandChangeTempDto->landId = $land->id;
+            $LandChangeTempDto->landType = $land->landType->id;
+            $LandChangeTempDto->changeType = 'type';
+            $LandChangeTempDto->updatedAt = time();
+
 
             // 存储到统一的土地变更缓存
-            self::storeLandChange($event->userId, $land->id, $landData);
+            self::storeLandChange($event->userId, $land->id, $LandChangeTempDto);
 
             Log::info('土地升级数据已临时存储', [
                 'user_id' => $event->userId,