All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(common/cool): 更新GetClient函数支持端口参数 更新GetClient函数签名以接收端口参数,并修改客户端映射键的计算方式, 添加GetClientOnly函数用于仅通过uid获取客户端。 fix(common/rpc): 修复RPC调用中的客户端获取方法 将GetClient调用替换为GetClientOnly,确保正确的客户端获取逻辑。 refactor(logic/controller): 重命名Port字段为UID并优化道具列表处理 将Controller结构体中的Port字段重命名为UID以更好地反映其用途, 优化GetUserItemList函数中道具列表的初始化和填充逻辑。 perf(logic): 调整性能分析web服务启动位置 将PprofWeb服务从全局启动移至调试模式下启动,优化服务配置。 refactor(logic/server): 更新服务器UID生成逻辑 修改Maincontroller的UID字段设置方式,使用服务器ID和端口组合生成唯一标识。 refactor(logic/service/player): 移除未使用的导入并优化怪物生成 移除未使用的service导入,优化怪物生成逻辑中的地图数据访问。 feat(logic/service/space): 添加PitS缓存映射并重构空间初始化 添加新的PitS字段
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package admin
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/service"
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
type ServerController struct {
|
|
*cool.Controller
|
|
}
|
|
|
|
func init() {
|
|
|
|
// 注册路由
|
|
cool.RegisterController(&ServerController{
|
|
&cool.Controller{
|
|
Prefix: "/admin/config/server",
|
|
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
|
Service: service.NewServerService(),
|
|
},
|
|
})
|
|
}
|
|
|
|
// quit 退出
|
|
type QuitSReq struct {
|
|
g.Meta `path:"/quit" method:"POST"`
|
|
ID uint32 `json:"id" v:"required#请选择要退出的服务器"`
|
|
//code 0是非强制,1是强制QuitReq
|
|
Code int `json:"code" v:"required#请选择退出类型"`
|
|
}
|
|
|
|
func (this *ServerController) Quit(ctx context.Context, req *QuitSReq) (res *cool.BaseRes, err error) {
|
|
res = &cool.BaseRes{}
|
|
serv := service.NewServerService().GetServerID(req.ID)
|
|
|
|
aa, ok := cool.GetClient(serv.OnlineID, serv.Port)
|
|
if ok && aa != nil { //如果已经存在且这个端口已经被存过
|
|
aa.QuitSelf(req.Code)
|
|
}
|
|
return res, nil
|
|
}
|