mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 11:44:11 +08:00
增加 用户名或姓名或邮箱 搜索支持
This commit is contained in:
@@ -75,6 +75,11 @@ func Find(data interface{}, limit, page int) error {
|
||||
return xdb.Limit(limit, start).Find(data)
|
||||
}
|
||||
|
||||
func FindWhereCount(data interface{}, where string, args ...interface{}) int {
|
||||
n, _ := xdb.Where(where, args...).Count(data)
|
||||
return int(n)
|
||||
}
|
||||
|
||||
func FindWhere(data interface{}, limit int, page int, where string, args ...interface{}) error {
|
||||
if limit == 0 {
|
||||
return xdb.Where(where, args...).Find(data)
|
||||
|
@@ -62,7 +62,7 @@ func SettingSet(data interface{}) error {
|
||||
|
||||
func SettingGet(data interface{}) error {
|
||||
name := StructName(data)
|
||||
s := &Setting{Name: name}
|
||||
s := &Setting{}
|
||||
err := One("name", name, s)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@@ -186,7 +186,7 @@ func checkOtp(name, otp, secret string) bool {
|
||||
|
||||
totp := gotp.NewDefaultTOTP(secret)
|
||||
unix := time.Now().Unix()
|
||||
verify := totp.Verify(otp, int(unix))
|
||||
verify := totp.Verify(otp, unix)
|
||||
|
||||
return verify
|
||||
}
|
||||
|
Reference in New Issue
Block a user