diff --git a/controllers/Carpark.php b/controllers/Carpark.php index e796b4e..ff72af4 100644 --- a/controllers/Carpark.php +++ b/controllers/Carpark.php @@ -152,12 +152,12 @@ class Carpark extends CI_Controller { echo 'ck_error'; exit; - } + } + + trigger_error(__FUNCTION__ . "|{$topic}|{$msg}"); if($topic == 'altob.888.mqtt') { - trigger_error(__FUNCTION__ . "|{$topic}|{$msg}"); - // 第一個場站編號 先不管場站 $station_setting = $this->sync_data_model->station_setting_query(); $station_no_arr = explode(SYNC_DELIMITER_ST_NO, $station_setting['station_no']); diff --git a/coworker/mqtt_service.php b/coworker/mqtt_service.php index 70ba545..8b1e515 100644 --- a/coworker/mqtt_service.php +++ b/coworker/mqtt_service.php @@ -74,12 +74,16 @@ function procmsg($topic, $msg) { $data = array('topic' => $topic, 'msg' => $msg, 'ck' => md5($topic.'altob'.$msg)); - // dispatch - $ch = curl_init(); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POST, true); // 啟用POST - curl_setopt($ch, CURLOPT_URL, 'http://localhost/carpark.html/mqtt_service/'); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); - $result = curl_exec($ch); + if($topic == 'altob.888.mqtt') + { + // dispatch + $ch = curl_init(); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); // 啟用POST + curl_setopt($ch, CURLOPT_URL, 'http://localhost/carpark.html/mqtt_service/'); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); + $result = curl_exec($ch); + } + trigger_error("..{$topic}|{$msg}..curl:{$result}.."); }