From 79c60fa097a154099ebd7d876772758f8974bae9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 1 Nov 2019 16:20:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E8=AF=BB=E6=B6=88=E6=81=AF=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/UserController.class.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index ee5c7b37..6278a995 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -139,6 +139,17 @@ class UserController extends BaseController $small_list = $this -> small_list($user['user_id'], $user['game_id']); $small_list[] = array('is_platform' => $platform, 'user_id' => $user['user_id'], 'account' => $user['account'], 'user_account' => $user['account']); $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)) + { + $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(); + $unread_count -= $notice_read_count; + } $unread_count += M('share_record', 'tab_') -> where(['invite_id' => $user['user_id'], 'award_coin' => ['gt', 0], 'read' => 0]) -> count(); $unread_count += M('point_record', 'tab_') -> where(['type_id' => 6, 'user_id' => $user['user_id'], 'point' => ['gt', 0], 'read' => 0]) -> count(); $notice_count = $unread_count; @@ -198,6 +209,17 @@ class UserController extends BaseController $this -> add_user_play($user); $user_res = M('User', 'tab_') -> where(['account' => $user['account']]) -> find(); $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)) + { + $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(); + $unread_count -= $notice_read_count; + } $unread_count += M('share_record', 'tab_') -> where(['invite_id' => $user['user_id'], 'award_coin' => ['gt', 0], 'read' => 0]) -> count(); $unread_count += M('point_record', 'tab_') -> where(['type_id' => 6, 'user_id' => $user['user_id'], 'point' => ['gt', 0], 'read' => 0]) -> count(); $notice_count = $unread_count; @@ -267,6 +289,17 @@ class UserController extends BaseController $small_list[] = array('is_platform' => $platform, 'user_id' => $user['user_id'], 'account' => $user['account'], 'user_account' => $user['account']); $user_res = M('User', 'tab_') -> where(['account' => $user['account']]) -> find(); $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)) + { + $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(); + $unread_count -= $notice_read_count; + } $unread_count += M('share_record', 'tab_') -> where(['invite_id' => $user['user_id'], 'award_coin' => ['gt', 0], 'read' => 0]) -> count(); $unread_count += M('point_record', 'tab_') -> where(['type_id' => 6, 'user_id' => $user['user_id'], 'point' => ['gt', 0], 'read' => 0]) -> count(); $notice_count = $unread_count;