package vo
|
|
import (
|
"database/sql/driver"
|
"encoding/json"
|
"errors"
|
)
|
|
// 直接注册的采集设备, Device包含这些设备, 分开存只是为了级联上报
|
type Ape struct {
|
ApeID string `json:"ApeID" binding:"required"`
|
Name string `json:"Name"`
|
Model string `json:"Model"`
|
IPAddr string `json:"IPAddr"`
|
IPV6Addr string `json:"IPV6Addr"`
|
Port int `json:"Port"`
|
Longitude float64 `json:"Longitude"`
|
Latitude float64 `json:"Latitude"`
|
PlaceCode string `json:"PlaceCode"`
|
Place string `json:"Place"`
|
OrgCode string `json:"OrgCode"`
|
CapDirection int `json:"CapDirection"`
|
MonitorDirection string `json:"MonitorDirection"`
|
MonitorAreaDesc string `json:"MonitorAreaDesc"`
|
IsOnline string `json:"IsOnline"`
|
OwnerApsID string `json:"OwnerApsID"`
|
UserID string `json:"UserId"`
|
Password string `json:"Password"`
|
FunctionType string `json:"FunctionType"`
|
PositionType string `json:"PositionType"`
|
}
|
|
func (a *Ape) Scan(value interface{}) error {
|
b, ok := value.([]byte)
|
if !ok {
|
return errors.New("failed to unmarshal Author value")
|
}
|
var config Ape
|
err := json.Unmarshal(b, &config)
|
if err != nil {
|
return err
|
}
|
*a = config
|
return nil
|
}
|
|
func (a Ape) Value() (driver.Value, error) {
|
return json.Marshal(a)
|
}
|
|
type RequestApeList struct {
|
APEListObject struct {
|
APEObject []Ape `json:"APEObject"`
|
} `json:"APEListObject"`
|
}
|
|
type NotificationApeList struct {
|
APEObject []Ape `json:"APEObject"`
|
}
|
|
type ApeStatus struct {
|
ApeID string `json:"ApeID" binding:"required"`
|
IsOnline string `json:"IsOnline" binding:"required"`
|
CurrentTime string `json:"CurrentTime" binding:"required"`
|
}
|
|
type NotificationApeStatusList struct {
|
APEStatusObject []ApeStatus `json:"APEStatusObject"`
|
}
|