mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-09-26 20:21:19 +08:00
优化null相关
This commit is contained in:
@@ -17,7 +17,18 @@ func EncodeInt(value any) any {
|
||||
switch v := value.(type) {
|
||||
case map[string]any:
|
||||
if v["Int"] != nil {
|
||||
return v["Int"]
|
||||
val := v["Int"]
|
||||
switch i := val.(type) {
|
||||
case *int:
|
||||
return *i
|
||||
case *int64:
|
||||
return *i
|
||||
case *string:
|
||||
return *i
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
// return val
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
@@ -27,10 +27,20 @@ func (t nullTimeUtil) EncodeTime(value any) any {
|
||||
var str = ""
|
||||
switch v := value.(type) {
|
||||
case map[string]interface{}:
|
||||
tt := v["Time"]
|
||||
val := v["Time"]
|
||||
switch tt := val.(type) {
|
||||
case *string:
|
||||
ttt, _ := t.Parse(*tt)
|
||||
str = ttt.String()
|
||||
case *time.Time:
|
||||
if tt != nil {
|
||||
ttt, _ := t.Parse(*tt)
|
||||
str = ttt.String()
|
||||
} else {
|
||||
str = ""
|
||||
}
|
||||
}
|
||||
|
||||
ttt, _ := t.Parse(tt)
|
||||
str = ttt.String()
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
Reference in New Issue
Block a user