wupengfei 2 年之前
父节点
当前提交
0bfe99a81e
共有 2 个文件被更改,包括 46 次插入19 次删除
  1. 4 3
      .idea/workspace.xml
  2. 42 16
      application/api/controller/Video.php

+ 4 - 3
.idea/workspace.xml

@@ -2,6 +2,7 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/application/api/controller/Video.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Video.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -229,7 +230,7 @@
       <workItem from="1675904734949" duration="20832000" />
       <workItem from="1675990026788" duration="13260000" />
       <workItem from="1676077132290" duration="20234000" />
-      <workItem from="1676250114476" duration="14997000" />
+      <workItem from="1676250114476" duration="16390000" />
     </task>
     <servers />
   </component>
@@ -399,10 +400,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="1031" y="370" width="829" height="548" key="find.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1676255835346" />
-    <state x="1291" y="317" key="run.anything.popup" timestamp="1672903043103">
+    <state x="1291" y="317" key="run.anything.popup" timestamp="1676273998930">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1291" y="317" key="run.anything.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1672903043103" />
+    <state x="1291" y="317" key="run.anything.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1676273998930" />
     <state x="1237" y="367" width="672" height="678" key="search.everywhere.popup" timestamp="1674898769993">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 42 - 16
application/api/controller/Video.php

@@ -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]);
     }