Add transaction origin to mqtt message. #380
This commit is contained in:
parent
a30f9b2ce8
commit
f33a253cea
3 changed files with 21 additions and 2 deletions
|
|
@ -45,6 +45,10 @@ class MapEventHandler {
|
||||||
// subscribe to jo status
|
// subscribe to jo status
|
||||||
console.log('subscribing to ' + my.options.channels.jo_status);
|
console.log('subscribing to ' + my.options.channels.jo_status);
|
||||||
my.mqtt.subscribe(my.options.channels.jo_status);
|
my.mqtt.subscribe(my.options.channels.jo_status);
|
||||||
|
|
||||||
|
// subscribe to jo origin
|
||||||
|
console.log('subscribing to ' + my.options.channels.jo_origin);
|
||||||
|
my.mqtt.subscribe(my.options.channels.jo_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -134,6 +138,14 @@ class MapEventHandler {
|
||||||
this.dashmap.removeCustomerMarker(id);
|
this.dashmap.removeCustomerMarker(id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "origin":
|
||||||
|
console.log("got origin for jo " + payload);
|
||||||
|
if (payload == 'mobile_app')
|
||||||
|
{
|
||||||
|
this.dashmap.switchJobOrderOrigin(chan_split[1], 'mobile');
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,13 @@ class JobOrderActiveCacheListener
|
||||||
// send jo location
|
// send jo location
|
||||||
$this->mqtt->publish(
|
$this->mqtt->publish(
|
||||||
'jo/' . $jo->getID() . '/location',
|
'jo/' . $jo->getID() . '/location',
|
||||||
$coords->getLatitude() . ':' . $coords->getLongitude()
|
$coords->getLatitude() . ':' . $coords->getLongitude()
|
||||||
|
);
|
||||||
|
|
||||||
|
// send transaction origin
|
||||||
|
$this->mqtt->publish(
|
||||||
|
'jo/' . $jo->getID() . '/origin',
|
||||||
|
$jo->getSource()
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: do we still need to send jo status?
|
// TODO: do we still need to send jo status?
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ function initEventHandler(dashmap) {
|
||||||
'rider_location': 'rider/+/location',
|
'rider_location': 'rider/+/location',
|
||||||
'rider_status': 'rider/+/status',
|
'rider_status': 'rider/+/status',
|
||||||
'jo_location': 'jo/+/location',
|
'jo_location': 'jo/+/location',
|
||||||
'jo_status': 'jo/+/status'
|
'jo_status': 'jo/+/status',
|
||||||
|
'jo_origin': 'jo/+/origin'
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue