修复统计报表

This commit is contained in:
2026-07-28 11:13:23 +08:00 Unverified
parent 7e14b22296
commit be842cc1d5
2 changed files with 96 additions and 75 deletions
@@ -957,13 +957,14 @@ public sealed class StatisticsController(
async token =>
{
var source = await factory(token);
if (source.Result is not null || source.Value is null)
var data = source.Result is ObjectResult { Value: not null } objectResult
? objectResult.Value
: source.Value;
if (data is null)
throw new InvalidOperationException(
"Statistics cache source did not return a successful value.");
return JsonSerializer.SerializeToElement(
source.Value,
source.Value.GetType());
return JsonSerializer.SerializeToElement(data, data.GetType());
},
AppCacheProfile.Analytics,
[