版本封存
This commit is contained in:
36
cmii-uav-watchdog/services/cmii_service.go
Normal file
36
cmii-uav-watchdog/services/cmii_service.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"cmii-uav-watchdog-common/models"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// CMIIService CMII服务
|
||||
type CMIIService struct {
|
||||
authService *AuthService
|
||||
}
|
||||
|
||||
// NewCMIIService 创建CMII服务
|
||||
func NewCMIIService() *CMIIService {
|
||||
return &CMIIService{
|
||||
authService: NewAuthService(),
|
||||
}
|
||||
}
|
||||
|
||||
// HandleHostInfo 处理主机信息
|
||||
func (cs *CMIIService) HandleHostInfo(c *gin.Context) {
|
||||
|
||||
// 获取主机信息
|
||||
hostInfo := cs.authService.GetAllHostInfo()
|
||||
|
||||
// 返回单纯的主机信息
|
||||
hostInfoList := make([]models.HostInfo, 0)
|
||||
for _, host := range hostInfo {
|
||||
hostInfoList = append(hostInfoList, host)
|
||||
}
|
||||
|
||||
// 返回主机信息
|
||||
c.JSON(http.StatusOK, hostInfoList)
|
||||
}
|
||||
Reference in New Issue
Block a user