package model import ( "admin/internal/db" "admin/internal/global" "time" ) func init() { db.RegisterTableModels(Server{}) } // Server 逻辑服 type Server struct { ID int `gorm:"primarykey" readonly:"true"` ProjectId int `gorm:"uniqueIndex:idx_server"` ServerConfID string `gorm:"type:varchar(200);uniqueIndex:idx_server" name:"区服id" required:"true" uneditable:"true"` Desc string `name:"描述"` RunningStatus string `name:"进程运行状态" desc:"进程运行状态:未知、运行中、停止" readonly:"true" uneditable:"true"` Ccu int `name:"实时在线" desc:"ccu" readonly:"true" uneditable:"true"` TotalRoleCount int `name:"总角色数" desc:"" readonly:"true" uneditable:"true"` TotalAccountCount int `name:"总账号数" desc:"" readonly:"true" uneditable:"true"` IsServerDown bool `name:"停服维护中" desc:"" readonly:"true" uneditable:"true"` // command_list接口服务器地址,为空代表由由项目统一提供command_list. // 取决于每个项目改造难度: // 为空就代表项目要实现一个自己统一对外暴露的gm调用服务对内聚合、分发指令执行,本后台执行指令只调用一次; // 不为空就代表command_list实现在各个逻辑服,由本后台系统在执行指令时聚合、分发指令 // 调用各个逻辑服执行,本后台执行指令需要根据逻辑服数量调用; //ApiAddr string CreatedAt time.Time `readonly:"true"` } func (lm *Server) TableName() string { return "server" } func (m *Server) GetId() int { return m.ID } func (m *Server) ListByProjectId(projectId int) ([]*Server, error) { list := make([]*Server, 0) err := global.GLOB_DB.Where("project_id=?", projectId).Find(&list).Error return list, err }