add dbm new model and fixed json_data
This commit is contained in:
@@ -18,7 +18,7 @@ func (d *DBMHandler) Subscribe(req *json_dataModels.Request, id string) {
|
||||
resp.Id = req.Id
|
||||
|
||||
for _, sub := range req.Subscribe {
|
||||
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
|
||||
for _, dp := range d.DBM.QueryDatapoints(sub.Depth, sub.Uuid, sub.Path) {
|
||||
if sub.Driver != "" {
|
||||
if dp.Drivers == nil || dp.Drivers[sub.Driver] == nil {
|
||||
continue
|
||||
@@ -51,9 +51,10 @@ func (d *DBMHandler) Unsubscribe(req *json_dataModels.Request, id string) {
|
||||
defer d.RUnlock()
|
||||
|
||||
resp := json_dataModels.NewResponse()
|
||||
resp.Id = req.Id
|
||||
|
||||
for _, sub := range req.Unsubscribe {
|
||||
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
|
||||
for _, dp := range d.DBM.QueryDatapoints(sub.Depth, sub.Uuid, sub.Path) {
|
||||
if _, ok := dp.Subscriptions[id]; !ok {
|
||||
continue
|
||||
}
|
||||
@@ -64,7 +65,6 @@ func (d *DBMHandler) Unsubscribe(req *json_dataModels.Request, id string) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if err := d.Conns.SendResponse(id, resp); err != nil {
|
||||
d.Log.Error("subscribe.Unsubscribe", err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user