|
@@ -195,4 +195,21 @@ class Tvindex extends Api
|
|
|
$this->success('', $data);
|
|
|
}
|
|
|
|
|
|
+ //搜索页
|
|
|
+ public function search(){
|
|
|
+ $keyword = input('keyword','');
|
|
|
+
|
|
|
+ //热门推荐4个
|
|
|
+ if(empty($keyword)){
|
|
|
+ $list = Db::name('video')->field('id, title, image, is_pay')->where(['status' => 1, 'inject_status' => 2])
|
|
|
+ ->orderRaw('rand()')->limit(12)->select();
|
|
|
+ $list = list_domain_image($list, ['image']);
|
|
|
+ }else{
|
|
|
+ $list = Db::name('video')->field('id, title, image, is_pay')->where(['status' => 1, 'inject_status' => 2])->where('search_title','LIKE','%'.$keyword.'%')->order('is_pay asc,weigh asc,id desc')->select();
|
|
|
+ $list = list_domain_image($list, ['image']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('视频', $list);
|
|
|
+ }
|
|
|
+
|
|
|
}
|