示例#1
0
文件: device.go 项目: icsnju/apt-core
func (this *DeviceController) GetDeviceIP() {
	id := this.Ctx.Input.Param(":id")
	_, ip, err := master.GetDevice(id)
	if err != nil {
		this.Ctx.Output.SetStatus(404)
		this.Ctx.Output.Body([]byte("Device not found"))
		return
	}
	this.Ctx.Output.Body([]byte(ip))
}
示例#2
0
文件: device.go 项目: icsnju/apt-core
func (this *DeviceController) GetDevice() {
	id := this.Ctx.Input.Param(":id")
	device, _, err := master.GetDevice(id)
	if err != nil {
		this.Ctx.Output.SetStatus(404)
		this.Ctx.Output.Body([]byte("Device not found"))
		return
	}
	this.Data["json"] = device
	this.ServeJSON()
}