Browse Source

精彩专题

lizhen_gitee 9 months ago
parent
commit
c7fa10356d
2 changed files with 22 additions and 0 deletions
  1. 13 0
      application/api/controller/Tvindex.php
  2. 9 0
      application/common/controller/Api.php

+ 13 - 0
application/api/controller/Tvindex.php

@@ -175,4 +175,17 @@ class Tvindex extends Api
         $this->success('详情', $result);
     }
 
+    //专题页
+    public function zhuanti(){
+        $type_id = input('type_id', 0, 'intval'); //分类id
+        if (!$type_id) {
+            $this->error('您的网络开小差了~');
+        }
+
+        $list = Db::name('video')->field('id, title, image, is_pay, status, inject_status, seriesid, programid, movieid')->where(['video_type_id' => $type_id, 'status' => 1, 'inject_status' => 2])->order('weigh asc, id desc')->limit(5)->select();
+
+        $list = list_domain_image($list, ['image']);
+        $this->success('视频', $list);
+    }
+
 }

+ 9 - 0
application/common/controller/Api.php

@@ -205,6 +205,12 @@ class Api
      */
     protected function success($msg = '', $data = null, $code = 1, $type = null, array $header = [])
     {
+        if($msg == 1){
+            $msg = 'success';
+        }
+        if(empty($msg)){
+            $msg = '操作成功';
+        }
         $this->result($msg, $data, $code, $type, $header);
     }
 
@@ -218,6 +224,9 @@ class Api
      */
     protected function error($msg = '', $data = null, $code = 0, $type = null, array $header = [])
     {
+        if(empty($msg)){
+            $msg = __('Invalid parameters');
+        }
         $this->result($msg, $data, $code, $type, $header);
     }