update dhcp check

This commit is contained in:
2022-11-18 09:46:24 +07:00
parent 8954a2fc25
commit 5450124be9
6 changed files with 67 additions and 50 deletions

View File

@@ -159,6 +159,8 @@ class ConfigController extends Controller {
public function actionIndex() {
$this->view->title = Yii::t("app", "CAU_HINH_MAY_CHU");
if (Yii::$app->params['type'] != "BiFace")
return $this->redirect(['cau-hinh-ip']);
$options = [
'http' => [
'header' => "Content-Type: application/json",
@@ -260,6 +262,8 @@ class ConfigController extends Controller {
return true;
} else {
$this->view->title = Yii::t("app", "CAU_HINH_NHAN_DIEN");
if (Yii::$app->params['type'] != "BiFace")
return $this->redirect(['cau-hinh-ip']);
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
@@ -424,6 +428,8 @@ class ConfigController extends Controller {
public function actionCauHinhThietBi() {
$this->view->title = Yii::t("app", "CAU_HINH_THIET_BI");
if (Yii::$app->params['type'] != "BiFace")
return $this->redirect(['cau-hinh-ip']);
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
'http' => [
@@ -529,9 +535,9 @@ class ConfigController extends Controller {
if (Yii::$app->request->post()) {
Yii::$app->response->format = "json";
$post = Yii::$app->request->post();
if (!isset($this->subnet[$post['subnet_mask']]))
if (!$post['dhcp'] && !isset($this->subnet[$post['subnet_mask']]))
return ["status" => false];
$post['subnet_mask'] = $this->subnet[$post['subnet_mask']];
$post['subnet_mask'] = isset($this->subnet[$post['subnet_mask']]) ? $this->subnet[$post['subnet_mask']] : "";
$options = [
'http' => [
'header' => "Content-Type: application/json",