update request log

This commit is contained in:
2026-03-17 14:17:06 +08:00
parent ccea43d8d6
commit 8f69eb0349
3 changed files with 49 additions and 1 deletions
@@ -29,6 +29,12 @@ class CleanRequestLogsCommand extends HyperfCommand
public function handle(): void
{
$days = (int) $this->input->getOption('days');
if ($days < 1) {
$this->error('保留天数必须大于 0');
return;
}
$cutoff = Carbon::now()->subDays($days);
$deleted = ApiRequestLog::query()
@@ -86,7 +86,10 @@ class RequestLogMiddleware implements MiddlewareInterface
*/
public static function sanitizeBody(array $body): array
{
$sensitive_keys = ['password', 'old_password', 'new_password', 'password_confirmation'];
$sensitive_keys = [
'password', 'old_password', 'new_password', 'password_confirmation',
'token', 'secret', 'api_key', 'access_token', 'refresh_token',
];
foreach ($body as $key => $value) {
if (in_array($key, $sensitive_keys, true)) {