refactor: 重构运行时ID组合逻辑
将硬编码的 ID 组合逻辑(100000*OnlineID + Port)提取为通用函数 ComposeRuntimeID, 使用 16 位位移掩码优化,并新增辅助方法与类型转换。同时修复踢人流程中的资源清理问题。
This commit is contained in:
@@ -167,6 +167,15 @@ func (s *ServerService) StartUPdate(OnlineID uint16, isinstall int) model.Server
|
||||
return tttt
|
||||
}
|
||||
|
||||
func (s *ServerService) SetServerOpen(OnlineID uint32, isOpen uint8) error {
|
||||
m := cool.DBM(s.Model).Where("online_id", OnlineID)
|
||||
var tttt model.ServerList
|
||||
m.Scan(&tttt)
|
||||
tttt.IsOpen = isOpen
|
||||
_, err := m.Save(tttt)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *ServerService) SetServerID(OnlineID uint32, Port uint32) error {
|
||||
m := cool.DBM(s.Model).Where("online_id", OnlineID)
|
||||
var tttt model.ServerList
|
||||
|
||||
Reference in New Issue
Block a user