From a335f66c4c520728be640ca4e7029ce6f45b8f3d Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期五, 11 八月 2023 11:21:32 +0800 Subject: [PATCH] web 接口添加token --- msg/msg.go | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 42 insertions(+), 5 deletions(-) diff --git a/msg/msg.go b/msg/msg.go index 0a68244..09d2504 100644 --- a/msg/msg.go +++ b/msg/msg.go @@ -1,9 +1,46 @@ package msg type PLCDevice struct { - Id string - Name string - Ip string - Address []int // 鏁版嵁鍦板潃 - Interval int // 閲囬泦鐨勬椂闂撮棿闅�. 绉� + DeviceID string `json:"deviceId"` + DeviceName string `json:"deviceName"` + DeviceIP string `json:"deviceIp"` + Brand string `json:"brand"` + Method string `json:"method"` + PortName string `json:"portName"` + Frequency int `json:"frequency"` // 鏁版嵁鏇存柊棰戠巼 0-瀹炴椂鏇存柊 1-1娆�/绉�" + Status int `json:"status"` + Details []*PLCAddress `gorm:"-" json:"Details"` +} + +type PLCAddress struct { + StartAddress int `json:"startAddress"` // 鏁版嵁璧峰鍦板潃 + Length int `json:"length"` // 鏁版嵁闀垮害 + Type string `json:"type"` // 鏁版嵁绫诲瀷 + FieldName string `json:"fieldName"` // 瀵瑰簲绯荤粺瀛楁 +} + +type PLCResponse struct { + DeviceID string `json:"deviceId"` + DeviceName string `json:"deviceName"` + DeviceIP string `json:"deviceIp"` + Online bool `json:"online"` + Message string `json:"message"` + PLCData []PLCData `json:"plcData"` +} + +type PLCData struct { + StartAddress int `json:"startAddress"` // 鏁版嵁璧峰鍦板潃 + Length int `json:"length"` // 鏁版嵁闀垮害 + Type string `json:"type"` // 鏁版嵁绫诲瀷 + FieldName string `json:"fieldName"` // 瀵瑰簲绯荤粺瀛楁 + RawData []byte `json:"rawData"` // 浠巔lc璇诲彇鐨勫師濮嬫暟鎹� +} + +type ApsDeviceApiResponse struct { + Code int `json:"code"` + Data []PLCDevice `json:"data"` + Msg string `json:"msg"` + Page int `json:"page"` + PageSize int `json:"pageSize"` + Total int `json:"total"` } -- Gitblit v1.8.0