|
@@ -3,6 +3,8 @@ package controllers
|
|
import (
|
|
import (
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "sparrow/pkg/rpcs"
|
|
|
|
+ "sparrow/pkg/server"
|
|
"sparrow/services/knowoapi/services"
|
|
"sparrow/services/knowoapi/services"
|
|
"strconv"
|
|
"strconv"
|
|
"time"
|
|
"time"
|
|
@@ -47,6 +49,33 @@ func (a *DeviceController) Get() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//获取设备在线状态
|
|
|
|
+// GET /devicestatus?device_id=
|
|
|
|
+func (a *DeviceController) GetDevicestatus() {
|
|
|
|
+
|
|
|
|
+ deviceid, err := a.Ctx.URLParamInt("device_id")
|
|
|
|
+ if err != nil {
|
|
|
|
+ deviceid = 0
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onlineargs := rpcs.ArgsGetDeviceOnlineStatus{
|
|
|
|
+ Id: uint64(deviceid),
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onlinereply := rpcs.ReplyGetDeviceOnlineStatus{}
|
|
|
|
+ err = server.RPCCallByName(nil, "devicemanager", "DeviceManager.GetDeviceOnlineStatus", onlineargs, &onlinereply)
|
|
|
|
+ if err != nil {
|
|
|
|
+ server.Log.Errorf("get devie online status error: %v", err)
|
|
|
|
+ responseError(a.Ctx, ErrDatabase, err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ done(a.Ctx, map[string]interface{}{
|
|
|
|
+ "status": onlinereply,
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
// GetBannerdata 获取设备激活和活跃数据
|
|
// GetBannerdata 获取设备激活和活跃数据
|
|
// GET /bannerdata?proid=
|
|
// GET /bannerdata?proid=
|
|
func (a *DeviceController) GetBannerdata() {
|
|
func (a *DeviceController) GetBannerdata() {
|