作者 jinglong
1 个管道 的构建 通过 耗费 4 秒

增加渲染封面图

@@ -20,6 +20,12 @@ class ActiveController extends HomeBaseController @@ -20,6 +20,12 @@ class ActiveController extends HomeBaseController
20 private $more_limit = 5;//更多列表分页 20 private $more_limit = 5;//更多列表分页
21 public function index(){ 21 public function index(){
22 //星际活动 22 //星际活动
  23 +
  24 + //封面图
  25 + $imgModel = new IndexController();
  26 + $coverImg = $imgModel->getCoverImg(CityCategoryModel::activeImg,1);
  27 + $this->assign('coverImg',$coverImg);
  28 +
23 $position['category_id'] = CityCategoryModel::xjhd_c; 29 $position['category_id'] = CityCategoryModel::xjhd_c;
24 $field = 'id,thumbnail,post_title'; 30 $field = 'id,thumbnail,post_title';
25 $res = $this->getChildArticlePage($position,$field); 31 $res = $this->getChildArticlePage($position,$field);
@@ -20,6 +20,12 @@ class EnjoyController extends HomeBaseController @@ -20,6 +20,12 @@ class EnjoyController extends HomeBaseController
20 private $more_limit = 8;//更多列表分页 20 private $more_limit = 8;//更多列表分页
21 public function index(){ 21 public function index(){
22 //按照城市查询 22 //按照城市查询
  23 +
  24 + //封面图
  25 + $imgModel = new IndexController();
  26 + $coverImg = $imgModel->getCoverImg(CityCategoryModel::enjoyImg,1);
  27 + $this->assign('coverImg',$coverImg);
  28 +
23 //默认澳大利亚 29 //默认澳大利亚
24 $city_id = $this->request->param('city_id',0,'intval'); 30 $city_id = $this->request->param('city_id',0,'intval');
25 $position['city_id'] = $city_id; 31 $position['city_id'] = $city_id;
@@ -21,6 +21,11 @@ class IndexController extends HomeBaseController @@ -21,6 +21,11 @@ class IndexController extends HomeBaseController
21 $serverModel = new ServerController(); 21 $serverModel = new ServerController();
22 //统计访问量 22 //统计访问量
23 $serverModel->statistics(); 23 $serverModel->statistics();
  24 +
  25 + //banner轮播图
  26 + $coverImg = $this->getCoverImg(CityCategoryModel::indexImg,3);
  27 + $this->assign('coverImg',$coverImg);
  28 +
24 //星球奇境,城市分类 29 //星球奇境,城市分类
25 $res['asia'] = $this->getCity(CityCategoryModel::asia); 30 $res['asia'] = $this->getCity(CityCategoryModel::asia);
26 $res['europe'] = $this->getCity(CityCategoryModel::europe); 31 $res['europe'] = $this->getCity(CityCategoryModel::europe);
@@ -155,6 +160,18 @@ class IndexController extends HomeBaseController @@ -155,6 +160,18 @@ class IndexController extends HomeBaseController
155 return $res; 160 return $res;
156 } 161 }
157 162
  163 + //获取封面图
  164 + public function getCoverImg($type,$limit){
  165 + $res = Db::name('image')
  166 + ->where(['type'=>$type])
  167 + ->field('id,image')
  168 + ->limit($limit)
  169 + ->order('weigh desc')
  170 + ->select()
  171 + ->toArray();
  172 + return $res;
  173 + }
  174 +
158 //根据月份查询文章(星享体验) 175 //根据月份查询文章(星享体验)
159 private function getMonthArticle($month){ 176 private function getMonthArticle($month){
160 $position = CityCategoryModel::xxty; 177 $position = CityCategoryModel::xxty;
@@ -211,6 +211,11 @@ class RegionController extends HomeBaseController @@ -211,6 +211,11 @@ class RegionController extends HomeBaseController
211 $res = $this->getChildArticlePage($position,$field,16); 211 $res = $this->getChildArticlePage($position,$field,16);
212 $this->assign('res',$res['data']); 212 $this->assign('res',$res['data']);
213 $this->assign('page',$res['page']); 213 $this->assign('page',$res['page']);
  214 +
  215 + //封面图
  216 + $imgModel = new IndexController();
  217 + $coverImg = $imgModel->getCoverImg(CityCategoryModel::galleryImg,1);
  218 + $this->assign('coverImg',$coverImg);
214 return $this->fetch(); 219 return $this->fetch();
215 } 220 }
216 221
@@ -18,6 +18,11 @@ class ScoutController extends HomeBaseController @@ -18,6 +18,11 @@ class ScoutController extends HomeBaseController
18 { 18 {
19 private $index_limit = 16;//首页分页 19 private $index_limit = 16;//首页分页
20 public function index(){ 20 public function index(){
  21 + //封面图
  22 + $imgModel = new IndexController();
  23 + $coverImg = $imgModel->getCoverImg(CityCategoryModel::scoutImg,1);
  24 + $this->assign('coverImg',$coverImg);
  25 +
21 //旅游路线 26 //旅游路线
22 $position['category_id'] = CityCategoryModel::lylx; 27 $position['category_id'] = CityCategoryModel::lylx;
23 $field = 'id,thumbnail,post_title'; 28 $field = 'id,thumbnail,post_title';
@@ -79,4 +79,10 @@ class CityCategoryModel extends Model @@ -79,4 +79,10 @@ class CityCategoryModel extends Model
79 const November = 11;//十一月份 79 const November = 11;//十一月份
80 const December = 12;//十二月份 80 const December = 12;//十二月份
81 81
  82 + //封面图分类
  83 + const indexImg = 1;//首页封面图
  84 + const galleryImg = 2;//星域秀场-星球画廊
  85 + const enjoyImg = 3;//星享体验封面图
  86 + const scoutImg = 4;//星探推荐封面图
  87 + const activeImg = 5;//星际活动封面图
82 } 88 }
@@ -22,7 +22,9 @@ @@ -22,7 +22,9 @@
22 <body> 22 <body>
23 <include file="public@header"/> 23 <include file="public@header"/>
24 <div class="banner"> 24 <div class="banner">
25 - <img src="__TMPL__/public/assets/starImg/bicon_01.png" alt=""> 25 + <volist name="coverImg" id="vo">
  26 + <img src="{:cmf_get_image_url($vo.image)}" alt="">
  27 + </volist>
26 </div> 28 </div>
27 <main> 29 <main>
28 <div class="container"> 30 <div class="container">
@@ -27,7 +27,9 @@ @@ -27,7 +27,9 @@
27 <body> 27 <body>
28 <include file="public@header"/> 28 <include file="public@header"/>
29 <div class="banner"> 29 <div class="banner">
30 - <img src="__TMPL__/public/assets/starImg/enjoy_banner.jpg" alt=""> 30 + <volist name="coverImg" id="vo">
  31 + <img src="{:cmf_get_image_url($vo.image)}" alt="">
  32 + </volist>
31 </div> 33 </div>
32 <main> 34 <main>
33 <div class="container"> 35 <div class="container">
@@ -36,15 +36,11 @@ @@ -36,15 +36,11 @@
36 <!-- banner --> 36 <!-- banner -->
37 <div id="banner" class="swiper-container6"> 37 <div id="banner" class="swiper-container6">
38 <div class="swiper-wrapper"> 38 <div class="swiper-wrapper">
39 - <div class="swiper-slide">  
40 - <img src="__TMPL__/public/assets/starImg/banner/1.jpg" alt="">  
41 - </div>  
42 - <div class="swiper-slide">  
43 - <img src="__TMPL__/public/assets/starImg/banner/2.jpg" alt="">  
44 - </div>  
45 - <div class="swiper-slide">  
46 - <img src="__TMPL__/public/assets/starImg/banner/3.jpg" alt="">  
47 - </div> 39 + <volist name="coverImg" id="vo">
  40 + <div class="swiper-slide">
  41 + <img src="{:cmf_get_image_url($vo.image)}" alt="">
  42 + </div>
  43 + </volist>
48 </div> 44 </div>
49 <div class="swiper-button-nextban"></div> 45 <div class="swiper-button-nextban"></div>
50 <div class="swiper-button-prevban"></div> 46 <div class="swiper-button-prevban"></div>
@@ -16,7 +16,9 @@ @@ -16,7 +16,9 @@
16 <div class="happy_gallery"> 16 <div class="happy_gallery">
17 <!-- banner --> 17 <!-- banner -->
18 <div class="happy_gallery_banner"> 18 <div class="happy_gallery_banner">
19 - <img src="__TMPL__/public/assets/starImg/aicon_01.png" alt=""> 19 + <volist name="coverImg" id="vo">
  20 + <img src="{:cmf_get_image_url($vo.image)}" alt="">
  21 + </volist>
20 </div> 22 </div>
21 <!-- 内容 --> 23 <!-- 内容 -->
22 <div class="happy_gallery_con"> 24 <div class="happy_gallery_con">
@@ -12,7 +12,9 @@ @@ -12,7 +12,9 @@
12 <body> 12 <body>
13 <include file="public@header"/> 13 <include file="public@header"/>
14 <div class="banner"> 14 <div class="banner">
15 - <img src="__TMPL__/public/assets/starImg/bicon_01.png" alt=""> 15 + <volist name="coverImg" id="vo">
  16 + <img src="{:cmf_get_image_url($vo.image)}" alt="">
  17 + </volist>
16 </div> 18 </div>
17 <main> 19 <main>
18 <div class="container"> 20 <div class="container">
1 .banner img { 1 .banner img {
2 width: 100%; 2 width: 100%;
3 - height: 666px; 3 + height: 100%;
4 } 4 }
5 5
6 main { 6 main {
7 - padding-top: 142px; 7 + padding-top: 100px;
8 padding-bottom: 150px; 8 padding-bottom: 150px;
9 box-sizing: border-box; 9 box-sizing: border-box;
10 } 10 }