未读消息数

master
Your Name 5 years ago
parent 79c60fa097
commit 9ecc587a9c

@ -56,17 +56,7 @@ class UserController extends BaseController
$small_list = $this -> small_list($user['user_id'], $user['game_id']); $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']); $small_list[] = array('is_platform' => $platform, 'user_id' => $user['user_id'], 'account' => $user['account'], 'user_account' => $user['account']);
$unread_count = 0; $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('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(); $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; $notice_count = $unread_count;

Loading…
Cancel
Save