diff --git a/app/Http/Controllers/Console/Dashboard.php b/app/Http/Controllers/Console/Dashboard.php index df9e399..1a564d3 100644 --- a/app/Http/Controllers/Console/Dashboard.php +++ b/app/Http/Controllers/Console/Dashboard.php @@ -8,10 +8,10 @@ namespace App\Http\Controllers\Console; use App\Http\Controllers\Controller; +use App\Http\Controllers\Index; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; -use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; class Dashboard extends Controller @@ -20,12 +20,8 @@ class Dashboard extends Controller public function __construct() { - $this->data = [ - 'userName' => Auth::user()->username, - 'userEmail' => Auth::user()->email, - 'userLinkId' => Auth::user()->linkId, - 'userIcon' => Auth::user()->icon, - ]; + $data = new Index(); + $this->data = $data->data; } protected function ViewDashboard(): Factory|View|Application diff --git a/app/Http/Controllers/Function/Link.php b/app/Http/Controllers/Function/Link.php new file mode 100644 index 0000000..93d5df3 --- /dev/null +++ b/app/Http/Controllers/Function/Link.php @@ -0,0 +1,40 @@ +data = $data->data; + } + + protected function ViewLink(Request $request): Factory|View|Application + { + $this->data['webSubTitle'] = '友链'; + $this->GetFriendsLink($this->data); + return view('function.link',$this->data); + } + + private function GetFriendsLink(array &$data): void + { + $data['blogLink'] = DB::table('blog_link')->whereNotIn('blog_link.blogLocation',[0])->get()->toArray(); + $data['blogSort'] = DB::table('blog_sort')->orderBy('blog_sort.sort')->get()->toArray(); + } +} diff --git a/app/Http/Controllers/Index.php b/app/Http/Controllers/Index.php new file mode 100644 index 0000000..d135532 --- /dev/null +++ b/app/Http/Controllers/Index.php @@ -0,0 +1,81 @@ +data = [ + 'webTitle' => empty($tempStorage = DB::table('info')->find(1)->data) ? '未定义标题' : $tempStorage, + 'webDescription' => empty($tempStorage = DB::table('info')->find(2)->data) ? '未定义副标题' : $tempStorage, + 'webSubTitle' => empty($tempStorage = DB::table('info')->find(3)->data) ? '未定义小标题' : $tempStorage, + 'webSubTitleDescription' => empty($tempStorage = DB::table('info')->find(4)->data) ? '未定义小标题内容' : $tempStorage, + 'webIcon' => empty($tempStorage = DB::table('info')->find(5)->data) ? asset('images/logo.jpg') : $tempStorage, + 'webHeader' => DB::table('info')->find(7)->data, + 'webFooter' => DB::table('info')->find(8)->data, + 'webKeyword' => empty($tempStorage = DB::table('info')->find(6)->data) ? '筱锋,凌中的锋雨,xiao_lfeng' : $tempStorage, + 'userName' => Auth::user()->username, + 'userEmail' => Auth::user()->email, + 'userIcon' => Auth::user()->icon, + 'sqlAuthor' => empty($tempStorage = DB::table('info')->find(12)->data) ? '筱锋xiao_lfeng' : $tempStorage, + 'sqlCopyRightYear' => DB::table('info')->find(13)->data, + 'sqlIcp' => DB::table('info')->find(10)->data, + 'sqlGongan' => DB::table('info')->find(11)->data, + 'sqlBlog' => DB::table('info')->find(14)->data, + ]; + if (!empty($this->data['sqlGongan'])) { + preg_match('/[0-9]+/', $this->data['sqlGongan'], $data); + $this->data = array_merge($this->data, ['GonganCode' => $data[0]]); + } + } else { + $this->data = array(); + } + } + + protected function ViewIndex(): Factory|View|Application + { + return view('index', $this->data); + } + + protected function ViewAboutMe(): Factory|View|Application + { + $resultAboutMe = DB::table('info')->where('info.value', '=', 'aboutMe')->value('info.data'); + $data = [ + 'userAbout' => $this->MarkdownToStringReplace($resultAboutMe), + ]; + $this->data = array_merge($this->data, $data); + return view('about', $this->data); + } + + private function MarkdownToStringReplace(string $dataBase): string + { + $decodeText = MarkdownExtra::defaultTransform($dataBase); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('

', '

', $decodeText); + $decodeText = str_replace('', '


', $decodeText); + return (string)$decodeText; + } +}