初步实现安装界面

This commit is contained in:
刘祥超
2020-10-13 20:05:13 +08:00
parent 6d268d0b73
commit 0e3330e1c6
76 changed files with 2550 additions and 88 deletions

View File

@@ -24,22 +24,30 @@ func NewServerGroupDAO() *ServerGroupDAO {
}).(*ServerGroupDAO)
}
var SharedServerGroupDAO = NewServerGroupDAO()
var SharedServerGroupDAO *ServerGroupDAO
func init() {
dbs.OnReady(func() {
SharedServerGroupDAO = NewServerGroupDAO()
})
}
// 启用条目
func (this *ServerGroupDAO) EnableServerGroup(id uint32) (rowsAffected int64, err error) {
return this.Query().
func (this *ServerGroupDAO) EnableServerGroup(id uint32) error {
_, err := this.Query().
Pk(id).
Set("state", ServerGroupStateEnabled).
Update()
return err
}
// 禁用条目
func (this *ServerGroupDAO) DisableServerGroup(id uint32) (rowsAffected int64, err error) {
return this.Query().
func (this *ServerGroupDAO) DisableServerGroup(id uint32) error {
_, err := this.Query().
Pk(id).
Set("state", ServerGroupStateDisabled).
Update()
return err
}
// 查找启用中的条目
@@ -56,9 +64,8 @@ func (this *ServerGroupDAO) FindEnabledServerGroup(id uint32) (*ServerGroup, err
// 根据主键查找名称
func (this *ServerGroupDAO) FindServerGroupName(id uint32) (string, error) {
name, err := this.Query().
return this.Query().
Pk(id).
Result("name").
FindCol("")
return name.(string), err
FindStringCol("")
}