|
@@ -932,44 +932,68 @@ class Video extends Base
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @title 获取角标数量
|
|
|
- * @desc 获取角标数量
|
|
|
+ * @title 获取角标数量【未读数量统计】
|
|
|
+ * @desc 未读数量统计
|
|
|
* @author qc
|
|
|
* @method GET
|
|
|
* @url /api/Video/getMarkNum
|
|
|
* @header name:Authorization require:1 desc:Token
|
|
|
- * @return name:reply_num type:int default:-- desc:未读量--回复我的
|
|
|
- * @return name:comment_num type:int default:-- desc:未读量--评论我的
|
|
|
+ * @return name:reply_num type:int default:-- desc:回复我的
|
|
|
+ * @return name:comment_num type:int default:-- desc:评论我的
|
|
|
+ * @return name:praise_num type:int default:-- desc:点赞我的【包含视频点赞和评论点赞】
|
|
|
+ * @return name:video_praise_num type:int default:-- desc:-视频点赞
|
|
|
+ * @return name:comment_praise_num type:int default:-- desc:评论点赞
|
|
|
+ * @return name:follow_num type:int default:-- desc:追播
|
|
|
+
|
|
|
*/
|
|
|
public function getMarkNum()
|
|
|
{
|
|
|
- // 回复我的
|
|
|
- $all_comment = VideoComment::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
|
|
|
- $reply_num = VideoComment::where([['t.is_deleted','=',0],['t.lev','>=',2],['is_read','=',0],['t.pid','in',implode(',',$all_comment)]])->alias('t')->count();
|
|
|
// 评论我的
|
|
|
$comment_num = VideoComment::where([['t.is_deleted','=',0],['i.user_id','=',$this->user_id],['is_read','=',0]])
|
|
|
->leftJoin('VideoUrl i','t.url_id = i.id')
|
|
|
->alias('t')->count();
|
|
|
+ // 回复我的
|
|
|
+ $all_comment = VideoComment::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
|
|
|
+ $reply_num = VideoComment::where([['t.is_deleted','=',0],['t.lev','>=',2],['is_read','=',0],['t.pid','in',implode(',',$all_comment)]])->alias('t')->count();
|
|
|
+
|
|
|
+ // 点赞我的
|
|
|
+ $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();
|
|
|
+ $praise_num = $video_praise_num + $comment_praise_num;
|
|
|
+
|
|
|
+ // 追播未读量
|
|
|
+ $follow_num = 0;
|
|
|
|
|
|
- $this->success('ok',compact(['reply_num','comment_num']));
|
|
|
+ $this->success('ok',compact(['reply_num','comment_num','praise_num','comment_praise_num','video_praise_num','follow_num']));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @title 消息已读
|
|
|
- * @desc 消息已读
|
|
|
+ * @title 消息已读未读变更
|
|
|
+ * @desc 支持批量选择
|
|
|
* @author qc
|
|
|
* @method POST
|
|
|
* @url /api/Video/unreadChange
|
|
|
* @header name:Authorization require:1 desc:Token
|
|
|
- * @param name:id type:string default:-- desc:记录id【不区分类型】
|
|
|
+ * @param name:id type:string default:-- desc:记录id【不区分类型】(多个逗号隔开)
|
|
|
+ * @param name:type type:string default:1 desc:消息类型【1评论我的,2回复我的】
|
|
|
+ * @param name:is_read type:int default:1 desc:变更类型【0消息变更为未读,1变更为已读】
|
|
|
*/
|
|
|
public function unreadChange()
|
|
|
{
|
|
|
- VideoComment::where('id',input('post.id'))->update(['is_read'=>1]);
|
|
|
- $this->success('ok');
|
|
|
+ $type = input('post.type',1);
|
|
|
+ switch ($type)
|
|
|
+ {
|
|
|
+ default :
|
|
|
+ VideoComment::where('id','in',input('post.id'))->update(['is_read'=>input('post.is_read')]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $this->success('消息变更成功');
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @title 回复我的【回复我的--回复过我的评论】
|
|
|
* @desc 回复我的
|
|
@@ -1161,6 +1185,8 @@ class Video extends Base
|
|
|
* @return name:is_normal type:int default:-- desc:是否是正常记录(0已删除或是已禁用1可以正常跳转详情)
|
|
|
* @return name:duration type:int default:-- desc:时长(单位:秒)
|
|
|
* @return name:read_num type:int default:-- desc:播放量
|
|
|
+ * @return name:app_name type:string default:-- desc:平台名称
|
|
|
+ * @return name:app_logo type:string default:-- desc:平台头像
|
|
|
*/
|
|
|
public function commentMyVideo()
|
|
|
{
|
|
@@ -1168,7 +1194,7 @@ class Video extends Base
|
|
|
$title = input('get.title');
|
|
|
if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%'];
|
|
|
$sel_where[] = ['t.is_deleted','=',0];
|
|
|
- // $sel_where[] = ['i.user_id','=',$this->user_id];
|
|
|
+ $sel_where[] = ['i.user_id','=',$this->user_id];
|
|
|
$user_info = $this->userInfo('name,headimg');
|
|
|
$list = VideoComment::where($sel_where)
|
|
|
->alias('t')
|
|
@@ -1181,8 +1207,8 @@ class Video extends Base
|
|
|
array_walk($list,function (&$v)use ($user_info){
|
|
|
$v['is_normal'] = CheckPower::checkModulesPower($v['video_id'],$v['url_id'],$this->request->controller());
|
|
|
$v['read_num'] = numTransform($v['read_num']);
|
|
|
- $v['app_name'] = APPNAME;
|
|
|
- $v['app_logo'] = APPLOGO;
|
|
|
+ $v['app_name'] = $user_info['name'];
|
|
|
+ $v['app_logo'] = $user_info['headimg'];
|
|
|
});
|
|
|
$this->success('ok',['list'=>$list]);
|
|
|
}
|