|
@@ -788,46 +788,35 @@ class Video extends Base
|
|
|
$this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num)]);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @title 删除评论&&批量删除
|
|
|
- * @desc 删除评论
|
|
|
- * @author qc
|
|
|
- * @method POST
|
|
|
- * @url /api/Video/delComment
|
|
|
- * @header name:Authorization require:1 desc:Token
|
|
|
- * @param name:id type:int default:1 desc:评论id【多个用逗号隔开=>'1,2'】
|
|
|
- */
|
|
|
- public function delComment(){
|
|
|
- VideoComment::where(['user_id'=>$this->user_id])->where('id','in',input('post.id'))->update(['is_deleted'=>2]);
|
|
|
- $this->success('删除成功');
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
- * @title 点赞||取消点赞
|
|
|
+ * @title 点赞||取消点赞--可以批量
|
|
|
* @desc 点赞||取消点赞
|
|
|
* @author qc
|
|
|
* @method POST
|
|
|
* @url /api/Video/videoTags
|
|
|
* @header name:Authorization require:1 desc:Token
|
|
|
- * @param name:type type:int default:1 desc:1评论点赞,评论记录id,2平台视频点赞
|
|
|
- * @param name:like_id type:int default:1 desc:点赞id【二级评论不要这个功能】(平台视频点赞用video_arr的iD)
|
|
|
+ * @param name:type type:int default:1 desc:1评论点赞,2平台视频点赞
|
|
|
+ * @param name:like_id type:int default:1 desc:点赞id【多个逗号隔开】(平台视频点赞用video_arr的id或评论记录id或点赞记录的like_id)
|
|
|
* @return name:tags type:int default:1 desc:0取消成功,1点赞成功
|
|
|
*/
|
|
|
public function videoTags()
|
|
|
{
|
|
|
$type = input('post.type',1);
|
|
|
- $like_id = input('post.like_id');
|
|
|
+ $id = input('post.like_id');
|
|
|
$ret_val = 0;
|
|
|
- $check_tags = VideoCommentLike::where(['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type])->value('id');
|
|
|
- if($check_tags) {
|
|
|
- VideoCommentLike::where(['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type])->delete();
|
|
|
- if($type == 1) VideoComment::where('id',$like_id)->setDec('like_times');
|
|
|
- }else{
|
|
|
- Data::save('VideoCommentLike',
|
|
|
- ['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type],'user_id',
|
|
|
- ['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type]);
|
|
|
- $ret_val = 1;
|
|
|
- if($type == 1) VideoComment::where('id',$like_id)->setInc('like_times');
|
|
|
+ foreach ($id as $like_id) {
|
|
|
+ $check_tags = VideoCommentLike::where(['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type])->value('id');
|
|
|
+ if($check_tags) {
|
|
|
+ VideoCommentLike::where(['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type])->delete();
|
|
|
+ if($type == 1) VideoComment::where('id',$like_id)->setDec('like_times');
|
|
|
+ }else{
|
|
|
+ Data::save('VideoCommentLike',
|
|
|
+ ['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type],'user_id',
|
|
|
+ ['user_id'=>$this->user_id,'like_id'=>$like_id,'type'=>$type]);
|
|
|
+ $ret_val = 1;
|
|
|
+ if($type == 1) VideoComment::where('id',$like_id)->setInc('like_times');
|
|
|
+ }
|
|
|
}
|
|
|
$this->success($ret_val == 1 ?'点赞成功':'取消成功',['tags'=>$ret_val]);
|
|
|
}
|
|
@@ -958,18 +947,16 @@ class Video extends Base
|
|
|
|
|
|
// 点赞我的
|
|
|
$all_video = VideoUrl::where('user_id',$this->user_id)->where('is_deleted',0)->column('id');
|
|
|
- $video_praise_num = VideoCommentLike::where([['type','=',2],['is_read','=',0],['url_id','in',$all_video]])->count();
|
|
|
- $comment_praise_num = VideoCommentLike::where([['type','=',1],['is_read','=',0],['url_id','in',$all_comment]])->count();
|
|
|
+ $video_praise_num = VideoCommentLike::where([['type','=',2],['is_read','=',0],['like_id','in',$all_video]])->count();
|
|
|
+ $comment_praise_num = VideoCommentLike::where([['type','=',1],['is_read','=',0],['like_id','in',$all_comment]])->count();
|
|
|
$praise_num = $video_praise_num + $comment_praise_num;
|
|
|
-
|
|
|
// 追播未读量
|
|
|
- $follow_num = 0;
|
|
|
-
|
|
|
+ $follow_num = UserMessage::getUnreadNum($this->user_id,'video',5);
|
|
|
$this->success('ok',compact(['reply_num','comment_num','praise_num','comment_praise_num','video_praise_num','follow_num']));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @title 消息已读未读变更
|
|
|
+ * @title 消息已读&&未读变更
|
|
|
* @desc 支持批量选择
|
|
|
* @author qc
|
|
|
* @method POST
|
|
@@ -991,6 +978,32 @@ class Video extends Base
|
|
|
$this->success('消息变更成功');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @title 删除评论&&批量删除
|
|
|
+ * @desc 删除评论
|
|
|
+ * @author qc
|
|
|
+ * @method POST
|
|
|
+ * @url /api/Video/delComment
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @param name:id type:int default:1 desc:评论记录id【多个用逗号隔开=>'1,2'】
|
|
|
+ * @param name:type type:string default:1 desc:消息类型【1我的评论,2评论我的,2】
|
|
|
+ */
|
|
|
+ public function delComment(){
|
|
|
+ $type = input('post.type',1);
|
|
|
+ switch ($type)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ VideoComment::where(['user_id'=>$this->user_id])->where('id','in',input('post.id'))->update(['is_deleted'=>1]);
|
|
|
+ break;
|
|
|
+ default :
|
|
|
+ VideoComment::where('id','in',input('post.id'))->update(['is_read'=>input('post.is_read')]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('删除成功');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1314,6 +1327,13 @@ class Video extends Base
|
|
|
* @return name:ali_vid type:string default:-- desc:云点播id
|
|
|
* @return name:is_vip type:int default:-- desc:是否是vip[0否1是]
|
|
|
* @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
|
|
|
+ * @return name:transmit_num type:int default:-- desc:转发量
|
|
|
+ * @return name:comment_num type:int default:-- desc:评论量
|
|
|
+ * @return name:is_praise type:int default:-- desc:是否点赞
|
|
|
+ * @return name:praise_num type:int default:-- desc:点赞量
|
|
|
+ * @return name:praise_num type:int default:-- desc:点赞量
|
|
|
+ * @return name:is_collect type:int default:-- desc:是否收藏
|
|
|
+ * @return name:collect_num type:int default:-- desc:收藏量
|
|
|
*/
|
|
|
public function getTagsVideo()
|
|
|
{
|
|
@@ -1324,13 +1344,27 @@ class Video extends Base
|
|
|
$sel_where[] = ['t.type','=',2];
|
|
|
$list = VideoCommentLike::where($sel_where)
|
|
|
->alias('t')
|
|
|
- ->field('t.id,t.create_at,t.like_id url_id,i.title,i.cover,i.is_vip,i.cover,i.ali_vid,i.video_id,i.duration')
|
|
|
+ ->field('t.id,t.create_at,t.like_id url_id,v.user_id buid,i.title,i.cover,i.is_vip,i.cover,i.ali_vid,i.video_id,i.duration,i.transmit_num')
|
|
|
->leftJoin('VideoUrl i','t.like_id = i.id')
|
|
|
->order('id desc')
|
|
|
->limit($this->off_set,$this->page_num)
|
|
|
->select()->toArray();
|
|
|
array_walk($list,function (&$v){
|
|
|
$v['is_normal'] = CheckPower::checkModulesPower($v['video_id'],$v['url_id'],$this->request->controller());
|
|
|
+ $v['transmit_num'] = numTransform($v['transmit_num']);
|
|
|
+ $v['comment_num'] = VideoComment::getVideoCommentNum($v['url_id']);
|
|
|
+ $v['is_praise'] = VideoCommentLike::where(['user_id'=>$this->user_id,'type'=>2,'like_id'=>$v['url_id']])->count();
|
|
|
+ $v['praise_num'] = VideoCommentLike::where(['type'=>2,'like_id'=>$v['url_id']])->count();
|
|
|
+ $v['is_collect'] = UserCollect::checkCollectByType($this->user_id,1,$v['video_id'],$v['url_id']);
|
|
|
+ $v['collect_num'] = UserCollect::getCollectNum(1,$v['video_id'],$v['url_id']);
|
|
|
+ if(!$v['buid']){
|
|
|
+ $v['app_name'] = APPNAME;
|
|
|
+ $v['app_logo'] = APPLOGO;
|
|
|
+ }else{
|
|
|
+ $user_info = User::where('id',$v['buid'])->field('name,headimg')->find();
|
|
|
+ $v['app_name'] = $user_info ? $user_info->name : '';
|
|
|
+ $v['app_logo'] = $user_info ? $user_info->headimg : '';
|
|
|
+ }
|
|
|
});
|
|
|
$this->success('ok',['list'=>$list]);
|
|
|
}
|