mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-16 22:46:35 +08:00
1. 重新设计了 JSON门户类的实现
2. Script脚本添加了原始字符串的实现 3. 修复了Script中无法对 \" 双引号转义的问题 4. 新增了对于集合嵌套取值的支持(目前仅是集合取值) 5. 重新设计了FlowWorkManagement任务启动的逻辑,修复了触发器无法正常运行的问题 6. 在ScriptBaseFunc中新增了 json() 本地函数,支持将字符串转为IJsonToken进行取值。 7. EmitHelper对于集合取值时,反射获取“get_item”委托时存在看你多个MethodInfo,现在可以传入子项类型,帮助匹配目标重载方法
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Library
|
||||
@@ -82,33 +83,92 @@ namespace Serein.Library
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
|
||||
public TriggerDescription Type { get; set; }
|
||||
/// <summary>
|
||||
/// 触发时传递的数据
|
||||
/// </summary>
|
||||
public TResult Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发器上下文构造函数
|
||||
/// </summary>
|
||||
/// <param name="ffState"></param>
|
||||
public FlipflopContext(FlipflopStateType ffState)
|
||||
public FlipflopContext()
|
||||
{
|
||||
State = ffState;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发器上下文构造函数,传入状态和数据值
|
||||
/// 成功触发器上下文,表示触发器执行成功并返回结果
|
||||
/// </summary>
|
||||
/// <param name="ffState"></param>
|
||||
/// <param name="value"></param>
|
||||
public FlipflopContext(FlipflopStateType ffState, TResult value)
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Ok<TResult>(TResult result)
|
||||
{
|
||||
State = ffState;
|
||||
Value = value;
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Succeed,
|
||||
Type = TriggerDescription.External,
|
||||
Value = result,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示触发器执行失败
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Fail()
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Fail,
|
||||
Type = TriggerDescription.External,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示触发器执行过程中发生了错误
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Error()
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Error,
|
||||
Type = TriggerDescription.External,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消触发器上下文,表示触发器被外部取消
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Cancel()
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Cancel,
|
||||
Type = TriggerDescription.External,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 超时触发器上下文,表示触发器在指定时间内未完成
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Overtime(FlipflopStateType state = FlipflopStateType.Fail)
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = state,
|
||||
Type = TriggerDescription.Overtime,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user