mirror of
https://gitcode.com/JianFeeeee/homeagent-sdk.git
synced 2026-09-20 00:48:12 +00:00
fix(qq): parseIDList 兼容科学计数法存库的历史坏值
配置里 QQ 号被 WebUI 以科学计数法(2.198972886e+09)存库时, ParseInt 解析失败导致 adminIDs 为空、老大消息不被标记。 ParseInt 失败后回退 ParseFloat, 整数值转为 int64。
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -585,6 +586,11 @@ func parseIDList(raw string) []int64 {
|
||||
}
|
||||
if n, err := strconv.ParseInt(part, 10, 64); err == nil && n > 0 {
|
||||
out = append(out, n)
|
||||
continue
|
||||
}
|
||||
// 兼容历史坏数据:科学计数法存库的值(如 2.198972886e+09)
|
||||
if f, err := strconv.ParseFloat(part, 64); err == nil && f > 0 && f == math.Trunc(f) {
|
||||
out = append(out, int64(f))
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user