| | |
| | | Id string `gorm:"column:id;primary_key;" json:"id"` |
| | | Name string `gorm:"column:name" json:"name"` |
| | | Addr string `gorm:"column:addr" json:"addr"` |
| | | Pos string `gorm:"column:pos" json:"pos"` |
| | | Floor string `gorm:"column:pos" json:"pos"` |
| | | Ext string `gorm:"column:ext" json:"ext"` |
| | | Ip string `gorm:"column:ip" json:"ip"` |
| | | CreateTime int64 `gorm:"column:create_time;autoCreateTime;" json:"-"` |
| | |
| | | } |
| | | } else { |
| | | // 记录存在,更新现有记录 |
| | | if d.Pos == "" || d.Ip == "" { |
| | | if d.Floor == "" || d.Ip == "" { |
| | | return nil |
| | | } |
| | | |
| | | existingDevice.Pos = d.Pos |
| | | existingDevice.Floor = d.Floor |
| | | existingDevice.Ip = d.Ip |
| | | |
| | | db.Save(&existingDevice) |
| | | } |
| | | |
| | | // 记录位置的历史, 给人脸抓拍匹配楼层 |
| | | if existingDevice.Pos != "" { |
| | | if existingDevice.Floor != "" { |
| | | var pos = Positions{ |
| | | DeviceId: d.Id, |
| | | Pos: d.Pos, |
| | | Pos: d.Floor, |
| | | CreateTime: time.Now().Unix(), |
| | | TimeString: time.Now().Format("2006-01-02 15:04:05"), |
| | | } |