$user_id, 'status' => 1]) ->column('user_id'); if (empty($fans)) { return true; } // 设置未读缓存 foreach ($fans as $item) { $cache = new CommunityArticleCache('unread_user'. $item, ['has_new' => 1]); $cache->set(); } return true; } /** * @notes 用户是否有未读文章 * @param $user_id * @return int * @author 段誉 * @date 2022/5/12 16:47 */ public static function hasNew($user_id) { if (empty($user_id)) { return 0; } $cache = new CommunityArticleCache('unread_user'. $user_id); $isEmpty = $cache->isEmpty(); return !$isEmpty ? 1 : 0; } /** * @notes 删除未读状态 * @param $user_id * @return bool * @author 段誉 * @date 2022/5/12 16:51 */ public static function delUnRead($user_id) { $cache = new CommunityArticleCache('unread_user'. $user_id); return $cache->del(); } }