/// <summary> /// 声明管理员登入 /// </summary> /// <param name="db">数据库连接对象</param> /// <param name="userId">管理员信息的存储指针</param> /// <returns>返回身份标识</returns> public static string AddInfo(IModelToDbContextOfAdministrator db, int userId) { lock (infos) { RemoveInfo(userId); AdministratorLoginInfo info = new AdministratorLoginInfo(db, userId); CallEvent(Logining, info); infos.Add(info); CallEvent(Logined, info); return info.Token; } }
/// <summary> /// 触发事件 /// </summary> /// <param name="_event">事件</param> /// <param name="info">数据集</param> static void CallEvent(Action<AdministratorLoginInfo> _event, AdministratorLoginInfo info) { if (_event != null) { _event(info); } }