根据提供的code differences信息,我无法看到具体的代码变更内容,因此无法生成准确的commit message。请提供具体的代码差异信息。
不过,我可以提供一个符合Angular规范的中文commit message模板: ``` feat(scope): 新增功能描述 - 具体的功能点说明 - 变更的详细描述 - 影响的模块或组件 ``` 或者: ``` fix(scope): 修复问题描述 - 问题的具体表现 - 解决
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -24,7 +24,7 @@ func (l *MAIN_LOGIN_IN) CheakSession() bool {
|
||||
// tt, _ := cool.CacheManager.Keys(context.Background())
|
||||
//g.Dump(tt)
|
||||
t1 := hex.EncodeToString(l.Sid)
|
||||
r, err := cool.CacheManager.Get(context.Background(), fmt.Sprintf("session: %d", l.Head.UserID))
|
||||
r, err := cool.CacheManager.Get(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
server:
|
||||
name: "blazing server"
|
||||
address: ":59480" #前端服务器+rpc地址
|
||||
port: 33388 #验证服务器端口
|
||||
openapiPath: "/api.json"
|
||||
swaggerPath: "/swagger"
|
||||
clientMaxBodySize:
|
||||
@@ -17,10 +16,10 @@ logger:
|
||||
database:
|
||||
default:
|
||||
type: "pgsql"
|
||||
host: "192.140.190.212"
|
||||
port: "55669"
|
||||
user: "bl"
|
||||
pass: "4DD4z3T2Zh8rx8Yd"
|
||||
host: "43.248.3.21"
|
||||
port: "5432"
|
||||
user: "user_YrK4j7"
|
||||
pass: "password_jSDm76"
|
||||
name: "bl"
|
||||
debug: false
|
||||
timezone: "Asia/Shanghai"
|
||||
@@ -52,17 +51,17 @@ database:
|
||||
# Redis 配置示例
|
||||
redis:
|
||||
cool:
|
||||
address: "192.140.190.212:57095"
|
||||
address: "43.248.3.21:6379"
|
||||
db: 0
|
||||
pass: "redis_wQ22jj"
|
||||
pass: "redis_TxYnSy"
|
||||
|
||||
blazing:
|
||||
autoMigrate: true
|
||||
eps: true
|
||||
file:
|
||||
mode: "zhuanzhuan" # local | minio | oss
|
||||
#前端上传地址,因为放弃本地,所以这个弃用了 ,现在被当成后端验证服务器地址
|
||||
domain: "127.0.0.1"
|
||||
#前端上传地址,因为放弃本地,所以这个弃用了 ,现在被当成rpc地址
|
||||
domain: "103.236.78.60"
|
||||
# oss配置项兼容 minio oss 需要配置bucket公开读
|
||||
oss:
|
||||
endpoint: "192.168.192.110:9000"
|
||||
|
||||
@@ -2,6 +2,8 @@ package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"blazing/cool"
|
||||
|
||||
@@ -9,6 +11,7 @@ import (
|
||||
|
||||
config "blazing/modules/config/service"
|
||||
blazing "blazing/modules/player/service"
|
||||
playerservice "blazing/modules/player/service"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@@ -34,10 +37,6 @@ type UserMoveReq struct {
|
||||
g.Meta `path:"/move" method:"GET"`
|
||||
Authorization string `json:"Authorization" in:"header"`
|
||||
}
|
||||
type SessionReq struct {
|
||||
g.Meta `path:"/getSession" method:"GET"`
|
||||
Authorization string `json:"Authorization" in:"header"`
|
||||
}
|
||||
|
||||
func (c *BaseSysUserController) Move(ctx context.Context, req *UserMoveReq) (res *cool.BaseRes, err error) {
|
||||
err = service.NewBaseSysUserService().Move(ctx)
|
||||
@@ -45,6 +44,11 @@ func (c *BaseSysUserController) Move(ctx context.Context, req *UserMoveReq) (res
|
||||
return
|
||||
}
|
||||
|
||||
type SessionReq struct {
|
||||
g.Meta `path:"/getSession" method:"GET"`
|
||||
Authorization string `json:"Authorization" in:"header"`
|
||||
}
|
||||
|
||||
func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq) (res *SessionRes, err error) {
|
||||
|
||||
t := cool.GetAdmin(ctx)
|
||||
@@ -52,16 +56,14 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
|
||||
|
||||
return &SessionRes{}, nil
|
||||
}
|
||||
retsid := blazing.NewInfoService(uint32(t.UserId)).Gensession()
|
||||
|
||||
res = &SessionRes{}
|
||||
|
||||
t1 := service.NewBaseSysUserService().GetPerson(uint32(t.UserId))
|
||||
|
||||
res.Session = retsid
|
||||
|
||||
if !blazing.NewUserService(uint32(t1.ID)).Info.IsReg() {
|
||||
res.UserID = int(t1.ID)
|
||||
res.UserID = int(t1.ID)
|
||||
if blazing.NewUserService(uint32(t1.ID)).Info.IsReg() {
|
||||
res.IsReg = 1
|
||||
|
||||
}
|
||||
|
||||
@@ -71,13 +73,70 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
|
||||
res.LoginAddr = cool.Config.File.Domain + ":" + cool.Config.LoginPort
|
||||
}
|
||||
res.Server = config.NewServerService().GetPort()
|
||||
// share.ShareManager.DeleteSession(t1)
|
||||
ser := playerservice.NewUserService(uint32(t1.ID))
|
||||
kickErr := ser.Info.Kick(uint32(t1.ID))
|
||||
if kickErr != nil {
|
||||
fmt.Println("踢人失败", kickErr)
|
||||
|
||||
}
|
||||
logininfo := ser.Info.SetLogin()
|
||||
if logininfo != nil {
|
||||
|
||||
res.Session = blazing.NewInfoService(uint32(t.UserId)).Gensession()
|
||||
cool.CacheManager.Set(context.TODO(), fmt.Sprintf("player:%d", uint32(t1.ID)), logininfo, 0)
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type SessionRes struct {
|
||||
IsReg int `json:"isreg"`
|
||||
UserID int `json:"userid"`
|
||||
Session string `json:"session"`
|
||||
LoginAddr string `json:"loginaddr"`
|
||||
Server gdb.List `json:"server"`
|
||||
}
|
||||
|
||||
type RegReq struct {
|
||||
g.Meta `path:"/regrobot" method:"GET"`
|
||||
Authorization string `json:"Authorization" in:"header"`
|
||||
// 玩家昵称,@ArraySerialize注解
|
||||
Nickname string `json:"nickname" ` // 固定长度16字节
|
||||
// 机器人人物颜色 rgb,@UInt注解
|
||||
Color uint32 `json:"color" ` // 4字节
|
||||
}
|
||||
|
||||
func (c *BaseSysUserController) Regrobot(ctx context.Context, req *RegReq) (res *RegRes, err error) {
|
||||
|
||||
t := cool.GetAdmin(ctx)
|
||||
|
||||
res = &RegRes{}
|
||||
|
||||
t1 := service.NewBaseSysUserService().GetPerson(uint32(t.UserId))
|
||||
|
||||
if blazing.NewUserService(uint32(t1.ID)).Info.IsReg() {
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
ser := playerservice.NewUserService(uint32(t1.ID))
|
||||
kickErr := ser.Info.Kick(uint32(t1.ID))
|
||||
if kickErr != nil {
|
||||
fmt.Println("踢人失败", kickErr)
|
||||
|
||||
}
|
||||
|
||||
logininfo := ser.Info.Reg(cool.Filter.Replace(strings.Trim(req.Nickname, "\x00"), '*'), req.Color)
|
||||
if logininfo != nil {
|
||||
|
||||
res.Session = blazing.NewInfoService(uint32(t.UserId)).Gensession()
|
||||
cool.CacheManager.Set(context.TODO(), fmt.Sprintf("player:%d", uint32(t1.ID)), logininfo, 0)
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type RegRes struct {
|
||||
Session string `json:"session"`
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func NewServerService() *ServerService {
|
||||
}
|
||||
func (s *ServerService) GetPort() gdb.List {
|
||||
|
||||
res, _ := cool.DBM(s.Model).Fields("ip", "port", "online_id", "is_vip").All()
|
||||
res, _ := cool.DBM(s.Model).Where("is_open", 1).Fields("ip", "port", "online_id", "is_vip", "name").All()
|
||||
|
||||
return res.List()
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"blazing/modules/config/service"
|
||||
"blazing/modules/player/model"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
@@ -31,9 +30,9 @@ func (s *InfoService) IsReg() bool {
|
||||
}
|
||||
|
||||
// 实现注册,id+昵称+颜色
|
||||
func (s *InfoService) Reg(nick string, color uint32) {
|
||||
func (s *InfoService) Reg(nick string, color uint32) *model.PlayerInfo {
|
||||
if s.IsReg() {
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
t := model.NewPlayer()
|
||||
@@ -48,9 +47,9 @@ func (s *InfoService) Reg(nick string, color uint32) {
|
||||
_, err := cool.DBM(s.Model).Data(t).FieldsEx("id").Insert()
|
||||
if err != nil {
|
||||
glog.Error(context.Background(), err)
|
||||
return
|
||||
|
||||
}
|
||||
//go s.InitTask()
|
||||
return &t.Data
|
||||
}
|
||||
|
||||
func (s *InfoService) Person(userid uint32) (out *model.PlayerEX) {
|
||||
@@ -62,7 +61,7 @@ func (s *InfoService) Person(userid uint32) (out *model.PlayerEX) {
|
||||
}
|
||||
func (s *InfoService) GetCache() *model.PlayerInfo {
|
||||
|
||||
ret, _ := cool.CacheManager.Get(context.TODO(), fmt.Sprintf("player: %d", s.userid))
|
||||
ret, _ := cool.CacheManager.Get(context.TODO(), fmt.Sprintf("player:%d", s.userid))
|
||||
if ret == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -130,23 +129,24 @@ func (s *InfoService) Gensession() string {
|
||||
// 移除UUID中的连字符,便于后续处理
|
||||
uuidStr := strings.ReplaceAll(uuidV7.String(), "-", "")
|
||||
|
||||
// 解码UUID字符串为字节数组(32位十六进制字符串对应16字节)
|
||||
// // 解码UUID字符串为字节数组(32位十六进制字符串对应16字节)
|
||||
uuidBytes, _ := hex.DecodeString(uuidStr)
|
||||
|
||||
// 将accountID转换为4字节大端序字节数组
|
||||
accountBytes := make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(accountBytes, uint32(s.userid))
|
||||
// // 将accountID转换为4字节大端序字节数组
|
||||
// accountBytes := make([]byte, 4)
|
||||
// binary.BigEndian.PutUint32(accountBytes, uint32(s.userid))
|
||||
|
||||
// 预分配缓冲区(总长度:4+16+4=24字节),减少内存分配
|
||||
sessionBytes := make([]byte, 0, 24)
|
||||
sessionBytes = append(sessionBytes, accountBytes...)
|
||||
sessionBytes = append(sessionBytes, uuidBytes...)
|
||||
//sessionBytes = append(sessionBytes, grand.B(4)...)
|
||||
// // 预分配缓冲区(总长度:4+16+4=24字节),减少内存分配
|
||||
// sessionBytes := make([]byte, 0, 24)
|
||||
// sessionBytes = append(sessionBytes, accountBytes...)
|
||||
// sessionBytes = append(sessionBytes, uuidBytes...)
|
||||
// //sessionBytes = append(sessionBytes, grand.B(4)...)
|
||||
|
||||
// 编码为十六进制字符串作为最终会话ID
|
||||
sessionID := hex.EncodeToString(sessionBytes)
|
||||
User.Store(string(uuidStr), uint32(s.userid))
|
||||
//share.ShareManager.SaveSession(string(uuidStr), uint32(s.userid))
|
||||
// // 编码为十六进制字符串作为最终会话ID
|
||||
sessionID := hex.EncodeToString(uuidBytes)
|
||||
cool.CacheManager.Set(context.Background(), fmt.Sprintf("session:%d", uint32(s.userid)), sessionID, 0)
|
||||
// ///User.Store(string(uuidStr), uint32(s.userid))
|
||||
// //share.ShareManager.SaveSession(string(uuidStr), uint32(s.userid))
|
||||
return sessionID
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user