fix: preserve typed followup audio review request payloads
This commit is contained in:
@@ -81,14 +81,14 @@ final class FollowupAudioController extends BaseAdminController
|
||||
return $this->handle(true, ['id', 'version', 'items', 'channel_roles'], fn (array $p): array =>
|
||||
Logic::saveDraft($this->positive($p, 'id'), $this->positive($p, 'version'),
|
||||
$this->items($p), $this->adminId, $this->adminInfo,
|
||||
array_key_exists('channel_roles', $p) ? $this->textValue($p, 'channel_roles', 20) : null));
|
||||
array_key_exists('channel_roles', $p) ? $this->textValue($p, 'channel_roles', 20) : null), true);
|
||||
}
|
||||
|
||||
public function apply()
|
||||
{
|
||||
return $this->handle(true, ['id', 'version', 'items'], fn (array $p): array =>
|
||||
Logic::apply($this->positive($p, 'id'), $this->positive($p, 'version'),
|
||||
$this->items($p), $this->adminId, $this->adminInfo));
|
||||
$this->items($p), $this->adminId, $this->adminInfo), true);
|
||||
}
|
||||
|
||||
public function retry()
|
||||
@@ -106,12 +106,14 @@ final class FollowupAudioController extends BaseAdminController
|
||||
});
|
||||
}
|
||||
|
||||
private function handle(bool $post, array $allowed, callable $handler)
|
||||
private function handle(bool $post, array $allowed, callable $handler, bool $typedJson = false)
|
||||
{
|
||||
if ($post ? !$this->request->isPost() : !$this->request->isGet()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $post ? $this->request->post() : $this->request->get();
|
||||
// Review JSON carries strict booleans/integers and exact source evidence. Global trim
|
||||
// would stringify scalars and alter quotations; keep all explicit validators below.
|
||||
$params = $post ? $this->request->post('', null, $typedJson ? null : '') : $this->request->get();
|
||||
if (array_diff(array_keys($params), $allowed) !== []) {
|
||||
return $this->fail('请求包含不支持的字段');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user