From ae9ada7f9d2dc8d0415d73a9db84cc78f2d41f79 Mon Sep 17 00:00:00 2001 From: lmk <1095689763@qq.com> Date: Tue, 16 Jun 2026 18:39:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(qa):=20ISSUE-001=20=E2=80=94=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20executeCount=20=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84?= =?UTF-8?q?=20result=20=E8=AE=BF=E9=97=AE=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit executeCount 函数混用了 result.List()[0] 和 result[0] 两种访问模式。 改为统一使用 result.List()[0] 遍历列值,并在 int64 类型断言失败时 通过 gfdb 的 Int64() 方法安全获取数值。 --- common/report/executor/executor.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/common/report/executor/executor.go b/common/report/executor/executor.go index 351da8f..78320d5 100644 --- a/common/report/executor/executor.go +++ b/common/report/executor/executor.go @@ -111,14 +111,20 @@ func (e *QueryExecutor) executeCount(ctx context.Context, metadata map[string]in var total int64 if result.Len() > 0 { - for k, v := range result.List()[0] { - _ = k + firstRow := result.List()[0] + // 遍历第一行所有列,找到第一个可解析为 int64 的值作为总数 + for _, v := range firstRow { if n, ok := v.(int64); ok { total = n - } else { - total = result[0]["count"].Int64() + break + } + } + // 如果遍历未找到 int64 类型值,尝试通过 gfdb 的 Int64 方法获取 + if total == 0 && len(firstRow) > 0 { + for k := range firstRow { + total = result[0][k].Int64() + break } - break } } return total, nil