|
@@ -49,28 +49,39 @@ class ClassifyController extends Controller
|
49
|
49
|
*/
|
50
|
50
|
public function home(Request $request)
|
51
|
51
|
{
|
52
|
|
- $top = Classify::where("location", "top")->limit(3)->get()->toArray();
|
53
|
|
- $bottom = Classify::where("location", "bottom")->first();
|
54
|
|
-
|
55
|
|
- $tops = array_map(function ($t) {
|
56
|
|
- return [
|
57
|
|
- "id" => $t["id"],
|
58
|
|
- "server" => $t["server"],
|
59
|
|
- "content" => $t["content"],
|
60
|
|
- "photo" => $t["photo"],
|
61
|
|
- "location" => $t["location"]
|
62
|
|
- ];
|
63
|
|
- }, $top);
|
64
|
|
-
|
|
52
|
+ $homePage = HomePage::find(1);
|
|
53
|
+ $top1 = HomePage::find($homePage->top1);
|
|
54
|
+ $top2 = HomePage::find($homePage->top2);
|
|
55
|
+ $top3 = HomePage::find($homePage->top3);
|
|
56
|
+ $bottom = HomePage::find($homePage->bottom);
|
|
57
|
+ $introduce = HomePage::find($homePage->introduce);
|
65
|
58
|
return Response()->json([
|
66
|
|
- "top" => $tops,
|
67
|
|
- "introduce" => "服务介绍",
|
|
59
|
+ "top" => [
|
|
60
|
+ [
|
|
61
|
+ "id" => $top1["id"],
|
|
62
|
+ "server" => $top1["server"],
|
|
63
|
+ "content" => $top1["content"],
|
|
64
|
+ "photo" => $top1["photo"],
|
|
65
|
+ ],
|
|
66
|
+ [
|
|
67
|
+ "id" => $top2["id"],
|
|
68
|
+ "server" => $top2["server"],
|
|
69
|
+ "content" => $top2["content"],
|
|
70
|
+ "photo" => $top2["photo"],
|
|
71
|
+ ],
|
|
72
|
+ [
|
|
73
|
+ "id" => $top3["id"],
|
|
74
|
+ "server" => $top3["server"],
|
|
75
|
+ "content" => $top3["content"],
|
|
76
|
+ "photo" => $top3["photo"],
|
|
77
|
+ ]
|
|
78
|
+ ],
|
|
79
|
+ "introduce" => $introduce,
|
68
|
80
|
"bottom" => [
|
69
|
81
|
"id" => $bottom["id"],
|
70
|
82
|
"server" => $bottom["server"],
|
71
|
83
|
"content" => $bottom["content"],
|
72
|
84
|
"photo" => $bottom["photo"],
|
73
|
|
- "location" => $bottom["location"]
|
74
|
85
|
]
|
75
|
86
|
]);
|
76
|
87
|
}
|