Add /api/get-message-answer API

This commit is contained in:
Yang Luo
2023-05-01 23:15:51 +08:00
parent eea2e1d271
commit 2cd6f9df8e
7 changed files with 159 additions and 2 deletions

View File

@ -25,6 +25,20 @@ func GetCurrentTime() string {
return tm.Format(time.RFC3339)
}
func GetCurrentTimeEx(timestamp string) string {
tm := time.Now()
inputTime, err := time.Parse(time.RFC3339, timestamp)
if err != nil {
panic(err)
}
if !tm.After(inputTime) {
tm = inputTime.Add(1 * time.Millisecond)
}
return tm.Format("2006-01-02T15:04:05.999Z07:00")
}
func GetCurrentUnixTime() string {
return strconv.FormatInt(time.Now().UnixNano(), 10)
}