Przeglądaj źródła

视频详情页重构

lizhen_gitee 8 miesięcy temu
rodzic
commit
722bec40db
1 zmienionych plików z 15 dodań i 10 usunięć
  1. 15 10
      application/api/controller/Tvindex.php

+ 15 - 10
application/api/controller/Tvindex.php

@@ -47,8 +47,8 @@ class Tvindex extends Api
 
         //大分类+剧集
         $video_cate = Db::name('video_cate')->field('id,name,showtype,is_zhuanti')->where('status',1)->order('weigh asc, id desc')->select();
-        $video_childcate = Db::name('video_childcate')->field('id, cate_id, name, image')->where('status',1)->order('weigh asc, id desc')->select();
-        $video_childcate = list_domain_image($video_childcate, ['image']);
+        $video_childcate = Db::name('video_childcate')->field('id, cate_id, name, image, bg_image')->where('status',1)->order('weigh asc, id desc')->select();
+        $video_childcate = list_domain_image($video_childcate, ['image','bg_image']);
 
         //分布:1=左一右四,2=两行八个,3=一行四个,4=一行三个
         foreach($video_cate as $key => $cate){
@@ -70,9 +70,9 @@ class Tvindex extends Api
         $this->success('首页',$data);
     }
 
-    //更多页
+    //更多页,应该是没用了
     //视频列表
-    public function video_list() {
+    /*public function video_list() {
         $type_id = input('type_id', 0, 'intval'); //分类id
         if (!$type_id) {
             $this->error('您的网络开小差了~');
@@ -89,18 +89,23 @@ class Tvindex extends Api
             'videolist' => $list,
         ];
         $this->success('视频更多', $result);
-    }
+    }*/
 
     //视频详情
     public function videoinfo() {
 
         $id = input('id', 0, 'intval'); //视频id
-        if (!$id) {
+        $childcate_id = input('child_id',0,'intval'); //子分类id
+        if (!$id && !$childcate_id) {
             $this->error('您的网络开小差了');
         }
-
-        $info = Db::name('video')->field('id,video_type_id, title, image, desc, is_pay, status, inject_status, seriesid, programid, movieid')
-            ->where(['id' => $id])->find();
+        if($id){
+            $info = Db::name('video')->field('id,video_type_id, title, image, desc, is_pay, status, inject_status, seriesid, programid, movieid')
+                ->where(['id' => $id])->find();
+        }else{
+            $info = Db::name('video')->field('id,video_type_id, title, image, desc, is_pay, status, inject_status, seriesid, programid, movieid')
+                ->where(['childcate_id' => $childcate_id])->where(['status'=>1,'inject_status'=>2])->order('weigh asc,id desc')->find();
+        }
         if (!$info) {
             $this->error('数据不存在');
         }
@@ -117,7 +122,7 @@ class Tvindex extends Api
 
         //剧集列表
         $juji = [];
-        $video_list = Db::name('video')->field('id, title, image, is_pay')->where(['video_type_id' => $info['video_type_id'], 'status' => 1, 'inject_status' => 2])
+        $video_list = Db::name('video')->field('id, title, image, is_pay')->where(['childcate_id' => $info['childcate_id'], 'status' => 1, 'inject_status' => 2])
             ->order('weigh asc, id desc')->select();
         if(!empty($video_list)){
             $video_list = list_domain_image($video_list, ['image']);