作者 景龙
1 个管道 的构建 通过 耗费 0 秒

修改视频,首页数据缓存cache中

... ... @@ -11,7 +11,7 @@
return [
// 应用调试模式
'app_debug' => false,
'app_debug' => true,
// 应用Trace
'app_trace' => true,
... ...
... ... @@ -21,12 +21,17 @@ class IndexController extends HomeBaseController
$serverModel = new ServerController();
//统计访问量
$serverModel->statistics();
//banner轮播图
$coverImg = cache('coverImg');
if(!$coverImg){
$coverImg = $this->getCoverImg(CityCategoryModel::indexImg,3);
cache('coverImg',$coverImg,86400);
}
$this->assign('coverImg',$coverImg);
//星球奇境,城市分类
$city = cache('res_city');
if(!$city){
$city[1]['id'] = CityCategoryModel::asia;
$city[2]['id'] = CityCategoryModel::europe;
$city[3]['id'] = CityCategoryModel::africa;
... ... @@ -47,9 +52,13 @@ class IndexController extends HomeBaseController
}
}
}
cache('res_city', $city,86400);//有效期一天
}
$this->assign('res_city',$city);
//星享体验
$month = cache('res_month');
if(!$month){
$res_month = $this->getMonthArticle();
$month = [];
foreach($res_month['data'] as &$value){
... ... @@ -63,9 +72,13 @@ class IndexController extends HomeBaseController
}
}
}
cache('res_month', $month,86400);//有效期一天
}
$this->assign('res_month',$month);
//星域秀场->星球影院
$res_xqyy = cache('res_xqyy');
if(!$res_xqyy){
$position = CityCategoryModel::xqyy;
$field = 'id,more,thumbnail';
$res_xqyy = $this->getChildArticle($position,$field,1);
... ... @@ -76,6 +89,8 @@ class IndexController extends HomeBaseController
if($res_xqyy){
$res_xqyy = $res_xqyy[0];
}
cache('res_xqyy', $res_xqyy,86400);//有效期一天
}
$this->assign('res_xqyy',$res_xqyy);
//推广视频
... ... @@ -93,33 +108,49 @@ class IndexController extends HomeBaseController
$this->assign('res_djxq',$res_djxq);
//星域秀场->明星访谈
$res_mxft = cache('res_mxft');
if(!$res_mxft){
$position = CityCategoryModel::mxft;
$field = 'id,full_name,position,trade,post_excerpt,thumbnail avatar';
$res_mxft = $this->getChildArticle($position,$field,1);
if($res_mxft){
$res_mxft = $res_mxft[0];
}
cache('res_mxft',$res_mxft,86400);
}
$this->assign('res_mxft',$res_mxft);
//星域秀场->星域画廊
$res_xyhl = cache('res_xyhl');
if(!$res_xyhl){
$position = CityCategoryModel::xyhl;
$field = 'id,thumbnail';
$res_xyhl = $this->getChildArticle($position,$field,16);
cache('res_xyhl',$res_xyhl,86400);
}
$this->assign('res_xyhl',$res_xyhl);
//星探推荐
$res_xttj = cache('res_xttj');
if(!$res_xttj){
$position = CityCategoryModel::xttj;
$field = 'id,post_title,price,index_thumbnail,place';
$res_xttj = $this->getParentArticle($position,$field,16);
cache('res_xttj',$res_xttj,86400);
}
$this->assign('res_xttj',$res_xttj);
//星际活动
$res_xjhd = cache('res_xjhd');
if(!$res_xjhd){
$position = CityCategoryModel::xjhd;
$field = 'id,post_title,thumbnail';
$res_xjhd = $this->getParentArticle($position,$field,2);
cache('res_xjhd',$res_xjhd,86400);
}
$this->assign('res_xjhd',$res_xjhd);
return $this->fetch();
}
... ...
... ... @@ -63,7 +63,7 @@
<div class="mask" id="mask">
<div class="mask_video" >
<img id="nos" src="__TMPL__/public/assets/starImg/nos.png" alt="">
<video autoplay="autoplay" controls id="video2" src="{:cmf_get_file_download_url($res_djxq.video)}" controlslist="nodownload"></video>
<video muted autoplay="autoplay" id="video2" src="{:cmf_get_file_download_url($res_djxq.video)}" controlslist="nodownload"></video>
</div>
</div>
</notempty>
... ... @@ -758,6 +758,7 @@
<div class="star_gall_img swiper-container">
<!-- 轮播图 -->
<ul class="swiper-wrapper">
<notempty name="res_xyhl">
<volist name="res_xyhl" id="vo">
<li class="swiper-slide">
<a href="/portal/region/getGalleryDetail?id={$vo.id}">
... ... @@ -765,6 +766,7 @@
</a>
</li>
</volist>
</notempty>
</ul>
<!-- 左右按钮 -->
<div class="swiper-button-next">
... ... @@ -794,6 +796,7 @@
<div class="star_gall_img swiper-container2">
<!-- 轮播图 -->
<ul class="swiper-wrapper">
<notempty name="res_xttj">
<volist name="res_xttj" id="vo">
<li class="swiper-slide scout_box">
<div class="scout_image">
... ... @@ -811,6 +814,7 @@
</a>
</li>
</volist>
</notempty>
</ul>
<!-- 左右按钮 -->
<div class="swiper-button-next2">
... ... @@ -858,14 +862,8 @@
<script>
// 弹框视频
$('.mask').css('display','block');
// var video2 = document.getElementById("video2"); //获取ID 
// console.log(video2);
// $(function() {
// if (video2.paused) { //判读是否播放    
// // video2.paused = false;            
// video2.play(); //没有就播放      
// }
// });
var video2 = document.getElementById("video2"); //获取ID 
var nos = document.getElementById("nos");
var mask = document.getElementById("mask");
... ...
... ... @@ -55,9 +55,9 @@
<!-- banner视频 -->
<div class="show_index_banner">
<notempty name="res_xqyy">
<video id="video" autoplay="autoplay" controls width="100%" height="660" src="{:cmf_get_file_download_url($res_xqyy.video)}" controlsList="nodownload"></video>
<video id="video" muted autoplay="autoplay" controls width="100%" height="660" src="{:cmf_get_file_download_url($res_xqyy.video)}" controlsList="nodownload"></video>
<else/>
<video id="video" autoplay="autoplay" controls width="100%" height="660" src="__TMPL__/public/assets/starImg/video.mp4" controlsList="nodownload"></video>
<video id="video" muted autoplay="autoplay" controls width="100%" height="660" src="__TMPL__/public/assets/starImg/video.mp4" controlsList="nodownload"></video>
</notempty>
<!-- poster="__TMPL__/public/assets/starImg/aicon_01.png" -->
<!-- <img onclick="bofang()" class="show_in_banner2" src="__TMPL__/public/assets/starImg/aicon_30.png" alt=""> -->
... ...