fix comb298y

This commit is contained in:
2025-06-14 15:25:31 +08:00
parent 6bb7f33864
commit 0f83de521f
2 changed files with 3 additions and 6 deletions

View File

@@ -23,11 +23,8 @@ func StructToMap(data interface{}) (map[string]interface{}, error) {
field := t.Field(i)
value := v.Field(i)
// 获取字段名(优先使用 json tag
// 使用结构体字段名作为 key
key := field.Name
if jsonTag := field.Tag.Get("json"); jsonTag != "" && jsonTag != "-" {
key = jsonTag
}
// 处理字段值
if value.IsValid() && !value.IsZero() {