diff --git a/app/Http/Controllers/Console/Link.php b/app/Http/Controllers/Console/Link.php new file mode 100644 index 0000000..e5d066e --- /dev/null +++ b/app/Http/Controllers/Console/Link.php @@ -0,0 +1,83 @@ +data = $data->data; + } + + protected function ViewList(Request $request): Factory|View|Application|RedirectResponse + { + $dataMarge = [ + 'blogFriendsTotal' => DB::table('blog_link') + ->whereNotIn('blog_link.blogLocation', [0]) + ->count(), + 'blogFriendsCheck' => DB::table('blog_link') + ->where('blog_link.blogLocation', 0) + ->count(), + 'blogFriendsBest' => DB::table('blog_link') + ->where('blog_link.blogLocation', 2) + ->count(), + ]; + if (empty($request->search)) { + // 获取数据库信息 + if (empty($request->page)) $request->page = 0; + $this->data['blog'] = DB::table('blog_link') + ->whereNotIn('blogLocation',[0]) + ->orderBy('id') + ->offset($request->page*10) + ->limit(10) + ->get() + ->toArray(); + $this->data['blogCount'] = DB::table('blog_link') + ->whereNotIn('blogLocation',[0]) + ->orderBy('id') + ->count(); + $this->data['webClass'] = [ + 'active' => 'px-3 py-2 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white', + 'unactive' => 'px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white', + ]; + $this->data['blogCount'] = ceil($this->data['blogCount']/10); + } else { + $this->data['blog'] = DB::select("SELECT * FROM xf_index.blog_link WHERE blogName LIKE '%$request->search%' OR blogUrl LIKE '%$request->search%' ORDER BY id"); + } + $this->data['request'] = $request; + if ($this->data['request']->page > $this->data['blogCount']-1) return Response::redirectTo(route('console.friends-link.list')); + $this->data = array_merge($this->data, $dataMarge); + return view('console.friends-link.list', $this->data); + } + + protected function ViewCheck(Request $request): Factory|View|Application + { + return view('console.friends-link.check', $this->data); + } + + protected function ViewEdit(Request $request) { + return view('console.friends-link.edit',$this->data); + } + + protected function ViewAdd(Request $request) { + return view('console.friends-link.add',$this->data); + } +} diff --git a/resources/views/console/friends-link/list.blade.php b/resources/views/console/friends-link/list.blade.php new file mode 100644 index 0000000..ab90e90 --- /dev/null +++ b/resources/views/console/friends-link/list.blade.php @@ -0,0 +1,184 @@ + + +
+ + + + + + @include('modules.head') + {!! $webHeader !!} + + + + + +@include('console.modules.aside') + +当前友链 {{ $blogFriendsTotal }} 条
+超级友链 {{ $blogFriendsBest }} 条
+待审友链 {{ $blogFriendsCheck }} 条
+没有查找到用户呢
+ @endif + @else +赶紧去添加一个吧
+当前友链 {{ $blogFriendsTotal }} 条
+超级友链 {{ $blogFriendsBest }} 条
+待审友链 {{ $blogFriendsCheck }} 条
+