diff --git a/models/Sync_data_model.php b/models/Sync_data_model.php index 979d126..c609ad2 100644 --- a/models/Sync_data_model.php +++ b/models/Sync_data_model.php @@ -17,8 +17,10 @@ define('SYNC_DELIMITER_ST_INFO', '|'); // (拆分) 其它 define('MCACHE_STATION_NO_STR', 'station_no_str'); define('MCACHE_STATION_NAME_STR', 'station_name_str'); define('MCACHE_STATION_IP_STR', 'station_ip_str'); +define('MCACHE_STATION_PORT_STR', 'station_port_str'); define('MCACHE_STATION_888_STR', 'station_888_str'); define('MCACHE_MQTT_IP_STR', 'mqtt_ip_str'); +define('MCACHE_MQTT_PORT_STR', 'mqtt_port_str'); define('MCACHE_SYNC_888_TMP_LOG', 'sync_888_tmp_log'); // 暫存 888 進出 @@ -603,6 +605,11 @@ class Sync_data_model extends CI_Model $station_ip_str = $station_setting_result['station_ip']; // 場站目前對外IP + if(empty($port_info)) + $station_port_str = '80'; + else + $station_port_str = substr($port_info, 1); // 場站目前對外PORT + $station_setting_arr = $station_setting_result['results']; $station_no_arr = array(); $station_name_arr = array(); @@ -627,6 +634,7 @@ class Sync_data_model extends CI_Model $this->vars['mcache']->set(MCACHE_STATION_NO_STR, $station_no_str); $this->vars['mcache']->set(MCACHE_STATION_NAME_STR, $station_name_str); $this->vars['mcache']->set(MCACHE_STATION_IP_STR, $station_ip_str); + $this->vars['mcache']->set(MCACHE_STATION_PORT_STR, $station_port_str); $this->vars['mcache']->set(MCACHE_STATION_888_STR, $station_888_str); $this->vars['mcache']->set(MCACHE_MQTT_IP_STR, $mqtt_ip_str); $this->vars['mcache']->set(MCACHE_MQTT_PORT_STR, $mqtt_port_str); @@ -639,16 +647,15 @@ class Sync_data_model extends CI_Model $station_no_str = $this->vars['mcache']->get(MCACHE_STATION_NO_STR); $station_name_str = $this->vars['mcache']->get(MCACHE_STATION_NAME_STR); $station_ip_str = $this->vars['mcache']->get(MCACHE_STATION_IP_STR); + $station_port_str = $this->vars['mcache']->get(MCACHE_STATION_PORT_STR); $station_888_str = $this->vars['mcache']->get(MCACHE_STATION_888_STR); $mqtt_ip_str = $this->vars['mcache']->get(MCACHE_MQTT_IP_STR); $mqtt_port_str = $this->vars['mcache']->get(MCACHE_MQTT_PORT_STR); if( $reload || - empty($station_no_str) || - empty($station_name_str) || - empty($station_ip_str) || - empty($mqtt_ip_str) || - empty($mqtt_port_str) || + empty($station_no_str) || empty($station_name_str) || + empty($station_ip_str) || empty($mqtt_ip_str) || + empty($station_port_str) || empty($mqtt_port_str) || empty($station_888_str) ) { @@ -659,6 +666,7 @@ class Sync_data_model extends CI_Model $station_no_str = $this->vars['mcache']->get(MCACHE_STATION_NO_STR); $station_name_str = $this->vars['mcache']->get(MCACHE_STATION_NAME_STR); $station_ip_str = $this->vars['mcache']->get(MCACHE_STATION_IP_STR); + $station_port_str = $this->vars['mcache']->get(MCACHE_STATION_PORT_STR); $station_888_str = $this->vars['mcache']->get(MCACHE_STATION_888_STR); $mqtt_ip_str = $this->vars['mcache']->get(MCACHE_MQTT_IP_STR); $mqtt_port_str = $this->vars['mcache']->get(MCACHE_MQTT_PORT_STR); @@ -680,6 +688,7 @@ class Sync_data_model extends CI_Model $station_setting['station_no'] = $station_no_str; $station_setting['station_name'] = $station_name_str; $station_setting['station_ip'] = $station_ip_str; + $station_setting['station_port'] = $station_port_str; $station_setting['station_888'] = $station_888_str; $station_setting['mqtt_ip'] = $mqtt_ip_str; $station_setting['mqtt_port'] = $mqtt_port_str; diff --git a/views/carpark/station_setting.php b/views/carpark/station_setting.php index e2481ab..9713d4e 100644 --- a/views/carpark/station_setting.php +++ b/views/carpark/station_setting.php @@ -20,8 +20,12 @@
- - + + +
+
+ +
@@ -60,18 +64,23 @@ function reset_station_setting() }, success: function(jdata) { + var station_service_url = jdata['station_ip'] + ' : ' + jdata['station_port'] + var station_mqtt_url = jdata['mqtt_ip'] + ' : ' + jdata['mqtt_port'] + if(jdata == 'fail') { $("#ss_station_name").val('未設定'); $("#ss_station_no").val(''); - $("#ss_station_ip").val(jdata['station_ip']); + $("#ss_station_service_url").val(station_service_url); + $("#ss_station_mqtt").val(station_mqtt_url); alertify_error('載入失敗。。'); return false; } $("#ss_station_name").val(jdata['station_name']); $("#ss_station_no").val(jdata['station_no']); - $("#ss_station_ip").val(jdata['station_ip']); + $("#ss_station_service_url").val(station_service_url); + $("#ss_station_mqtt").val(station_mqtt_url); alertify_success('完成。。'); } });