fix bug
This commit is contained in:
@@ -161,8 +161,8 @@ class ConfigController extends Controller {
|
||||
$servermqtt = $t['servermqtt'];
|
||||
}
|
||||
return $this->render('index', [
|
||||
"servermqtt" => $servermqtt,
|
||||
"url" => isset($temp[2]) ? $temp[2] : ""
|
||||
"servermqtt" => $servermqtt === "" ? $ip . ":1883" : $servermqtt,
|
||||
"url" => isset($temp[2]) ? $temp[2] : $ip . ":5001"
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -260,16 +260,20 @@ class ConfigController extends Controller {
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if (!$tempConfig['status'])
|
||||
return $this->redirect(['/config']);
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0) {
|
||||
$path = "";
|
||||
if ($tempConfig['status']) {
|
||||
if ($tempConfig['data'] !== "") {
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0) {
|
||||
$path = "";
|
||||
} else {
|
||||
$path = $engineConfig['data']['engines'][0]['path'];
|
||||
}
|
||||
} else {
|
||||
$path = "";
|
||||
}
|
||||
} else {
|
||||
$path = $engineConfig['data']['engines'][0]['path'];
|
||||
$path = "";
|
||||
}
|
||||
|
||||
file_get_contents("http://localhost:4004/Reset", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
@@ -293,7 +297,10 @@ class ConfigController extends Controller {
|
||||
]
|
||||
])), true);
|
||||
if (!$tempConfig['status'])
|
||||
return ['status' => false];
|
||||
return ['status' => false, 'text' => ''];
|
||||
|
||||
if ($tempConfig['data'] === "")
|
||||
return ['status' => false, 'text' => 'Cấu hình ip chưa đúng!'];
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0)
|
||||
@@ -310,7 +317,7 @@ class ConfigController extends Controller {
|
||||
])), true);
|
||||
|
||||
if (!$checkConfig['status']) {
|
||||
return ['status' => false];
|
||||
return ['status' => false, 'text' => ''];
|
||||
} else {
|
||||
return ['status' => true, 'url' => Url::to(['cau-hinh-nhan-dien'])];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user