根据提供的code differences信息,我无法看到具体的代码变更内容,因此无法生成准确的commit message。请提供具体的代码差异信息。
不过,我可以提供一个符合Angular规范的中文commit message模板: ``` feat(scope): 新增功能描述 - 具体的功能点说明 - 变更的详细描述 - 影响的模块或组件 ``` 或者: ``` fix(scope): 修复问题描述 - 问题的具体表现 - 解决
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user