refactor: 将端口和在线ID类型从uint16改为uint32
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
This commit is contained in:
@@ -13,18 +13,18 @@ type sConfig struct {
|
||||
File *file `json:"file,omitempty"` // 文件上传配置
|
||||
Name string `json:"name"` // 项目名称
|
||||
// LoginPort string `json:"port"`
|
||||
GameOnlineID uint16 `json:"port_bl"` //这个是命令行输入的参数
|
||||
GameOnlineID uint32 `json:"port_bl"` //这个是命令行输入的参数
|
||||
ServerInfo ServerList
|
||||
|
||||
Address string //rpc端口
|
||||
|
||||
}
|
||||
type ServerList struct {
|
||||
OnlineID uint16 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
||||
OnlineID uint32 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
||||
//服务器名称Desc
|
||||
Name string `gorm:"comment:'服务器名称'" json:"name"`
|
||||
IP string `gorm:"type:string;comment:'服务器IP'" json:"ip"`
|
||||
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
||||
Port uint32 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
||||
IsOpen uint8 `gorm:"default:0;not null;comment:'是否开启'" json:"is_open"`
|
||||
//登录地址
|
||||
LoginAddr string `gorm:"type:string;comment:'登录地址'" json:"login_addr"`
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package cool
|
||||
|
||||
// 存值示例
|
||||
func AddClient(id uint16, client *ClientHandler) {
|
||||
func AddClient(id uint32, client *ClientHandler) {
|
||||
// 普通map:Clientmap[id] = client
|
||||
Clientmap.Store(id, client) // sync.Map存值
|
||||
}
|
||||
|
||||
// 取值示例
|
||||
func GetClient(id uint16) (*ClientHandler, bool) {
|
||||
func GetClient(id uint32) (*ClientHandler, bool) {
|
||||
// 普通map:client, ok := Clientmap[id]
|
||||
val, ok := Clientmap.Load(id) // sync.Map取值
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user