53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\flow\nodes;
|
|
|
|
use app\flow\DbOperationType;
|
|
use app\flow\ProcessContext;
|
|
use app\flow\VoiceMessage;
|
|
use app\repository\EctActionsRepository;
|
|
use app\utils\Logger;
|
|
|
|
/**
|
|
* 重复检查节点
|
|
* 用于检测当前操作是否与历史记录重复
|
|
*
|
|
*/
|
|
class DuplicateCheckNode extends AbstractProcessNode
|
|
{
|
|
/**
|
|
* 获取节点名称
|
|
*/
|
|
public static function getName(): string
|
|
{
|
|
return "重复检查";
|
|
}
|
|
|
|
/**
|
|
* 获取节点编码
|
|
*/
|
|
public function getCode(): string
|
|
{
|
|
return self::getName();
|
|
}
|
|
|
|
/**
|
|
* 判断当前节点是否能处理该步骤
|
|
*
|
|
* 所有需要数据库记录的场景都需要经过本节点检查
|
|
*/
|
|
public function canHandle(ProcessContext $context): bool
|
|
{
|
|
return $context->previousAction->process_name === $context->readerType;
|
|
}
|
|
|
|
/**
|
|
* 具体处理逻辑:检查重复操作
|
|
*/
|
|
protected function doHandle(ProcessContext $context): ProcessContext
|
|
{
|
|
$context->setError(VoiceMessage::DUPLICATE_SWIPING);
|
|
return $context;
|
|
}
|
|
}
|