Browse Source

更新接口类型

lijian 2 years ago
parent
commit
28810a1e1d
2 changed files with 16 additions and 2 deletions
  1. 14 0
      services/apiprovider/actions.go
  2. 2 2
      services/mqttaccess/mqtt_provider.go

+ 14 - 0
services/apiprovider/actions.go

@@ -201,6 +201,20 @@ func SetDeviceStatus(device *models.Device, config *productconfig.ProductConfig,
 }
 
 // SendCommandToDevice send command to device
+/*
+{
+    "deviceCode": "5566",
+    "subDeviceId": "1",
+    "data": {
+        "cmd": "powerControl",
+        "params": {
+            "power": 1,
+            "temp":2
+        }
+    }
+}
+
+*/
 func SendCommandToDevice(device *models.Device, config *productconfig.ProductConfig,
 	urlparams martini.Params, req *http.Request, r render.Render) {
 	timeout := req.URL.Query().Get("timeout")

+ 2 - 2
services/mqttaccess/mqtt_provider.go

@@ -83,9 +83,9 @@ func (mp *MQTTProvider) OnDeviceMessage(deviceid, vendorId string, msgtype strin
 			case klink.DevSendAction:
 				processReportStatus(deviceid, vendorId, message)
 			case klink.DevLoginAction:
-				processDevLogin(deviceid)
+				_ = processDevLogin(deviceid)
 			case klink.DevLogoutAction:
-				processDevLogout(deviceid)
+				_ = processDevLogout(deviceid)
 			}
 		}
 	case "e":