统一表创建表的方式

This commit is contained in:
2026-04-28 16:38:39 +08:00
parent 542d0c394b
commit 5d9d73cb56
9 changed files with 191 additions and 195 deletions
-34
View File
@@ -51,47 +51,13 @@ func Md5Str(str string) string {
return hashString2
}
func HashUserPass(user *TabUser_) {
switch ConfigsUser.PassHashType {
case "text":
break
case "md5":
user.Pass = Md5Str(user.Pass)
case "md5salt":
if user.Salt == "" {
user.Salt = RandStr32()
}
user.Pass = Md5Str(Md5Str(user.Pass) + user.Salt)
}
}
func IsExpired(expireTime time.Time) bool {
return expireTime.Before(time.Now())
}
func CheckCookiesAndUpdate(cookie *TabCookie_) bool {
if !IsExpired(cookie.ExpiresAt) {
if cookie.Remember {
cookiewhere := TabCookie_{
ID: cookie.ID,
}
cookieupdata := TabCookie_{
UpdatedAt: time.Now(),
ExpiresAt: time.Now().Add(time.Duration(ConfigsUser.CookieTimeout) * time.Second),
}
DB.Where(&cookiewhere).Updates(&cookieupdata)
}
return true
} else {
//以过期
return false
}
//return false
}
// 判断邮箱是否合法
func IsEmailValid(email string) bool {