Przeglądaj źródła

首页图文功能

lizhen_gitee 8 miesięcy temu
rodzic
commit
093e7f7486
1 zmienionych plików z 35 dodań i 1 usunięć
  1. 35 1
      application/api/controller/Tvindex.php

+ 35 - 1
application/api/controller/Tvindex.php

@@ -7,7 +7,7 @@ use think\Db;
 use Redis;
 class Tvindex extends Api
 {
-    protected $noNeedLogin = ['indexdata','video_list','videoinfo','videoinfo_simple','zhuanti','tudingc','search','history','app_error'];
+    protected $noNeedLogin = ['indexdata','video_list','videoinfo','image_childcate','image_list','videoinfo_simple','zhuanti','tudingc','search','history','app_error'];
     protected $noNeedRight = '*';
 
     //首页
@@ -67,6 +67,12 @@ class Tvindex extends Api
         }
         $data['video_cate'] = $video_cate;
 
+        //图片大分类+子类
+        $image_cate = Db::name('image_cate')->field('id,name,image')->where('status',1)->order('weigh asc, id desc')->select();
+        $image_cate = list_domain_image($image_cate, ['image']);
+
+        $data['image_cate'] = $image_cate;
+
         $this->success('首页',$data);
     }
 
@@ -643,6 +649,34 @@ class Tvindex extends Api
         $this->success('');
     }
 
+    //图片页
+    public function image_childcate(){
+        $cate_id = input('cate_id',0);
+        $childcate = Db::name('image_childcate')->field('id,cate_id,name')->where('cate_id',$cate_id)->where('status',1)->order('weigh asc,id desc')->select();
+
+        $image_list = [];
+        if(!empty($childcate)){
+            $childcate_id = $childcate[0]['id'];
+            $image_list = Db::name('image')->field('id,title,image')->where('childcate_id',$childcate_id)->where('status',1)->order('weigh asc,id desc')->select();
+            $image_list = list_domain_image($image_list,['image']);
+        }
+
+        $result = [
+            'childcate' => $childcate,
+            'image_list' => $image_list,
+        ];
+        $this->success(1,$result);
+    }
+
+    //图片列表
+    public function image_list(){
+        $childcate_id = input('child_id',0);
+        $image_list = Db::name('image')->field('id,title,image')->where('childcate_id',$childcate_id)->where('status',1)->order('weigh asc,id desc')->select();
+        $image_list = list_domain_image($image_list,['image']);
+
+        $this->success(1,$image_list);
+    }
+
     /** * * @param string $string 需要加密的字符串 * @param string $key 密钥 * @return string */
     private function encrypt($string, $key) {
 //        $key = substr(openssl_digest(openssl_digest($key, 'sha1', true), 'sha1', true), 0, 16);