diff --git a/server/internal/controller/admin/common/site.go b/server/internal/controller/admin/common/site.go index 379c82c..7b5c2f9 100644 --- a/server/internal/controller/admin/common/site.go +++ b/server/internal/controller/admin/common/site.go @@ -7,18 +7,19 @@ package common import ( "context" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/net/ghttp" - "github.com/gogf/gf/v2/text/gstr" - "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/gmode" "hotgo/api/admin/common" "hotgo/internal/consts" "hotgo/internal/library/captcha" "hotgo/internal/library/token" "hotgo/internal/service" "hotgo/utility/validate" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" + "github.com/gogf/gf/v2/util/gmode" ) var Site = cSite{} @@ -102,7 +103,7 @@ func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) ( return } - if !req.IsLock && login.CaptchaSwitch == 1 { + if !req.IsLock && login.CaptchaSwitch == consts.StatusEnabled { // 校验 验证码 if !captcha.Verify(req.Cid, req.Code) { err = gerror.New("验证码错误") diff --git a/server/internal/logic/admin/member.go b/server/internal/logic/admin/member.go index 1104bc3..b7132c8 100644 --- a/server/internal/logic/admin/member.go +++ b/server/internal/logic/admin/member.go @@ -629,17 +629,7 @@ func (s *sAdminMember) List(ctx context.Context, in *adminin.MemberListInp) (lis mod = mod.WhereBetween(cols.CreatedAt, gtime.New(in.CreatedAt[0]), gtime.New(in.CreatedAt[1])) } - totalCount, err = mod.Count() - if err != nil { - err = gerror.Wrap(err, "获取用户数据行失败!") - return - } - - if totalCount == 0 { - return - } - - if err = mod.Hook(hook.MemberInfo).Page(in.Page, in.PerPage).OrderDesc(cols.Id).Scan(&list); err != nil { + if err = mod.Hook(hook.MemberInfo).Page(in.Page, in.PerPage).OrderDesc(cols.Id).ScanAndCount(&list, &totalCount, true); err != nil { err = gerror.Wrap(err, "获取用户列表失败!") return }