Quellcode durchsuchen

添加分页status

chenxiqiang vor 6 Jahren
Ursprung
Commit
41b7acb770

+ 9
- 1
manage-server/app/Http/Controllers/ServerInfoController.php Datei anzeigen

19
         $server = $request->input('server');
19
         $server = $request->input('server');
20
         $content = $request->input('content');;
20
         $content = $request->input('content');;
21
         $photo = $request->input('photo');
21
         $photo = $request->input('photo');
22
+        $location = $request->input('location');
22
         if ($id) {
23
         if ($id) {
23
             $serverInfo = ServerInfo::find($id);
24
             $serverInfo = ServerInfo::find($id);
24
         } else {
25
         } else {
28
             $serverInfo->server = $server;
29
             $serverInfo->server = $server;
29
             $serverInfo->content = $content;
30
             $serverInfo->content = $content;
30
             $serverInfo->photo = $photo;
31
             $serverInfo->photo = $photo;
32
+            $serverInfo->location = $location;
31
             $serverInfo->save();
33
             $serverInfo->save();
32
             return Response()->json([
34
             return Response()->json([
33
                 "status" => 0,
35
                 "status" => 0,
48
      */
50
      */
49
     public function list(Request $request)
51
     public function list(Request $request)
50
     {
52
     {
51
-        return ServerInfo::paginate(20);
53
+        $top = ServerInfo::where("location", "top");
54
+        $bottom = ServerInfo::where("location", "bottom");
55
+        return Response()->json([
56
+            "top" => $top,
57
+            "introduce" => "服务介绍",
58
+            "bottom" => $bottom
59
+        ]);
52
     }
60
     }
53
 }
61
 }

+ 1
- 0
manage-server/app/Models/ServerInfo.php Datei anzeigen

10
         'server', // 活动标题
10
         'server', // 活动标题
11
         'content', // 活动内容
11
         'content', // 活动内容
12
         'photo', // 首页显示的
12
         'photo', // 首页显示的
13
+        'location', // 显示位置
13
     ];
14
     ];
14
 }
15
 }

+ 1
- 0
manage-server/database/migrations/2018_08_15_102542_create_server_infos_table.php Datei anzeigen

18
             $table->string('server');
18
             $table->string('server');
19
             $table->text('content');
19
             $table->text('content');
20
             $table->string('photo');
20
             $table->string('photo');
21
+            $table->string('location');
21
             $table->timestamps();
22
             $table->timestamps();
22
         });
23
         });
23
     }
24
     }

Loading…
Abbrechen
Speichern