wzq il y a 5 ans
Parent
commit
97cf92bf4a

+ 2 - 4
app/Repositories/FloorRepository.php

@@ -25,11 +25,9 @@ class FloorRepository
     {
         $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
         $where = [];
-        if(isset($request['id'])){
-            $where[] = ['id',$request['id']];
-        }
+        $where[] = ['is_open', 1];
 
-        return $this->floor->where($where)->orderBy('id', 'asc')->paginate($perPage);
+        return $this->floor->where($where)->orderBy('floor_location', 'asc')->paginate($perPage);
     }
 
 }

+ 7 - 5
app/Transformers/FloorTransformer.php

@@ -15,14 +15,16 @@ class FloorTransformer extends TransformerAbstract
 
     public function transform(Floor $floor)
     {
+        $showType = [
+            0 => 'banner',
+            1 => 'user',
+            2 => 'video',
+            3 => 'topic',
+        ];
         return [
-            'id'  => $floor['id'],
-            'name'  => $floor['name'],
             'floor_location'    => $floor['floor_location'],
             'group_ids'    => $floor['group_ids'],
-            'floor_type'    => $floor['floor_type'],
-            'is_open'    => $floor['is_open'],
-            'updated_at'    => date($floor['updated_at']),
+            'show_type'    => $showType[$floor['floor_type']],
         ];
     }
 }