Fix data get timestamp format

tags/v1.0.12 v1.0.12
Stanly 4 years ago
parent c0ab765d37
commit 3c4e62ce60

@ -321,12 +321,17 @@ func (data Data) MustGetBool(key string) bool {
// GetTimestamp 取得時間戳記 // GetTimestamp 取得時間戳記
func (data Data) GetTimestamp(key string) (Timestamp, error) { func (data Data) GetTimestamp(key string) (Timestamp, error) {
value, err := data.GetInt64(key) value, err := data.Get(key)
if err != nil { if err != nil {
return 0, err return 0, err
} }
return Timestamp(value), nil switch value.(type) {
case Timestamp:
return value.(Timestamp), nil
}
return 0, ErrFormat
} }
// MustGetTimestamp 強制取得時間戳記 // MustGetTimestamp 強制取得時間戳記

Loading…
Cancel
Save