zhangzengfei
2024-10-22 a254bc563003a9e7b3a8f1307df38b8ae4274a4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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"`
}