u
This commit is contained in:
1 parent
755fc20c9a
commit
a57070f860
9 files changed
+557
-93
No files matched your search
@@ -8,6 +8,8 @@ import (
|
||||
"cn/oneao/base-go/utils/jwtx"
|
||||
"cn/oneao/base-go/utils/response"
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
auth "cn/oneao/base-go/biz/model/auth"
|
||||
|
||||
@@ -25,13 +27,18 @@ func LoginDefault(ctx context.Context, c *app.RequestContext) {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
// 处理登录
|
||||
// 假设 ctx 已有,req.Account / req.Password 已有
|
||||
start := time.Now()
|
||||
|
||||
loginUser, err := db.Client.UserInfo.
|
||||
Query().
|
||||
Where(userinfo.AccountEQ(req.Account),
|
||||
userinfo.PasswordEQ(req.Password)).
|
||||
Only(ctx)
|
||||
|
||||
duration := time.Since(start) // 耗时
|
||||
fmt.Printf("登录查询: (耗时: %v)\n", duration)
|
||||
|
||||
if err != nil {
|
||||
c.String(consts.StatusInternalServerError, "账号或密码错误")
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user