mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 06:32:04 +08:00
增加 用户名或姓名或邮箱 搜索支持
This commit is contained in:
@@ -36,7 +36,7 @@ func Login(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
totp := gotp.NewDefaultTOTP(base.Cfg.AdminOtp)
|
||||
unix := time.Now().Unix()
|
||||
verify := totp.Verify(otp, int(unix))
|
||||
verify := totp.Verify(otp, unix)
|
||||
|
||||
if !verify {
|
||||
RespError(w, RespUserOrPassErr)
|
||||
|
@@ -38,11 +38,11 @@ func UserList(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// 查询前缀匹配
|
||||
if len(prefix) > 0 {
|
||||
prefixFuzzy := "%" + prefix + "%"
|
||||
fuzzy := "%" + prefix + "%"
|
||||
where := "username LIKE ? OR nickname LIKE ? OR email LIKE ?"
|
||||
|
||||
count = dbdata.FindWhereCount(&dbdata.User{}, where, prefixFuzzy, prefixFuzzy, prefixFuzzy)
|
||||
err = dbdata.FindWhere(&datas, pageSize, page, where, prefixFuzzy, prefixFuzzy, prefixFuzzy)
|
||||
count = dbdata.FindWhereCount(&dbdata.User{}, where, fuzzy, fuzzy, fuzzy)
|
||||
err = dbdata.FindWhere(&datas, pageSize, page, where, fuzzy, fuzzy, fuzzy)
|
||||
} else {
|
||||
count = dbdata.CountAll(&dbdata.User{})
|
||||
err = dbdata.Find(&datas, pageSize, page)
|
||||
|
Reference in New Issue
Block a user