Files
crawlab/backend/services/msg_handler/msg_system_info.go
yaziming ee808e0e60 refactor(all): refactor code
remove redundant code and some code refactor
2019-10-11 16:01:57 +08:00

30 lines
524 B
Go

package msg_handler
import (
"crawlab/constants"
"crawlab/database"
"crawlab/entity"
"crawlab/model"
)
type SystemInfo struct {
msg entity.NodeMessage
}
func (s *SystemInfo) Handle() error {
// 获取环境信息
sysInfo, err := model.GetLocalSystemInfo()
if err != nil {
return err
}
msgSd := entity.NodeMessage{
Type: constants.MsgTypeGetSystemInfo,
NodeId: s.msg.NodeId,
SysInfo: sysInfo,
}
if err := database.Pub(constants.ChannelMasterNode, msgSd); err != nil {
return err
}
return nil
}