feat(followup-audio): confirm role corrections and reextract cached transcripts

This commit is contained in:
2026-10-12 12:24:34 +08:00
parent 2dfec801e7
commit 9e3aa9fc61
15 changed files with 660 additions and 16 deletions
@@ -99,6 +99,13 @@ final class FollowupAudioController extends BaseAdminController
Logic::delete($this->positive($p, 'id'), $this->positive($p, 'version'), $this->adminId, $this->adminInfo));
}
public function reextract()
{
return $this->handle(true, ['id', 'version', 'channel_roles'], fn (array $p): array =>
Logic::reextract($this->positive($p, 'id'), $this->positive($p, 'version'),
$p['channel_roles'] ?? null, $this->adminId, $this->adminInfo), true);
}
public function retry()
{
return $this->handle(true, ['id'], fn (array $p): array =>
@@ -83,7 +83,7 @@ class AuthMiddleware
// This group must never use the legacy unregistered-route bypass.
if (str_starts_with($accessUri, 'tcm.followupaudio/')) {
$allowed = ['capabilities', 'uploadsession', 'uploadchunk', 'uploadcomplete',
'create', 'lists', 'detail', 'savedraft', 'apply', 'retry', 'audio', 'delete'];
'create', 'lists', 'detail', 'savedraft', 'apply', 'retry', 'audio', 'delete', 'reextract'];
$action = substr($accessUri, strlen('tcm.followupaudio/'));
$uris = $this->formatUrl($adminAuthCache->getAdminUri() ?? []);
if (in_array($action, $allowed, true) && in_array('tcm.diagnosis/edit', $uris, true)) {
@@ -12,6 +12,7 @@ use app\common\service\followupaudio\FollowupAudioProviderConfig as ProviderConf
use app\common\service\followupaudio\FollowupAudioStore as Store;
use app\common\service\followupaudio\FollowupAudioUpload as Upload;
use DomainException;
use app\common\service\followupaudio\FollowupAudioReextract as Reextract;
final class FollowupAudioLogic
{
@@ -110,7 +111,16 @@ final class FollowupAudioLogic
$reason = !Store::enabled() ? '回访录音功能尚未启用'
: ((int) $info['root'] !== 1 && (int) $task['actor_id'] !== $actor
? '仅上传者或超级管理员可删除录音' : Store::deleteBlockReason($task));
return $summary + ['can_delete' => $reason === '', 'delete_block_reason' => $reason];
$reextractReason = (int) $info['root'] !== 1 && (int) $task['actor_id'] !== $actor
? '仅上传者或超级管理员可重新提炼' : Reextract::blockReason($task);
return $summary + ['can_delete' => $reason === '', 'delete_block_reason' => $reason,
'can_reextract' => $reextractReason === '', 'reextract_block_reason' => $reextractReason];
}
public static function reextract(int $id, int $version, $roles, int $actor, array $info): array
{
self::requireEnabled(true);
return self::protectDetail(Reextract::queue($id, $version, $roles, $actor, $info), $actor, $info);
}
public static function retry(int $id, int $actor, array $info): array