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

修改后台添加城市的权重,是否显示等 页面bug

@@ -120,6 +120,7 @@ class EnjoyController extends HomeBaseController @@ -120,6 +120,7 @@ class EnjoyController extends HomeBaseController
120 $res = Db::name('city_category') 120 $res = Db::name('city_category')
121 ->where('pid','<>',0) 121 ->where('pid','<>',0)
122 ->where('id','<>',CityCategoryModel::xqgh_cc) 122 ->where('id','<>',CityCategoryModel::xqgh_cc)
  123 + ->where('id','<>',CityCategoryModel::djxq)
123 ->where('delete_time',0) 124 ->where('delete_time',0)
124 ->field('id,name')->select()->toArray(); 125 ->field('id,name')->select()->toArray();
125 return $res; 126 return $res;
@@ -65,6 +65,20 @@ class IndexController extends HomeBaseController @@ -65,6 +65,20 @@ class IndexController extends HomeBaseController
65 } 65 }
66 $this->assign('res_xqyy',$res_xqyy); 66 $this->assign('res_xqyy',$res_xqyy);
67 67
  68 + //推广视频
  69 + $position = CityCategoryModel::xqyy;
  70 + $city_id = CityCategoryModel::djxq;
  71 + $field = 'id,more,thumbnail';
  72 + $res_djxq = $this->getVideo($position,$city_id,$field,1);
  73 + foreach($res_djxq as &$value){
  74 + $video = json_decode($value['more'],true);
  75 + $value['video'] = $video['video'];
  76 + }
  77 + if($res_djxq){
  78 + $res_djxq = $res_djxq[0];
  79 + }
  80 + $this->assign('res_djxq',$res_djxq);
  81 +
68 //星域秀场->明星访谈 82 //星域秀场->明星访谈
69 $position = CityCategoryModel::mxft; 83 $position = CityCategoryModel::mxft;
70 $field = 'id,full_name,position,trade,post_excerpt,thumbnail avatar'; 84 $field = 'id,full_name,position,trade,post_excerpt,thumbnail avatar';
@@ -148,13 +162,38 @@ class IndexController extends HomeBaseController @@ -148,13 +162,38 @@ class IndexController extends HomeBaseController
148 return $res; 162 return $res;
149 } 163 }
150 164
  165 + //获取推荐视频
  166 + public function getVideo($position,$city_id,$field,$limit=''){
  167 + $pre = CityCategoryModel::pre;
  168 + $limit = empty($limit)?0:$limit;
  169 + $post_id = Db::table($pre.'portal_category_post')
  170 + ->whereIn('category_id',$position)
  171 + ->field('post_id')
  172 + ->select()
  173 + ->toArray();
  174 + $post_id = array_column($post_id,'post_id');
  175 + //查询文章
  176 + $res = Db::table($pre.'portal_post')
  177 + ->whereIn('id',$post_id)
  178 + ->where('city_id', $city_id)
  179 + ->where('delete_time', 0)
  180 + ->field($field)
  181 + ->limit($limit)
  182 + ->order('weigh desc')
  183 + ->select()
  184 + ->toArray();
  185 + return $res;
  186 + }
  187 +
