- more interface and const added.
This commit is contained in:
@@ -163,10 +163,23 @@ func Timestamp2Str(timestamp int64) string {
|
||||
return Time2Str(time.Unix(timestamp, 0))
|
||||
}
|
||||
|
||||
func Timestamp2Time(timestamp int64) time.Time {
|
||||
return time.Unix(timestamp, 0)
|
||||
}
|
||||
|
||||
func Time2Str(t time.Time) string {
|
||||
return t.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
|
||||
func Str2Time(timeStr string) time.Time {
|
||||
timeStr = strings.Replace(timeStr, "T", " ", 1)
|
||||
retVal, err := time.ParseInLocation("2006-01-02 15:04:05", timeStr, time.Local)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Errorf("ParseInLocation failed, timeStr:%v, error:%v", timeStr, err)
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func HTTPResponse2Json(response *http.Response) (map[string]interface{}, error) {
|
||||
var jsonResult map[string]interface{}
|
||||
bodyData, err := ioutil.ReadAll(response.Body)
|
||||
|
||||
Reference in New Issue
Block a user