Browse Source

断网情况下登录超时设置

中职版本
zhichao lei 4 years ago
parent
commit
c3e023748e
6 changed files with 67 additions and 11 deletions
  1. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  2. +1
    -5
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/Sys_SendFileMethod.cs
  3. +56
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Common/TimeOutCheckTool.cs
  4. +1
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Common/Timeout.cs
  5. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj
  6. +6
    -4
      Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.WebLicense/LicenseChecker.cs

+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj View File

@@ -984,6 +984,7 @@
<Content Include="Areas\EducationalAdministration\Views\Sys_ReceiveFile\IndexParty.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_ReceiveFile\IndexDocument.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_ReceiveFile\Index.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_ReceiveFile\SpecifyReceiverForm.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\FormParty.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\FormDocumentView.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\FormDocument.js" />
@@ -6808,6 +6809,7 @@
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\LoanForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\OnsitePayForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\IssueForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\Sys_ReceiveFile\SpecifyReceiverForm.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />


+ 1
- 5
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/Sys_SendFileMethod.cs View File

@@ -32,12 +32,8 @@ namespace Learun.Application.WorkFlow
if (nwfTaskLogEntity != null)
{
entity.SpecifyReceiver = nwfTaskLogEntity.F_Des;
asset.SaveEntity(entity.SFileId, entity);
}
else
{
entity.SpecifyReceiver = "测试信息";
}
asset.SaveEntity(entity.SFileId, entity);
}
else
{


+ 56
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Common/TimeOutCheckTool.cs View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Learun.Util.Common
{
public class TimeOutCheckTool
{
public T TimeoutCheck<T>(int ms, Func<T> func)
{
var wait = new ManualResetEvent(false);
bool RunOK = false;
var task = Task.Run<T>(() =>
{
var result = func.Invoke();
RunOK = true;
wait.Set();
return result;
});
wait.WaitOne(ms);
if (RunOK)
{
return task.Result;
}
else
{
return default(T);
}
}

public T TimeoutCheckTwo<T>(int ms, Func<T> func)
{
var wait = new ManualResetEvent(false);
bool RunOK = false;
var task = Task.Run<T>(() =>
{
var result = func.Invoke();
RunOK = true;
wait.Set();
return result;
});
wait.WaitOne(ms);
if (RunOK)
{
return task.Result;
}
else
{
return true;
}
}
}
}

+ 1
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Common/Timeout.cs View File

@@ -19,7 +19,6 @@ namespace Learun.Util.Common

public Timeout()
{
// 初始状态为 停止
this.mTimeoutObject = new ManualResetEvent(true);
}
///<summary>
@@ -33,7 +32,7 @@ namespace Learun.Util.Common
return false;
}
this.mTimeoutObject.Reset();
this.mBoTimeout = true; //标记
this.mBoTimeout = true;
this.Do.BeginInvoke(DoAsyncCallBack, null);
// 等待 信号Set
if (!this.mTimeoutObject.WaitOne(timeSpan, false))


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj View File

@@ -89,6 +89,7 @@
<Compile Include="Attributes\EnumAttribute.cs" />
<Compile Include="Common\CommonHelper.cs" />
<Compile Include="Common\Timeout.cs" />
<Compile Include="Common\TimeOutCheckTool.cs" />
<Compile Include="Config\Config.cs" />
<Compile Include="DataBase\DataConvert.cs" />
<Compile Include="DataBase\FieldTypeHepler.cs" />


+ 6
- 4
Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.WebLicense/LicenseChecker.cs View File

@@ -54,14 +54,16 @@ namespace Quanjiang.DigitalScholl.WebLicense



Timeout timeout = new Timeout();
timeout.Do = GetMAManagementInfo;
bool bo = timeout.DoWithTimeout(new TimeSpan(0, 0, 0, 2));
//Timeout timeout = new Timeout();
//timeout.Do = GetMAManagementInfo;
//bool bo = timeout.DoWithTimeout(new TimeSpan(0, 0, 0, 4));

TimeOutCheckTool tool = new TimeOutCheckTool();
var checkResult = tool.TimeoutCheckTwo(4000, () => GetMAManagementInfo());


//var maResult = GetMAManagementInfo();
if (!bo)
if (!checkResult)
{
ls.Message = "未授权";
return ls;


Loading…
Cancel
Save