151 //获取各洲对应的城市 188 //获取各洲对应的城市
152 private function getCity($pid){ 189 private function getCity($pid){
153 $pre = CityCategoryModel::pre; 190 $pre = CityCategoryModel::pre;
154 $res = Db::table($pre.'city_category') 191 $res = Db::table($pre.'city_category')
155 ->where('pid',$pid) 192 ->where('pid',$pid)
  193 + ->where('is_show',1)
156 ->where('delete_time', 0) 194 ->where('delete_time', 0)
157 ->field('id,pid,name') 195 ->field('id,pid,name')
  196 + ->order('weigh desc')
158 ->select() 197 ->select()
159 ->toArray(); 198 ->toArray();
160 return $res; 199 return $res;
@@ -54,6 +54,7 @@ class CityCategoryModel extends Model @@ -54,6 +54,7 @@ class CityCategoryModel extends Model
54 54
55 //城市 55 //城市
56 const xqgh_cc = 65;//星球故事 56 const xqgh_cc = 65;//星球故事
  57 + const djxq = 68;//独角星球
57 58
58 //五大洲 59 //五大洲
59 const asia = 1;//亚洲 60 const asia = 1;//亚洲
@@ -47,6 +47,20 @@ @@ -47,6 +47,20 @@
47 </div> 47 </div>
48 <span class="form-required">图片参考尺寸:1920*666</span> 48 <span class="form-required">图片参考尺寸:1920*666</span>
49 </div> 49 </div>
  50 + <div class="form-group">
  51 + <label for="input-name">是否显示</label>
  52 + <div>
  53 + 是:<input class="" type="radio" name="is_show" value="1" checked/>
  54 + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  55 + 否:<input class="" type="radio" name="is_show" value="0"/>
  56 + </div>
  57 + </div>
  58 + <div class="form-group">
  59 + <label for="input-name">权重</label>
  60 + <div>
  61 + <input type="number" class="form-control" id="input-weigh" name="weigh" value="0">
  62 + </div>
  63 + </div>
50 64
51 </div> 65 </div>
52 </div> 66 </div>
@@ -52,6 +52,20 @@ @@ -52,6 +52,20 @@
52 </div> 52 </div>
53 <span class="form-required">图片参考尺寸:1920*666</span> 53 <span class="form-required">图片参考尺寸:1920*666</span>
54 </div> 54 </div>
  55 + <div class="form-group">
  56 + <label for="input-name">是否显示</label>
  57 + <div>
  58 + 是:<input class="" type="radio" name="is_show" value="1" <eq name="1" value="$category_name.is_show">checked</eq>/>
  59 + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  60 + 否:<input class="" type="radio" name="is_show" value="0" <eq name="0" value="$category_name.is_show">checked</eq>/>
  61 + </div>
  62 + </div>
  63 + <div class="form-group">
  64 + <label for="input-name">权重</label>
  65 + <div>
  66 + <input type="number" class="form-control" id="input-weigh" name="weigh" value="{$category_name.weigh}">
  67 + </div>
  68 + </div>
55 69
56 </div> 70 </div>
57 </div> 71 </div>
@@ -31,6 +31,8 @@ @@ -31,6 +31,8 @@
31 <th width="200">ID</th> 31 <th width="200">ID</th>
32 <th width="400">分类名称</th> 32 <th width="400">分类名称</th>
33 <th>banner图</th> 33 <th>banner图</th>
  34 + <th>是否显示</th>
  35 + <th width="200">权重</th>
34 <th width="210">操作</th> 36 <th width="210">操作</th>
35 </tr> 37 </tr>
36 </thead> 38 </thead>
@@ -48,6 +50,20 @@ @@ -48,6 +50,20 @@
48 </notempty> 50 </notempty>
49 </td> 51 </td>
50 <td> 52 <td>
  53 + <notempty name="vo.is_show">
  54 + <span class="label label-success">
  55 + 显示
  56 + </span>
  57 + <else/>
  58 + <span class="label label-default">
  59 + 隐藏
  60 + </span>
  61 + </notempty>
  62 + </td>
  63 + <td>
  64 + <b>{$vo.weigh}</b>
  65 + </td>
  66 + <td>
51 <a class="btn btn-xs btn-primary" href="{:url('AdminCityCategory/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a> 67 <a class="btn btn-xs btn-primary" href="{:url('AdminCityCategory/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
52 <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminCityCategory/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a> 68 <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminCityCategory/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
53 </td> 69 </td>
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 <!-- 头部 --> 44 <!-- 头部 -->
45 <div class="show_main_Tit clearfix"> 45 <div class="show_main_Tit clearfix">
46 <h1>{$res.post_title}</h1> 46 <h1>{$res.post_title}</h1>
47 - <p>{$res.create_time|date="Y-m-d",###}</p> 47 + <!--<p>{$res.create_time|date="Y-m-d",###}</p>-->
48 </div> 48 </div>
49 <!-- 文字内容 --> 49 <!-- 文字内容 -->
50 <div class="show_main_txt"> 50 <div class="show_main_txt">
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 /*width: 625px;*/ 14 /*width: 625px;*/
15 /*height: 648px;*/ 15 /*height: 648px;*/
16 /*}*/ 16 /*}*/
17 - .Spot_items, .swiper-slide-prev, .swiper-slide-prev .Spot_item img { 17 + .Walker_main .Spot_items,.Walker_main .swiper-slide-prev,.Walker_main .swiper-slide-prev .Spot_item img {
18 max-width: 1200px; 18 max-width: 1200px;
19 } 19 }
20 .Spot_main .swiper-slide-next .Spot_top img { 20 .Spot_main .swiper-slide-next .Spot_top img {
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 <div class="outdoors"> 31 <div class="outdoors">
32 <div class="outdoors_title clearfix"> 32 <div class="outdoors_title clearfix">
33 <div class="outdoors_title_left fl">{$res.post_title}</div> 33 <div class="outdoors_title_left fl">{$res.post_title}</div>
34 - <div class="outdoors_title_right fr">{$res.create_time|date="Y-m-d",###}</div> 34 + <!--<div class="outdoors_title_right fr">{$res.create_time|date="Y-m-d",###}</div>-->
35 </div> 35 </div>
36 <div class="outdoors_text"> 36 <div class="outdoors_text">
37 {$res.post_content} 37 {$res.post_content}
@@ -44,12 +44,15 @@ @@ -44,12 +44,15 @@
44 margin: auto; 44 margin: auto;
45 display: block; 45 display: block;
46 height: 100%; 46 height: 100%;
  47 + width: 100%;
47 } 48 }
48 .mask_video img { 49 .mask_video img {
  50 + width: 30px;
  51 + height: 30px;
49 cursor: pointer; 52 cursor: pointer;
50 position: absolute; 53 position: absolute;
51 - right: -100px;  
52 - top: -30px; 54 + right: -25px;
  55 + top: -27px;
53 } 56 }
54 </style> 57 </style>
55 </head> 58 </head>
@@ -59,7 +62,7 @@ @@ -59,7 +62,7 @@
59 <div class="mask" id="mask"> 62 <div class="mask" id="mask">
60 <div class="mask_video" > 63 <div class="mask_video" >
61 <img id="nos" src="__TMPL__/public/assets/starImg/nos.png" alt=""> 64 <img id="nos" src="__TMPL__/public/assets/starImg/nos.png" alt="">
62 - <video id="video2" src="http://xingqiu.qiniu.brotop.cn/portal/20190513/79713d2ec80f05fcaea36c685494c86b.mp4?e=1558360608&token=UjVH2DxMRL57-Lx4-JFaELCh7icERqJ1NxWf6smj:BgYec03rGPUNK7FcCld3qgrLMk0=&attname=Greenland+-+Rough.+Real+Remote..mp4"></video> 65 + <video id="video2" src="{:cmf_get_file_download_url($res_djxq.video)}"></video>
63 </div> 66 </div>
64 </div> 67 </div>
65 <!-- 侧边 --> 68 <!-- 侧边 -->
@@ -91,10 +94,10 @@ @@ -91,10 +94,10 @@
91 <!-- 首页主体内容 --> 94 <!-- 首页主体内容 -->
92 <div id="star_main"> 95 <div id="star_main">
93 <!-- 星球奇境 --> 96 <!-- 星球奇境 -->
94 - <div class="star_happy" id="star"> 97 + <div class="star_happy">
95 <div> 98 <div>
96 <span class="happy_title clearfix"> 99 <span class="happy_title clearfix">
97 - <p>星球<i>奇境</i></p> 100 + <p id="star">星球<i>奇境</i></p>
98 <p>PLANET DISCOVERY</p> 101 <p>PLANET DISCOVERY</p>
99 </span> 102 </span>
100 <em class="north clearfix"> 103 <em class="north clearfix">
@@ -668,6 +671,14 @@ @@ -668,6 +671,14 @@
668 </notempty> 671 </notempty>
669 <img onclick="bofang()" class="show_in_banner2" src="__TMPL__/public/assets/starImg/aicon_30.png" alt=""> 672 <img onclick="bofang()" class="show_in_banner2" src="__TMPL__/public/assets/starImg/aicon_30.png" alt="">
670 </div> 673 </div>
  674 + <!-- 更多按钮 -->
  675 + <div class="star_gall_more">
  676 + <a href="/portal/region/getMoreVideo">MORE+</a>
  677 + </div>
  678 +
  679 +
  680 +
  681 +
671 <!-- 人物简介 --> 682 <!-- 人物简介 -->
672 <notempty name="res_mxft"> 683 <notempty name="res_mxft">
673 <!-- 标题 --> 684 <!-- 标题 -->
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <!-- 头部 --> 35 <!-- 头部 -->
36 <div class="show_main_Tit clearfix"> 36 <div class="show_main_Tit clearfix">
37 <h1>{$res.post_title}</h1> 37 <h1>{$res.post_title}</h1>
38 - <p>{$res.create_time|date="Y-m-d",###}</p> 38 + <!--<p>{$res.create_time|date="Y-m-d",###}</p>-->
39 </div> 39 </div>
40 <!-- 文字内容 --> 40 <!-- 文字内容 -->
41 <div class="show_main_txt"> 41 <div class="show_main_txt">
@@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
23 23
24 <body> 24 <body>
25 <include file="public@header"/> 25 <include file="public@header"/>
  26 +
26 <!-- 弹出框 --> 27 <!-- 弹出框 -->
27 <div class="mask"> 28 <div class="mask">
28 </div> 29 </div>
@@ -108,29 +109,32 @@ @@ -108,29 +109,32 @@
108 $('video').bind('contextmenu', function() { 109 $('video').bind('contextmenu', function() {
109 return false; 110 return false;
110 }); 111 });
111 -  
112 - //监听播放时间  
113 - var video = document.getElementById('video');  
114 -  
115 - //使用事件监听方式捕捉事件  
116 - video.addEventListener("timeupdate", function() {  
117 - var timeDisplay;  
118 -//用秒数来显示当前播放进度  
119 - timeDisplay = Math.floor(video.currentTime);  
120 - console.log(Math.floor(video.currentTime));  
121 - video.addEventListener('play', function() {  
122 - video.currentTime = 0;  
123 - });  
124 -//当视频播放到 15s的时候做处理  
125 -  
126 - if (timeDisplay >= 5) { 112 + //登录
  113 + var users = $('#users').val();
  114 + if(users == 0){
  115 + //监听播放时间
  116 + video_mask('您还不是VIP,可试看20秒');
  117 + var video = document.getElementById('video');
  118 +
  119 + //使用事件监听方式捕捉事件
  120 + video.addEventListener("timeupdate", function() {
  121 + var timeDisplay;
  122 + //用秒数来显示当前播放进度
  123 + timeDisplay = Math.floor(video.currentTime);
  124 + console.log(Math.floor(video.currentTime));
127 video.addEventListener('play', function() { 125 video.addEventListener('play', function() {
128 video.currentTime = 0; 126 video.currentTime = 0;
129 - }),  
130 - video_mask('1111');  
131 - video.pause();  
132 - }  
133 - }, false); 127 + });
  128 + //当视频播放到 15s的时候做处理
  129 + if (timeDisplay >= 20) {
  130 + video.addEventListener('play', function() {
  131 + video.currentTime = 0;
  132 + }),
  133 + video_mask('会员可观看完整视频');
  134 + video.pause();
  135 + }
  136 + }, false);
  137 + }
134 //默认第一个视频 138 //默认第一个视频
135 switch_video(0); 139 switch_video(0);
136 var value = $('#cityName').val(); 140 var value = $('#cityName').val();
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <!-- 内容一 --> 21 <!-- 内容一 -->
22 <div class="show_4_con1"> 22 <div class="show_4_con1">
23 <h1>{$res.post_title}</h1> 23 <h1>{$res.post_title}</h1>
24 - <span>{$res.create_time|date="Y-m-d",###}</span> 24 + <!--<span>{$res.create_time|date="Y-m-d",###}</span>-->
25 <img src="{:cmf_get_image_url($res.image_url)}" alt=""> 25 <img src="{:cmf_get_image_url($res.image_url)}" alt="">
26 <div class="show_4_txt"> 26 <div class="show_4_txt">
27 {$res.post_content} 27 {$res.post_content}
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 <div class="show6_con_top2"> 27 <div class="show6_con_top2">
28 <h1>{$res.full_name}</h1> 28 <h1>{$res.full_name}</h1>
29 <h2></h2> 29 <h2></h2>
30 - <span>{$res.create_time|date="Y-m-d",###}</span> 30 + <!--<span>{$res.create_time|date="Y-m-d",###}</span>-->
31 <p class="show6_con_top3"> 31 <p class="show6_con_top3">
32 {$res.post_excerpt} 32 {$res.post_excerpt}
33 </p> 33 </p>
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 <div class="show6_con_top2"> 27 <div class="show6_con_top2">
28 <h1>{$res.full_name}</h1> 28 <h1>{$res.full_name}</h1>
29 <h2>{$res.position} {$res.trade}</h2> 29 <h2>{$res.position} {$res.trade}</h2>
30 - <span>{$res.create_time|date="Y-m-d",###}</span> 30 + <!--<span>{$res.create_time|date="Y-m-d",###}</span>-->
31 <p class="show6_con_top3"> 31 <p class="show6_con_top3">
32 {$res.post_excerpt} 32 {$res.post_excerpt}
33 </p> 33 </p>
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 <!-- 头部 --> 27 <!-- 头部 -->
28 <div class="show_main_Tit clearfix"> 28 <div class="show_main_Tit clearfix">
29 <h1>{$res.post_title}</h1> 29 <h1>{$res.post_title}</h1>
30 - <p>{$res.create_time|date="Y-m-d",###}</p> 30 + <!--<p>{$res.create_time|date="Y-m-d",###}</p>-->
31 </div> 31 </div>
32 <!-- 文字内容 --> 32 <!-- 文字内容 -->
33 <div class="show_main_txt"> 33 <div class="show_main_txt">
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 <!-- 头部 --> 27 <!-- 头部 -->
28 <div class="show_main_Tit clearfix"> 28 <div class="show_main_Tit clearfix">
29 <h1>{$res.post_title}</h1> 29 <h1>{$res.post_title}</h1>
30 - <p>{$res.create_time|date="Y-m-d",###}</p> 30 + <!--<p>{$res.create_time|date="Y-m-d",###}</p>-->
31 </div> 31 </div>
32 <!-- 文字内容 --> 32 <!-- 文字内容 -->
33 <div class="show_main_txt"> 33 <div class="show_main_txt">
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 <!-- 内容 --> 37 <!-- 内容 -->
38 <div class="show_INMain_con2_2 show_5_swiper"> 38 <div class="show_INMain_con2_2 show_5_swiper">
39 <div > 39 <div >
40 - <div c> 40 + <div>
41 <div class="show_index_con2Txt clearfix"> 41 <div class="show_index_con2Txt clearfix">
42 <!-- 左侧图片 --> 42 <!-- 左侧图片 -->
43 <img class="show_indexImg1" src="{:cmf_get_image_url($res.thumbnail)}" alt=""> 43 <img class="show_indexImg1" src="{:cmf_get_image_url($res.thumbnail)}" alt="">
1 .mask{ 1 .mask{
2 position:fixed; 2 position:fixed;
3 /*left: 44%;*/ 3 /*left: 44%;*/
4 - top: 40%;  
5 - left: 50%;  
6 - transform: translate(-50%,-50%);  
7 - -webkit-transform: translate(-50%,-50%);  
8 - -o-transform: translate(-50%,-50%);  
9 - -moz-transform: translate(-50%,-50%);  
10 - -ms-transform: translate(-50%,-50%); 4 + top: 52%;
  5 + left: 45%;
  6 + transform: translate(-52%,-45%);
  7 + -webkit-transform: translate(-52%,-45%);
  8 + -o-transform: translate(-52%,-45%);
  9 + -moz-transform: translate(-52%,-45%);
  10 + -ms-transform: translate(-52%,-45%);
11 display: none; 11 display: none;
12 /*top: 300px;*/ 12 /*top: 300px;*/
13 padding: 24px 32px; 13 padding: 24px 32px;
@@ -182,7 +182,7 @@ function video_mask(msg) { @@ -182,7 +182,7 @@ function video_mask(msg) {
182 setTimeout(function(){ 182 setTimeout(function(){
183 $('.mask').hide(); 183 $('.mask').hide();
184 $('.mask').text(''); 184 $('.mask').text('');
185 - },4000); 185 + },6000);
186 } 186 }
187 187
188 //获取url的参数 188 //获取url的参数