feat(coolconfig): 修改端口配置字段名称

将配置结构体中的Port字段重命名为LoginPort,以更准确地反映其用途
作为登录端口配置,避免与GameOnlineID字段的注释混淆
```
This commit is contained in:
昔念
2026-01-20 16:59:23 +08:00
parent 07d25b3e96
commit 8049e273f6
8 changed files with 25 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ type sConfig struct {
Eps bool `json:"eps,omitempty"` // 是否开启eps Eps bool `json:"eps,omitempty"` // 是否开启eps
File *file `json:"file,omitempty"` // 文件上传配置 File *file `json:"file,omitempty"` // 文件上传配置
Name string `json:"name"` // 项目名称 Name string `json:"name"` // 项目名称
Port string `json:"port"` LoginPort string `json:"port"`
GameOnlineID uint16 `json:"port_bl"` //这个是命令行输入的参数 GameOnlineID uint16 `json:"port_bl"` //这个是命令行输入的参数
ServerInfo ServerList ServerInfo ServerList
@@ -70,7 +70,7 @@ func newConfig() *sConfig {
AutoMigrate: GetCfgWithDefault(ctx, "blazing.autoMigrate", g.NewVar(false)).Bool(), AutoMigrate: GetCfgWithDefault(ctx, "blazing.autoMigrate", g.NewVar(false)).Bool(),
Name: GetCfgWithDefault(ctx, "server.name", g.NewVar("")).String(), Name: GetCfgWithDefault(ctx, "server.name", g.NewVar("")).String(),
Eps: GetCfgWithDefault(ctx, "blazing.eps", g.NewVar(false)).Bool(), Eps: GetCfgWithDefault(ctx, "blazing.eps", g.NewVar(false)).Bool(),
Port: string(GetCfgWithDefault(ctx, "server.port", g.NewVar("8080")).String()), LoginPort: string(GetCfgWithDefault(ctx, "server.port", g.NewVar("8080")).String()),
RPC: GetCfgWithDefault(ctx, "server.rpc", g.NewVar("8080")).Uint16(), RPC: GetCfgWithDefault(ctx, "server.rpc", g.NewVar("8080")).Uint16(),
//GamePort: GetCfgWithDefault(ctx, "server.game", g.NewVar("8080")).Uint64s(), //GamePort: GetCfgWithDefault(ctx, "server.game", g.NewVar("8080")).Uint64s(),

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,6 @@ import (
"blazing/common/data/share" "blazing/common/data/share"
"blazing/cool" "blazing/cool"
"blazing/modules/base/service"
"context" "context"
"fmt" "fmt"
"log" "log"
@@ -85,7 +84,7 @@ func StartClient(id, port uint16, callback any) *struct {
RegisterLogic func(uint16, uint16) error RegisterLogic func(uint16, uint16) error
} { } {
var rpcaddr, _ = service.NewBaseSysParamService().DataByKey(context.Background(), "server_ip") var rpcaddr = cool.Config.File.Domain
//rpcaddr = "127.0.0.1" //rpcaddr = "127.0.0.1"
closer1, err := jsonrpc.NewMergeClient(context.Background(), closer1, err := jsonrpc.NewMergeClient(context.Background(),
"ws://"+rpcaddr+":"+rpcport, "", []interface{}{ "ws://"+rpcaddr+":"+rpcport, "", []interface{}{

View File

@@ -71,14 +71,14 @@ func Start() {
socket.WithCORS(), socket.WithCORS(),
socket.WithPort(port), socket.WithPort(port),
) )
// go func() {
rpcClient := rpc.StartClient(serverID, uint16(port), server) rpcClient := rpc.StartClient(serverID, uint16(port), server) //连接rpc
controller.Maincontroller.RPCClient = *rpcClient //将RPC赋值Start controller.Maincontroller.RPCClient = *rpcClient //将RPC赋值Start
controller.Maincontroller.Port = uint16(port) //赋值服务器ID controller.Maincontroller.Port = uint16(port) //赋值服务器ID
controller.Init(true) controller.Init(true)
xmlres.Initfile() xmlres.Initfile()
config.NewServerService().SetServerID(serverID, gconv.Uint16(port)) config.NewServerService().SetServerID(serverID, gconv.Uint16(port)) //设置当前服务器端口
server.Boot() server.Boot()
} }

View File

@@ -9,7 +9,7 @@ import (
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
) )
var defaultPort = gconv.Int(cool.Config.Port) //读入默认的端口 var defaultPort = gconv.Int(cool.Config.LoginPort) //读入默认的端口
func reg() { func reg() {
go rpc.StartServer() go rpc.StartServer()
controller.Init(false) controller.Init(false)

View File

@@ -1,12 +1,12 @@
server: server:
name: "blazing server" name: "blazing server"
address: ":59480" #服务器地址 address: ":59480" #服务器地址
port: 53388 #后台服务器端口 port: 53388 #验证服务器端口
rpc: 56409 #rpc服务端口 rpc: 56409 #rpc服务端口
openapiPath: "/api.json" openapiPath: "/api.json"
swaggerPath: "/swagger" swaggerPath: "/swagger"
clientMaxBodySize: clientMaxBodySize:
104857600 # 100MB in bytes 100*1024*1024 1048576 # 100MB in bytes 1*1024*1024
# 平滑重启特性 # 平滑重启特性
graceful: true # 是否开启平滑重启特性开启时将会在本地增加10000的本地TCP端口用于进程间通信默认false graceful: true # 是否开启平滑重启特性开启时将会在本地增加10000的本地TCP端口用于进程间通信默认false
gracefulTimeout: 2 # 父进程在平滑重启后多少秒退出默认2秒若请求耗时大于该值可能会导致请求中断 gracefulTimeout: 2 # 父进程在平滑重启后多少秒退出默认2秒若请求耗时大于该值可能会导致请求中断
@@ -18,7 +18,7 @@ logger:
database: database:
default: default:
type: "pgsql" type: "pgsql"
host: "125.208.20.223" host: "192.140.190.212"
port: "55669" port: "55669"
user: "bl" user: "bl"
pass: "4DD4z3T2Zh8rx8Yd" pass: "4DD4z3T2Zh8rx8Yd"
@@ -53,7 +53,7 @@ database:
# Redis 配置示例 # Redis 配置示例
redis: redis:
cool: cool:
address: "125.208.20.223:57095" address: "192.140.190.212:57095"
db: 0 db: 0
pass: "redis_wQ22jj" pass: "redis_wQ22jj"
@@ -61,8 +61,9 @@ blazing:
autoMigrate: true autoMigrate: true
eps: true eps: true
file: file:
mode: "local" # local | minio | oss mode: "zhuanzhuan" # local | minio | oss
domain: "http://127.0.0.1:8002" #前端上传地址,因为放弃本地,所以这个弃用了 ,现在被当成后端验证服务器地址
domain: "192.140.190.212"
# oss配置项兼容 minio oss 需要配置bucket公开读 # oss配置项兼容 minio oss 需要配置bucket公开读
oss: oss:
endpoint: "192.168.192.110:9000" endpoint: "192.168.192.110:9000"

View File

@@ -64,7 +64,9 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
} }
if cool.Config.ServerInfo.IsDebug != 0 { if cool.Config.ServerInfo.IsDebug != 0 {
res.IsDebug = 1 res.LoginAddr = "192.168.1.44:53888"
} else {
res.LoginAddr = cool.Config.File.Domain + ":" + cool.Config.LoginPort
} }
return return
@@ -73,6 +75,6 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
type SessionRes struct { type SessionRes struct {
UserID int `json:"userid"` UserID int `json:"userid"`
Session string `json:"session"` Session string `json:"session"`
IsDebug int `json:"isDebug"` LoginAddr string `json:"loginaddr"`
//Server model.ServerList `json:"server"` //Server model.ServerList `json:"server"`
} }

View File

@@ -40,7 +40,9 @@ func init() {
g.Server().BindMiddleware("/admin/*", BaseAuthorityMiddleware) g.Server().BindMiddleware("/admin/*", BaseAuthorityMiddleware)
// g.Server().BindMiddleware("/*", AutoI18n) // g.Server().BindMiddleware("/*", AutoI18n)
g.Server().BindMiddleware("/*", MiddlewareCORS) g.Server().BindMiddleware("/*", MiddlewareCORS)
// g.Server().BindMiddleware("/getip", func(r *ghttp.Request) {
// r.Response.Write(cool.Config.File.Domain + ":" + gconv.String(cool.Config.LoginPort))
// })
} }
if config.Config.Middleware.Log.Enable { if config.Config.Middleware.Log.Enable {
g.Server().BindMiddleware("/admin/*", BaseLog) g.Server().BindMiddleware("/admin/*", BaseLog)