登录与授权等

This commit is contained in:
2024-01-07 15:13:35 +08:00
parent 968eab9b06
commit ec548f4256
22 changed files with 248 additions and 53 deletions

23
pkg/util/time.go Normal file
View File

@@ -0,0 +1,23 @@
package util
import "time"
func ToSQLTimeFormat(t time.Time) string {
return t.Format("2006-01-02 15:04:05")
}
func MustParseSQLTime(timeStr string) time.Time {
timeObj, err := time.ParseInLocation("2006-01-02 15:04:05", timeStr, time.Local)
if err != nil {
panic(err)
}
return timeObj
}
func IsSQLTimeFormat(timeStr string) bool {
_, err := time.ParseInLocation("2006-01-02 15:04:05", timeStr, time.Local)
if err != nil {
return false
}
return true
}

View File

@@ -1,5 +0,0 @@
package util
func GenSessionID() string {
return RandStr(32)
}