fix comb298y
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user