diff --git a/IRC.Core.SCP/Service/CStoreSCPService.cs b/IRC.Core.SCP/Service/CStoreSCPService.cs index 4ffb31d38..820e5c7f8 100644 --- a/IRC.Core.SCP/Service/CStoreSCPService.cs +++ b/IRC.Core.SCP/Service/CStoreSCPService.cs @@ -205,19 +205,25 @@ namespace IRaCIS.Core.SCP.Service var _SCPImageUploadRepository = _serviceProvider.GetService>(); - _upload.EndTime = DateTime.Now; - _upload.StudyCount = _ImageUploadList.Count; - _upload.TrialId = _trialId; - _upload.TrialSiteId = _trialSiteId; - - _upload.UploadJsonStr = (new SCPImageLog() { UploadList = _ImageUploadList }).ToJsonStr(); - - //可能是测试echo 导致记录了 - if (_upload.FileCount > 0) + //有时候没有建立连接会走关闭通过日志发现 + if (_upload != null) { + _upload.EndTime = DateTime.Now; + _upload.StudyCount = _ImageUploadList.Count; + _upload.TrialId = _trialId; + _upload.TrialSiteId = _trialSiteId; + + _upload.UploadJsonStr = (new SCPImageLog() { UploadList = _ImageUploadList }).ToJsonStr(); + //可能是测试echo 导致记录了 - await _SCPImageUploadRepository.AddAsync(_upload, true); + if (_upload.FileCount > 0) + { + //可能是测试echo 导致记录了 + await _SCPImageUploadRepository.AddAsync(_upload, true); + } } + + } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 0c0f54c33..82b77e306 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -1000,14 +1000,6 @@ namespace IRaCIS.Core.Application.Service var userLog = new UserLog(); - if (failCount >= maxFailures) - { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.TempLockLogin }, true); - - //$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。" - throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]); - } - var userLoginReturnModel = new IRCLoginReturnDTO(); @@ -1019,7 +1011,7 @@ namespace IRaCIS.Core.Application.Service var isLoginUncommonly = false; - #region //登录用户是系统用户的时候,就要要记录异地登录 + #region 登录用户是系统用户的时候,就要要记录异地登录 //账号在系统存在 if (isExistAccount || loginUser != null) @@ -1093,6 +1085,14 @@ namespace IRaCIS.Core.Application.Service //错误次数累加 failCount++; + if (failCount >= maxFailures) + { + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.TempLockLogin }, true); + + //$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。" + throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]); + } + await _fusionCache.SetAsync(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError, IsLoginUncommonly = isLoginUncommonly }, true); diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 3532380ce..785ee716c 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -18,8 +18,7 @@ server: steps: - name: build-uat-irc commands: - - cd /opt/1panel/xc-deploy/Uat_IRC/devops-build-publish/Uat-To-Uat - - sh uat-branch-latest-build-image-publish.sh v${DRONE_BUILD_NUMBER} + - bash /opt/1panel/xc-deploy-new/Uat_IRC/devops-publish/uat-branch-publish.sh trigger: branch: @@ -46,12 +45,7 @@ server: steps: - name: publish-test-irc commands: - - cd /opt/1panel/xc-deploy/Test_IRC/devops-build-publish;sh test-irc-update-or-create-stack.sh v${DRONE_BUILD_NUMBER} - -- name: publish-test-irc-scp - commands: - - cd /opt/1panel/xc-deploy/Test_IRC_SCP/devops-build-publish;sh pull-build-test-irc-scp-image.sh v${DRONE_BUILD_NUMBER} - - cd /opt/1panel/xc-deploy/Test_IRC_SCP ;sh update-image-if-need-then-pull-aliyun.sh v${DRONE_BUILD_NUMBER} + - bash /opt/1panel/xc-deploy-new/Test_IRC_Swarm/devops-publish/test-branch-publish.sh trigger: branch: @@ -108,13 +102,8 @@ server: steps: - name: publish-test-hir commands: - - cd /opt/1panel/xc-deploy/Test_HIR/devops-build-publish;sh pull-build-test-hir-image.sh v${DRONE_BUILD_NUMBER} - - cd /opt/1panel/xc-deploy/Test_HIR ; sh update-image-if-need-then-pull-aliyun.sh v${DRONE_BUILD_NUMBER} - -- name: publish-test-hir-scp - commands: - - cd /opt/1panel/xc-deploy/Test_HIR_SCP/devops-build-publish;sh pull-build-test-hir-scp-image.sh v${DRONE_BUILD_NUMBER} - - cd /opt/1panel/xc-deploy/Test_HIR_SCP ;sh update-image-if-need-then-pull-aliyun.sh v${DRONE_BUILD_NUMBER} + - bash /opt/1panel/xc-deploy-new/Test_HIR/devops-publish/test-branch-publish.sh + trigger: branch: - Test_HIR