using Api.Framework; using Api.Framework.Tools; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using 监听违规.Entitys; namespace 监听违规 { public class Common { private static List WhiteUserListsCache = null; public static void FlushWhiteUserListsCache(bool flush = false) { if (flush || WhiteUserListsCache == null) { var db = ApiClient.GetSession(); WhiteUserListsCache = db.Queryable().Where(f => f.user_type == UserType.白名单).ToList(); } } /// /// 判断是否是白名单 /// /// /// public static bool IsWhite(string username) { try { if (WhiteUserListsCache == null) FlushWhiteUserListsCache(); var user = WhiteUserListsCache.FirstOrDefault(f => f.wxid == username); return user != null; } catch (Exception ex) { } return false; } } }