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

调试视频

@@ -165,9 +165,40 @@ class IndexController extends HomeBaseController @@ -165,9 +165,40 @@ class IndexController extends HomeBaseController
165 // cache('res_xjhd',$res_xjhd); 165 // cache('res_xjhd',$res_xjhd);
166 // } 166 // }
167 $this->assign('res_xjhd',$res_xjhd); 167 $this->assign('res_xjhd',$res_xjhd);
  168 + $_SESSION['xx_token'] = md5("123456");
168 return $this->fetch(); 169 return $this->fetch();
169 } 170 }
170 171
  172 + //根据id获取视频地址(以防止通过链接下载)
  173 + public function getVideoById(){
  174 + $id = $this->request->param('id');
  175 + $video_url = $this->getVideoId($id);
  176 + //页面直接输出视频
  177 + $filePath = 'http://xingqiu.qiniu.brotop.cn/'.$video_url;
  178 + ini_set('memory_limit', '512M');
  179 + header("Pragma: public");
  180 + header("Expires: 0");
  181 + header("Content-Type: application/octet-stream"); //文件mime类型
  182 + //header("Content-Disposition: attachment; filename=video11.mp4;" ); //文件名$filename
  183 + //header("Content-Length: 83995"); //文件大小$fsize
  184 + ob_clean();
  185 + flush();
  186 + //ob_end_clean();
  187 + @readfile($filePath);
  188 + }
  189 +
  190 + //根据id获取视频地址
  191 + public function getVideoId($id){
  192 + $res = Db::name('portal_post')
  193 + ->where('id',$id)
  194 + ->field('id,more')
  195 + ->find();
  196 + $video = json_decode($res['more'],true);
  197 + $video_url = $video['video'];
  198 + return $video_url;
  199 + }
  200 +
  201 +
171 //根据父类查询文章 202 //根据父类查询文章
172 public function getParentArticle($position,$field,$limit = ''){ 203 public function getParentArticle($position,$field,$limit = ''){
173 $pre = CityCategoryModel::pre; 204 $pre = CityCategoryModel::pre;
@@ -618,7 +618,7 @@ @@ -618,7 +618,7 @@
618 <!-- 视频 --> 618 <!-- 视频 -->
619 <notempty name="res_xqyy"> 619 <notempty name="res_xqyy">
620 <div class="video_bg"> 620 <div class="video_bg">
621 - <video id="video" width="100%" style="height:100%;" src="{:cmf_get_file_download_url($res_xqyy.video)}" controlslist="nodownload"></video> 621 + <video id="video" width="100%" style="height:100%;" src="/portal/index/getVideoById?id={$res_xqyy.id}" controlslist="nodownload"></video>
622 </div> 622 </div>
623 <!-- 封面 --> 623 <!-- 封面 -->
624 <div class="fm_IMG"> 624 <div class="fm_IMG">