版本预发布

This commit is contained in:
孟帅
2023-02-08 20:29:34 +08:00
parent f11c7c5bf2
commit 2068d05c93
269 changed files with 16122 additions and 12075 deletions

View File

@@ -8,11 +8,36 @@ package simple
import (
"context"
"github.com/gogf/gf/v2/crypto/gmd5"
"github.com/gogf/gf/v2/encoding/gbase64"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts"
"hotgo/utility/encrypt"
)
// CheckPassword 检查密码
func CheckPassword(input, salt, hash string) (err error) {
// 解密密码
password, err := gbase64.Decode([]byte(input))
if err != nil {
return err
}
password, err = encrypt.AesECBDecrypt(password, consts.RequestEncryptKey)
if err != nil {
return err
}
if hash != gmd5.MustEncryptString(string(password)+salt) {
err = gerror.New("用户密码不正确")
return
}
return
}
func SafeGo(ctx context.Context, f func(ctx context.Context), level ...interface{}) {
go func() {
defer func() {

View File

@@ -59,7 +59,7 @@ func GetAddr(ctx context.Context) string {
func GetDomain(ctx context.Context) string {
r := ghttp.RequestFromCtx(ctx)
if r == nil {
g.Log().Warningf(ctx, "GetDomain ctx not request")
g.Log().Info(ctx, "GetDomain ctx not request")
return ""
}
if validate.IsDNSName(r.Host) {

View File

@@ -25,7 +25,7 @@ func IsDNSName(s string) bool {
func IsHTTPS(ctx context.Context) bool {
r := ghttp.RequestFromCtx(ctx)
if r == nil {
g.Log().Warningf(ctx, "IsHTTPS ctx not request")
g.Log().Infof(ctx, "IsHTTPS ctx not request")
return false
}
var (