ai-chore(config): 调整流程配置及改进测试代码

- 将 FLOW_USE_CUSTOM_PROCESS 从 true 改为 false,禁用自定义流程
- 在 BlockTest 测试用例中改用 setBlockMode 方法设置阻断模式
- 设置统一的错误处理,将错误转为异常抛出
- 重命名 BlockTest 测试文件路径,优化测试组织结构
- 更新 IDE php include paths,调整依赖包引用顺序
- 删除无用的 tests/flow/Test.php 测试文件
- 微调 start.php、webman、windows.php 配置或代码模块
This commit is contained in:
zimoyin
2026-03-11 13:48:40 +08:00
parent 6c874221ad
commit f2ff4ae123
42 changed files with 246 additions and 158 deletions
@@ -59,15 +59,16 @@ class TimeValidationStrategy extends AbstractStrategy
/**
* 执行时间验证
* 验证上一步骤(currentStep)的时长是否达标
*/
protected function doExecute(ProcessContext $context, ProcessNodeInterface $node): ProcessContext
{
$stepCode = $node->getCode();
$currentStep = $context->getCurrentStep();
// 验证的是上一步骤(currentStep)的时长,而不是当前节点
$stepCode = $context->getCurrentStep();
$processType = $context->getProcessType();
Logger::debug("开始执行时间验证策略,步骤:{$stepCode},流程类型:{$processType}");
$configDuration = $this->timeValidationConfig->getDuration($stepCode,$processType);
$configDuration = $this->timeValidationConfig->getDuration($stepCode, $processType);
Logger::debug("步骤:{$stepCode},流程类型:{$processType},配置时长:{$configDuration}s");
if ($configDuration > 0) {
@@ -76,7 +77,7 @@ class TimeValidationStrategy extends AbstractStrategy
} else {
Logger::debug("步骤:{$stepCode},流程类型:{$processType},无配置时长,从数据库查询");
// 从数据库按流程类型精确查询
$requiredDuration = $this->getDurationFromDb($stepCode, $context->getProcessType());
$requiredDuration = $this->getDurationFromDb($stepCode, $processType);
if ($requiredDuration > 0) {
$context = $context->builder()->withStepDuration($stepCode, $requiredDuration)->build();
} else {
@@ -116,11 +117,13 @@ class TimeValidationStrategy extends AbstractStrategy
/**
* 判断策略是否适用
* 只有在 timeValidationConfig 中登记的步骤才参与时间验证
* 验证的是上一步骤(currentStep)的时长
*/
public function isApplicable(ProcessContext $context, ProcessNodeInterface $node): bool
{
if ($context->getCurrentStep() != $context->getPreviousAction()?->process_name) return false;
if (!$this->timeValidationConfig->hasStep($node->getCode(), $context->getProcessType())) return false;
// 检查的是 currentStep(上一步骤)是否有时间配置
if (!$this->timeValidationConfig->hasStep($context->getCurrentStep(), $context->getProcessType())) return false;
return true;
}