/// <summary> /// 保存登录日志 /// </summary> /// <param name="userId">用户ID</param> /// <param name="userName">用户名</param> /// <param name="regPlatCode">注册平台</param> public void SaveLoginLog(int userId, string userName, long regPlatCode) { LoginLog login = new LoginLog(userId, userName, regPlatCode); loginLogRepository.Create(login); var stateLog = loginStateRepository.Get(userId); if (stateLog == null) { stateLog = new LoginStateLog(userId); loginStateRepository.Create(stateLog); } else { stateLog.ChangeLoginState(); loginStateRepository.Update(stateLog); } }