|
@@ -33,6 +33,22 @@ class Video extends Api
|
|
|
$list = Db::name('video')->where($where)->order('weigh desc')->autopage()->select();
|
|
|
$list = list_domain_image($list,['video_file','video_image']);
|
|
|
|
|
|
+ if(!empty($list)){
|
|
|
+ if($this->auth->isLogin()){
|
|
|
+ $vidoe_ids = Db::name('video_good')->where('user_id',$this->auth->id)->column('video_id');
|
|
|
+ }else{
|
|
|
+ $vidoe_ids = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach($list as $key => &$val){
|
|
|
+ $val['is_good'] = 0;
|
|
|
+
|
|
|
+ if(in_array($val['id'],$vidoe_ids)){
|
|
|
+ $val['is_good'] = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$this->success('success',$list);
|
|
|
}
|
|
|
|
|
@@ -43,6 +59,14 @@ class Video extends Api
|
|
|
|
|
|
$info = Db::name('video')->where('id',$id)->find();
|
|
|
$info = info_domain_image($info,['video_file','video_image']);
|
|
|
+ $info['is_good'] = 0;
|
|
|
+
|
|
|
+ if($this->auth->isLogin()){
|
|
|
+ $is_good = Db::name('video_good')->where('user_id',$this->auth->id)->where('video_id',$id)->find();
|
|
|
+ if($is_good){
|
|
|
+ $info['is_good'] = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$this->success('success',$info);
|
|
|
}
|