|
@@ -21,60 +21,75 @@ class IndexController extends HomeBaseController |
|
@@ -21,60 +21,75 @@ class IndexController extends HomeBaseController |
21
|
$serverModel = new ServerController();
|
21
|
$serverModel = new ServerController();
|
22
|
//统计访问量
|
22
|
//统计访问量
|
23
|
$serverModel->statistics();
|
23
|
$serverModel->statistics();
|
24
|
-
|
|
|
25
|
//banner轮播图
|
24
|
//banner轮播图
|
26
|
- $coverImg = $this->getCoverImg(CityCategoryModel::indexImg,3);
|
25
|
+ $coverImg = cache('coverImg');
|
|
|
26
|
+ if(!$coverImg){
|
|
|
27
|
+ $coverImg = $this->getCoverImg(CityCategoryModel::indexImg,3);
|
|
|
28
|
+ cache('coverImg',$coverImg,86400);
|
|
|
29
|
+ }
|
27
|
$this->assign('coverImg',$coverImg);
|
30
|
$this->assign('coverImg',$coverImg);
|
28
|
|
31
|
|
29
|
//星球奇境,城市分类
|
32
|
//星球奇境,城市分类
|
30
|
- $city[1]['id'] = CityCategoryModel::asia;
|
|
|
31
|
- $city[2]['id'] = CityCategoryModel::europe;
|
|
|
32
|
- $city[3]['id'] = CityCategoryModel::africa;
|
|
|
33
|
- $city[4]['id'] = CityCategoryModel::oceania;
|
|
|
34
|
- $city[5]['id'] = CityCategoryModel::north;
|
|
|
35
|
- $city[6]['id'] = CityCategoryModel::south;
|
|
|
36
|
- $city[20]['id'] = CityCategoryModel::antarctica;
|
|
|
37
|
- $city[43]['id'] = CityCategoryModel::arctic;
|
|
|
38
|
- $city_name = $this->getCity(array_column($city,'id'));
|
|
|
39
|
- foreach($city as &$value){
|
|
|
40
|
- $k = 0;
|
|
|
41
|
- foreach($city_name as $value1){
|
|
|
42
|
- $k += 0;
|
|
|
43
|
- if($value['id'] == $value1['pid']){
|
|
|
44
|
- $value['name'][$k]['name'] = $value1['name'];
|
|
|
45
|
- $value['name'][$k]['id'] = $value1['id'];
|
|
|
46
|
- $k++;
|
33
|
+ $city = cache('res_city');
|
|
|
34
|
+ if(!$city){
|
|
|
35
|
+ $city[1]['id'] = CityCategoryModel::asia;
|
|
|
36
|
+ $city[2]['id'] = CityCategoryModel::europe;
|
|
|
37
|
+ $city[3]['id'] = CityCategoryModel::africa;
|
|
|
38
|
+ $city[4]['id'] = CityCategoryModel::oceania;
|
|
|
39
|
+ $city[5]['id'] = CityCategoryModel::north;
|
|
|
40
|
+ $city[6]['id'] = CityCategoryModel::south;
|
|
|
41
|
+ $city[20]['id'] = CityCategoryModel::antarctica;
|
|
|
42
|
+ $city[43]['id'] = CityCategoryModel::arctic;
|
|
|
43
|
+ $city_name = $this->getCity(array_column($city,'id'));
|
|
|
44
|
+ foreach($city as &$value){
|
|
|
45
|
+ $k = 0;
|
|
|
46
|
+ foreach($city_name as $value1){
|
|
|
47
|
+ $k += 0;
|
|
|
48
|
+ if($value['id'] == $value1['pid']){
|
|
|
49
|
+ $value['name'][$k]['name'] = $value1['name'];
|
|
|
50
|
+ $value['name'][$k]['id'] = $value1['id'];
|
|
|
51
|
+ $k++;
|
|
|
52
|
+ }
|
47
|
}
|
53
|
}
|
48
|
}
|
54
|
}
|
|
|
55
|
+ cache('res_city', $city,86400);//有效期一天
|
49
|
}
|
56
|
}
|
50
|
$this->assign('res_city',$city);
|
57
|
$this->assign('res_city',$city);
|
51
|
|
58
|
|
52
|
//星享体验
|
59
|
//星享体验
|
53
|
- $res_month = $this->getMonthArticle();
|
|
|
54
|
- $month = [];
|
|
|
55
|
- foreach($res_month['data'] as &$value){
|
|
|
56
|
- $month[$value['month']]['id'] = $value['id'];
|
|
|
57
|
- $month[$value['month']]['month'] = $value['month'];
|
|
|
58
|
- $month[$value['month']]['post_title'] = $value['post_title'];
|
|
|
59
|
- $month[$value['month']]['index_thumbnail'] = $value['index_thumbnail'];
|
|
|
60
|
- foreach($res_month['category_name'] as $value1){
|
|
|
61
|
- if($value['id'] == $value1['post_id']){
|
|
|
62
|
- $month[$value['month']]['category_name'] = $value1['name'];
|
60
|
+ $month = cache('res_month');
|
|
|
61
|
+ if(!$month){
|
|
|
62
|
+ $res_month = $this->getMonthArticle();
|
|
|
63
|
+ $month = [];
|
|
|
64
|
+ foreach($res_month['data'] as &$value){
|
|
|
65
|
+ $month[$value['month']]['id'] = $value['id'];
|
|
|
66
|
+ $month[$value['month']]['month'] = $value['month'];
|
|
|
67
|
+ $month[$value['month']]['post_title'] = $value['post_title'];
|
|
|
68
|
+ $month[$value['month']]['index_thumbnail'] = $value['index_thumbnail'];
|
|
|
69
|
+ foreach($res_month['category_name'] as $value1){
|
|
|
70
|
+ if($value['id'] == $value1['post_id']){
|
|
|
71
|
+ $month[$value['month']]['category_name'] = $value1['name'];
|
|
|
72
|
+ }
|
63
|
}
|
73
|
}
|
64
|
}
|
74
|
}
|
|
|
75
|
+ cache('res_month', $month,86400);//有效期一天
|
65
|
}
|
76
|
}
|
66
|
$this->assign('res_month',$month);
|
77
|
$this->assign('res_month',$month);
|
67
|
|
78
|
|
68
|
//星域秀场->星球影院
|
79
|
//星域秀场->星球影院
|
69
|
- $position = CityCategoryModel::xqyy;
|
|
|
70
|
- $field = 'id,more,thumbnail';
|
|
|
71
|
- $res_xqyy = $this->getChildArticle($position,$field,1);
|
|
|
72
|
- foreach($res_xqyy as &$value){
|
|
|
73
|
- $video = json_decode($value['more'],true);
|
|
|
74
|
- $value['video'] = $video['video'];
|
|
|
75
|
- }
|
|
|
76
|
- if($res_xqyy){
|
|
|
77
|
- $res_xqyy = $res_xqyy[0];
|
80
|
+ $res_xqyy = cache('res_xqyy');
|
|
|
81
|
+ if(!$res_xqyy){
|
|
|
82
|
+ $position = CityCategoryModel::xqyy;
|
|
|
83
|
+ $field = 'id,more,thumbnail';
|
|
|
84
|
+ $res_xqyy = $this->getChildArticle($position,$field,1);
|
|
|
85
|
+ foreach($res_xqyy as &$value){
|
|
|
86
|
+ $video = json_decode($value['more'],true);
|
|
|
87
|
+ $value['video'] = $video['video'];
|
|
|
88
|
+ }
|
|
|
89
|
+ if($res_xqyy){
|
|
|
90
|
+ $res_xqyy = $res_xqyy[0];
|
|
|
91
|
+ }
|
|
|
92
|
+ cache('res_xqyy', $res_xqyy,86400);//有效期一天
|
78
|
}
|
93
|
}
|
79
|
$this->assign('res_xqyy',$res_xqyy);
|
94
|
$this->assign('res_xqyy',$res_xqyy);
|
80
|
|
95
|
|
|
@@ -93,33 +108,49 @@ class IndexController extends HomeBaseController |
|
@@ -93,33 +108,49 @@ class IndexController extends HomeBaseController |
93
|
$this->assign('res_djxq',$res_djxq);
|
108
|
$this->assign('res_djxq',$res_djxq);
|
94
|
|
109
|
|
95
|
//星域秀场->明星访谈
|
110
|
//星域秀场->明星访谈
|
96
|
- $position = CityCategoryModel::mxft;
|
|
|
97
|
- $field = 'id,full_name,position,trade,post_excerpt,thumbnail avatar';
|
|
|
98
|
- $res_mxft = $this->getChildArticle($position,$field,1);
|
|
|
99
|
- if($res_mxft){
|
|
|
100
|
- $res_mxft = $res_mxft[0];
|
111
|
+ $res_mxft = cache('res_mxft');
|
|
|
112
|
+ if(!$res_mxft){
|
|
|
113
|
+ $position = CityCategoryModel::mxft;
|
|
|
114
|
+ $field = 'id,full_name,position,trade,post_excerpt,thumbnail avatar';
|
|
|
115
|
+ $res_mxft = $this->getChildArticle($position,$field,1);
|
|
|
116
|
+ if($res_mxft){
|
|
|
117
|
+ $res_mxft = $res_mxft[0];
|
|
|
118
|
+ }
|
|
|
119
|
+ cache('res_mxft',$res_mxft,86400);
|
101
|
}
|
120
|
}
|
102
|
$this->assign('res_mxft',$res_mxft);
|
121
|
$this->assign('res_mxft',$res_mxft);
|
103
|
|
122
|
|
104
|
|
123
|
|
105
|
//星域秀场->星域画廊
|
124
|
//星域秀场->星域画廊
|
106
|
- $position = CityCategoryModel::xyhl;
|
|
|
107
|
- $field = 'id,thumbnail';
|
|
|
108
|
- $res_xyhl = $this->getChildArticle($position,$field,16);
|
125
|
+ $res_xyhl = cache('res_xyhl');
|
|
|
126
|
+ if(!$res_xyhl){
|
|
|
127
|
+ $position = CityCategoryModel::xyhl;
|
|
|
128
|
+ $field = 'id,thumbnail';
|
|
|
129
|
+ $res_xyhl = $this->getChildArticle($position,$field,16);
|
|
|
130
|
+ cache('res_xyhl',$res_xyhl,86400);
|
|
|
131
|
+ }
|
109
|
$this->assign('res_xyhl',$res_xyhl);
|
132
|
$this->assign('res_xyhl',$res_xyhl);
|
110
|
|
133
|
|
111
|
|
134
|
|
112
|
//星探推荐
|
135
|
//星探推荐
|
113
|
- $position = CityCategoryModel::xttj;
|
|
|
114
|
- $field = 'id,post_title,price,index_thumbnail,place';
|
|
|
115
|
- $res_xttj = $this->getParentArticle($position,$field,16);
|
136
|
+ $res_xttj = cache('res_xttj');
|
|
|
137
|
+ if(!$res_xttj){
|
|
|
138
|
+ $position = CityCategoryModel::xttj;
|
|
|
139
|
+ $field = 'id,post_title,price,index_thumbnail,place';
|
|
|
140
|
+ $res_xttj = $this->getParentArticle($position,$field,16);
|
|
|
141
|
+ cache('res_xttj',$res_xttj,86400);
|
|
|
142
|
+ }
|
116
|
$this->assign('res_xttj',$res_xttj);
|
143
|
$this->assign('res_xttj',$res_xttj);
|
117
|
|
144
|
|
118
|
|
145
|
|
119
|
//星际活动
|
146
|
//星际活动
|
120
|
- $position = CityCategoryModel::xjhd;
|
|
|
121
|
- $field = 'id,post_title,thumbnail';
|
|
|
122
|
- $res_xjhd = $this->getParentArticle($position,$field,2);
|
147
|
+ $res_xjhd = cache('res_xjhd');
|
|
|
148
|
+ if(!$res_xjhd){
|
|
|
149
|
+ $position = CityCategoryModel::xjhd;
|
|
|
150
|
+ $field = 'id,post_title,thumbnail';
|
|
|
151
|
+ $res_xjhd = $this->getParentArticle($position,$field,2);
|
|
|
152
|
+ cache('res_xjhd',$res_xjhd,86400);
|
|
|
153
|
+ }
|
123
|
$this->assign('res_xjhd',$res_xjhd);
|
154
|
$this->assign('res_xjhd',$res_xjhd);
|
124
|
return $this->fetch();
|
155
|
return $this->fetch();
|
125
|
}
|
156
|
}
|