Keep legacy mqtt payload the same #730
This commit is contained in:
parent
ddde274fdc
commit
3861a9bf93
1 changed files with 11 additions and 6 deletions
|
|
@ -40,9 +40,6 @@ class MQTTClient
|
||||||
//error_log('sending mqtt event: ');
|
//error_log('sending mqtt event: ');
|
||||||
//error_log(print_r($payload, true));
|
//error_log(print_r($payload, true));
|
||||||
|
|
||||||
// append jo id to payload
|
|
||||||
$payload['jo_id'] = $job_order->getID();
|
|
||||||
|
|
||||||
// get all new and legacy mobile sessions
|
// get all new and legacy mobile sessions
|
||||||
$legacy_sessions = $job_order->getCustomer()->getMobileSessions();
|
$legacy_sessions = $job_order->getCustomer()->getMobileSessions();
|
||||||
|
|
||||||
|
|
@ -84,14 +81,22 @@ class MQTTClient
|
||||||
{
|
{
|
||||||
$phone_num = $sess['data']->getPhoneNumber();
|
$phone_num = $sess['data']->getPhoneNumber();
|
||||||
|
|
||||||
// use appropriate prefix so we have different channel names for new api
|
$channel_payload = $payload;
|
||||||
$prefix = $sess['legacy'] ? self::PREFIX : self::PREFIX_APIv2;
|
|
||||||
|
// keep channel and payload for legacy the same
|
||||||
|
if ($sess['legacy']) {
|
||||||
|
$prefix = self::PREFIX;
|
||||||
|
} else {
|
||||||
|
$prefix = self::PREFIX_APIv2;
|
||||||
|
$channel_payload['jo_id'] = $job_order->getID();
|
||||||
|
}
|
||||||
|
|
||||||
$channel = $prefix . $phone_num;
|
$channel = $prefix . $phone_num;
|
||||||
|
|
||||||
error_log("SENDING TO CHANNEL: " . $channel);
|
error_log("SENDING TO CHANNEL: " . $channel);
|
||||||
|
|
||||||
// gather channels, so we only send once
|
// gather channels, so we only send once
|
||||||
$channels[$channel] = json_encode($payload);
|
$channels[$channel] = json_encode($channel_payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($channels as $channel => $json_payload)
|
foreach ($channels as $channel => $json_payload)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue