1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-07 21:51:34 +08:00
parent 7d7cc0d174
commit d83d76ca8e
5 changed files with 17 additions and 37 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strings"
"time"
"blazing/cool"
@@ -71,24 +70,10 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
res.PetID = dict.NewDictInfoService().GetShiny()
res.Server = config.NewServerService().GetPort(int(t1.Debug))
// share.ShareManager.DeleteSession(t1)
ser := playerservice.NewUserService(uint32(t1.ID))
res.Session = blazing.NewInfoService(uint32(t.UserId)).Gensession()
defer func() {
kickErr := ser.Info.Kick(uint32(t1.ID))
if kickErr != nil {
fmt.Println("踢人失败", kickErr)
}
logininfo := ser.Info.SetLogin()
if logininfo != nil {
cool.CacheManager.Set(context.Background(), fmt.Sprintf("session:%d", uint32(t1.ID)), res.Session, 0)
cool.CacheManager.Set(context.TODO(), fmt.Sprintf("player:%d", uint32(t1.ID)), logininfo, 10*time.Minute)
}
}()
cool.CacheManager.Set(context.Background(), fmt.Sprintf("session:%d", uint32(t1.ID)), res.Session, 0)
return
}

View File

@@ -7,7 +7,6 @@ import (
"blazing/modules/player/model"
"context"
"encoding/hex"
"fmt"
"strings"
@@ -59,17 +58,7 @@ func (s *InfoService) Person(userid uint32) (out *model.Player) {
return
}
func (s *InfoService) GetCache() *model.PlayerInfo {
ret, _ := cool.CacheManager.Get(context.TODO(), fmt.Sprintf("player:%d", s.userid))
if ret == nil {
return nil
}
var rets *model.PlayerInfo
ret.Struct(&rets)
return rets
}
func (s *InfoService) SetLogin() *model.PlayerInfo {
m := cool.DBM(s.Model).Where("player_id", s.userid)