diff --git a/Application/Sdk/Controller/NoticeController.class.php b/Application/Sdk/Controller/NoticeController.class.php index 198d94f5..d9e875f1 100644 --- a/Application/Sdk/Controller/NoticeController.class.php +++ b/Application/Sdk/Controller/NoticeController.class.php @@ -166,6 +166,20 @@ class NoticeController extends BaseController{ $arr['create_time'] = time(); M('notice_read','tab_')->data($arr)->add(); } + $data['unread_count'] = 0; + + //获取公告未读条数 + $time = time(); + $notice = M('notice', 'tab_')->where('start_time < ' . $time . ' AND game_id = ' . $user['game_id']. ' AND (end_time = 0 OR end_time >' . $time . ')')->getField('id',true); + if(!empty($notice)) + { + $data['unread_count'] += count($notice); + $where['notice_id'] = ['in', implode(',', $notice)]; + $where['user_id'] = $user['user_id']; + $where['is_read'] = 1; + $notice_read_count = M('notice_read', 'tab_')->where($where)->count(); + $data['unread_count'] -= $notice_read_count; + } break; case '2': $game_name = get_game_name($detail['game_id']);