|
@@ -418,6 +418,44 @@ class Press extends Base
|
|
|
|
|
|
|
|
|
/**
|
|
|
+ * @title 获取角标数量
|
|
|
+ * @desc 获取角标数量
|
|
|
+ * @author qc
|
|
|
+ * @method GET
|
|
|
+ * @url /api/Press/getMarkNum
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @return name:reply_num type:int default:-- desc:未读量--回复我的
|
|
|
+ * @return name:comment_num type:int default:-- desc:未读量--评论我的
|
|
|
+ */
|
|
|
+ public function getMarkNum()
|
|
|
+ {
|
|
|
+ // 回复我的
|
|
|
+ $all_comment = PressComment::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
|
|
|
+ $reply_num = PressComment::where([['t.is_deleted','=',0],['t.lev','>=',2],['is_read','=',0],['t.pid','in',implode(',',$all_comment)]])->alias('t')->count();
|
|
|
+ // 评论我的
|
|
|
+ $comment_num = PressComment::where([['t.is_deleted','=',0],['i.user_id','=',$this->user_id],['is_read','=',0]])
|
|
|
+ ->leftJoin('Press i','t.first_id = i.id')
|
|
|
+ ->alias('t')->count();
|
|
|
+ $this->success('ok',compact(['reply_num','comment_num']));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @title 消息已读
|
|
|
+ * @desc 消息已读
|
|
|
+ * @author qc
|
|
|
+ * @method POST
|
|
|
+ * @url /api/Press/unreadChange
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @param name:id type:string default:-- desc:记录id【不区分类型】
|
|
|
+ */
|
|
|
+ public function unreadChange()
|
|
|
+ {
|
|
|
+ PressComment::where('id',input('post.id'))->update(['is_read'=>1]);
|
|
|
+ $this->success('ok');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
* @title 回复我的【回复我的--回复过我的评论】
|
|
|
* @desc 回复我的
|
|
|
* @author qc
|
|
@@ -429,6 +467,7 @@ class Press extends Base
|
|
|
* @param name:page_num type:int default:20 desc:每页数
|
|
|
* @return name:title type:string default:-- desc:标题
|
|
|
* @return name:cover type:string default:-- desc:封面
|
|
|
+ * @return name:is_read type:int default:-- desc:是否已读(0未读1已读)
|
|
|
* @return name:iamges_arr type:array default:-- desc:图片【多张】
|
|
|
* @return name:create_at type:string default:-- desc:时间
|
|
|
* @return name:user_name type:string default:-- desc:用户名【其他会员】
|
|
@@ -453,7 +492,7 @@ class Press extends Base
|
|
|
$sel_where[] = ['t.pid','in',implode(',',$all_comment)];
|
|
|
$list = PressComment::where($sel_where)
|
|
|
->alias('t')
|
|
|
- ->field('t.id,t.create_at,t.first_id press_id,t.lev,t.content,t.pid,u.name user_name,u.headimg,i.cover,i.images')
|
|
|
+ ->field('t.id,t.is_read,t.create_at,t.first_id press_id,t.lev,t.content,t.pid,u.name user_name,u.headimg,i.cover,i.images')
|
|
|
->leftJoin('store_member u','t.user_id = u.id')
|
|
|
->leftJoin('Press i','t.first_id = i.id')
|
|
|
->order('t.id desc')
|
|
@@ -489,6 +528,7 @@ class Press extends Base
|
|
|
* @return name:title type:string default:-- desc:标题
|
|
|
* @return name:press_id type:string default:-- desc:新闻id
|
|
|
* @return name:cover type:string default:-- desc:封面
|
|
|
+ * @return name:is_read type:int default:-- desc:是否已读(0未读1已读)
|
|
|
* @return name:create_at type:string default:-- desc:时间
|
|
|
* @return name:user_name type:string default:-- desc:用户名
|
|
|
* @return name:headimg type:string default:-- desc:用户头像
|
|
@@ -503,7 +543,7 @@ class Press extends Base
|
|
|
$sel_where[] = ['i.user_id','=',$this->user_id];
|
|
|
$list = PressComment::where($sel_where)
|
|
|
->alias('t')
|
|
|
- ->field('t.id,t.create_at,t.first_id press_id,t.content,i.title,i.cover,u.name user_name,u.headimg')
|
|
|
+ ->field('t.id,t.is_read,t.create_at,t.first_id press_id,t.content,i.title,i.cover,u.name user_name,u.headimg')
|
|
|
->leftJoin('Press i','t.first_id = i.id')
|
|
|
->leftJoin('store_member u','t.user_id = u.id')
|
|
|
->order('t.id desc')
|