Index.php
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
namespace App\Http\Controllers\V2;
use App\Fun;
use Illuminate\Support\Facades\View;
/**
* 第二版的控制器
* @author:dc
* @time 2022/12/28 9:26
* Class Index
* @package App\Http\Controllers\V2
*/
class Index extends Base
{
/**
* 首页
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
* @author:dc
* @time 2022/11/16 9:06
*/
public function home()
{
return view('v2/home');
}
/**
* 博客
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
* @author:dc
* @time 2022/12/28 10:13
*/
public function blog()
{
$web = [
'title' => 'blog',
'keywords' => 'blog',
'description' => 'blog',
];
$lists = $this->getData('blog');
if(!empty($lists['links'])){
foreach ($lists['links'] as &$link){
preg_match("/page=(\d+)/i",$link['url'],$p);
$link['page'] = $p[1]??0;
}
}
return view('v2/blog/lists',[
'lists' => $lists,
'web' => $web
]);
}
/**
* 博客详情
* @param $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
* @author:dc
* @time 2022/12/28 10:13
*/
public function blog_info($id){
$data = $this->getData('blog/'.$id,['prev'=>1,'next'=>1,'correlation'=>1]);
if(!$data){
Fun::abort();
}
$web = [
'title' => $data['blog_title'],
'keywords' => $data['blog_seo_keywords'],
'description' => $data['blog_seo_description'],
];
return view('v2/blog/info',[
'data' => $data,
'web' => $web
]);
}
/**
* 单页
* @param $key
* @author:dc
* @time 2022/12/28 16:59
*/
public function page($key){
$page = $this->getData('page',['urlkey'=>$key]);
if(!$page){
Fun::abort();
}
$web = [
'title' => $page['page_title'],
'keywords' => $page['page_seo_keywords'],
'description' => $page['page_seo_description'],
];
return view('v2/page', [
'data' => $page,
'web' => $web
]);
}
}