"refactor(base): 移除用户模型中的SocketID字段并重构登录会话管理"
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"blazing/common/data/cache"
|
||||
"blazing/common/data/share"
|
||||
"blazing/cool"
|
||||
baseservice "blazing/modules/base/service"
|
||||
"blazing/modules/blazing/service"
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type SessionReq struct {
|
||||
@@ -58,15 +57,12 @@ func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (re
|
||||
}
|
||||
res1, err := baseservice.NewBaseSysUserService().GetSession(req.Email, req.Password)
|
||||
|
||||
if err != nil {
|
||||
res.Code = 400
|
||||
res.Msg = err.Error()
|
||||
}
|
||||
if res1 == nil {
|
||||
if err != nil || res1 == nil {
|
||||
res.Code = 400
|
||||
res.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
accountID := res1.ID
|
||||
retsid, sid, err := biazing_service.GetSessionId(accountID)
|
||||
if err != nil {
|
||||
@@ -77,7 +73,7 @@ func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (re
|
||||
|
||||
res.Session = retsid
|
||||
|
||||
if err := cache.NewSessionManager().SaveSession(sid, gconv.String(accountID)); err != nil {
|
||||
if err := share.ShareManager.SaveSession(sid, uint32(accountID)); err != nil {
|
||||
res.Code = 400
|
||||
res.Msg = err.Error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user