|
@@ -15,9 +15,9 @@ class Message extends Api
|
|
//消息页信息
|
|
//消息页信息
|
|
public function index(){
|
|
public function index(){
|
|
$rs = [
|
|
$rs = [
|
|
- 'msg_first' => Db::name('message')->where('user_id',$this->auth->id)->order('id desc')->find(),
|
|
|
|
- 'msg_unread_num' => Db::name('message')->where('user_id',$this->auth->id)->where('status',0)->count(),
|
|
|
|
- 'msgsys_first' => Db::name('message_sys')->order('id desc')->find(),
|
|
|
|
|
|
+ 'msg_first' => Db::name('message')->where('user_id',$this->auth->id)->order('id desc')->find(), //第一条个人消息
|
|
|
|
+ 'msg_unread_num' => Db::name('message')->where('user_id',$this->auth->id)->where('status',0)->count(),//个人消息未读数量
|
|
|
|
+ 'msgsys_first' => Db::name('message_sys')->order('id desc')->find(),//第一条系统消息
|
|
];
|
|
];
|
|
|
|
|
|
//系统消息未读数量
|
|
//系统消息未读数量
|
|
@@ -25,6 +25,29 @@ class Message extends Api
|
|
$read_num = Db::name('user_messagesys')->where('user_id',$this->auth->id)->count();
|
|
$read_num = Db::name('user_messagesys')->where('user_id',$this->auth->id)->count();
|
|
$rs['msgsys_unread_num'] = abs($all_num - $read_num);
|
|
$rs['msgsys_unread_num'] = abs($all_num - $read_num);
|
|
|
|
|
|
|
|
+ //动态评论未读数量
|
|
|
|
+ $map = [
|
|
|
|
+ 'dt.user_id' => $this->auth->id,
|
|
|
|
+ 'a.level' => 1,
|
|
|
|
+ 'a.is_read' => 0,
|
|
|
|
+ ];
|
|
|
|
+ $dt_answer_unread = Db::name('topic_dongtai_answer')->alias('a')
|
|
|
|
+ ->join('topic_dongtai dt','a.dt_id = dt.id','LEFT')
|
|
|
|
+ ->where($map)->count();
|
|
|
|
+
|
|
|
|
+ //动态点赞未读数量
|
|
|
|
+ $map = [
|
|
|
|
+ 'dt.user_id' => $this->auth->id,
|
|
|
|
+ 'g.is_read' => 0,
|
|
|
|
+ ];
|
|
|
|
+ $dt_good_unread = Db::name('topic_dongtai_good')->alias('g')
|
|
|
|
+ ->join('topic_dongtai dt','g.dt_id = dt.id','LEFT')
|
|
|
|
+ ->where($map)->count();
|
|
|
|
+
|
|
|
|
+ //互动消息未读数量
|
|
|
|
+ $rs['dongtai_unread_num'] = $dt_answer_unread + $dt_good_unread;
|
|
|
|
+
|
|
|
|
+
|
|
$this->success(1,$rs);
|
|
$this->success(1,$rs);
|
|
}
|
|
}
|
|
|
|
|