ai-refactor(flow): 调整抽象流程节点实现和依赖路径

- 修改 AbstractProcessNode 中 ProcessContext 的命名空间引用为 app\flow\context\ProcessContext
- 引入 app\flow\vo\CanHandleResult 用于节点处理结果表示
- 更新前置策略执行后对成功状态的判断,改为调用 isSuccess() 方法
- 增加日志记录细节,便于调试策略执行中断时的错误信息
- 优化代码注释,提升代码可读性和维护性
This commit is contained in:
zimoyin
2026-03-11 00:49:02 +08:00
parent e040fccba6
commit d5991813a6
14 changed files with 1755 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
<?php
namespace app\flow\vo;
/**
* 晨洗状态值对象
* 封装内镜的晨洗相关状态信息,不可变对象
*/
readonly class MorningWashStatus
{
public function __construct(
/** 是否需要晨洗 */
public bool $needMorningWash = false,
/** 是否已完成晨洗 */
public bool $morningWashed = false,
/** 晨洗开始时间(如 06:00:00 */
public string $startTime = '00:00:00',
/** 今天洗消记录数 */
public int $todayWashRecords = 0,
) {}
/**
* 创建默认的晨洗状态(不需要晨洗)
*/
public static function notRequired(): self
{
return new self(needMorningWash: false);
}
/**
* 创建需要晨洗的状态
*/
public static function required(string $startTime = '06:00:00', int $todayWashRecords = 0): self
{
return new self(
needMorningWash: true,
morningWashed: false,
startTime: $startTime,
todayWashRecords: $todayWashRecords
);
}
/**
* 创建已完成晨洗的状态
*/
public static function completed(string $startTime = '06:00:00'): self
{
return new self(
needMorningWash: true,
morningWashed: true,
startTime: $startTime
);
}
/**
* 判断是否需要进行晨洗(需要且未完成)
*/
public function shouldDoMorningWash(): bool
{
return $this->needMorningWash && !$this->morningWashed;
}
/**
* 判断晨洗是否已完成
*/
public function isCompleted(): bool
{
return $this->morningWashed;
}
/**
* 判断今天是否有洗消记录
*/
public function hasWashRecordsToday(): bool
{
return $this->todayWashRecords > 0;
}
/**
* 转换为数组
*/
public function toArray(): array
{
return [
'needMorningWash' => $this->needMorningWash,
'morningWashed' => $this->morningWashed,
'startTime' => $this->startTime,
'todayWashRecords' => $this->todayWashRecords,
];
}
}