Update sửa đổi địa chỉ IP ở phần Thêm thiết bị

This commit is contained in:
2020-10-26 10:18:25 +07:00
parent fbb8a80da8
commit 7204a46da7
5 changed files with 208 additions and 3 deletions

View File

@@ -502,4 +502,38 @@ class DeviceController extends Controller {
}
}
public function actionChangeIpSearchForm() {
Yii::$app->response->format = "json";
if (Yii::$app->request->post()) {
$data = json_decode(Yii::$app->request->post("data"), true);
return [
"title" => Html::tag("i", "", ["class" => "fa fa-pencil"]) . " Thay đổi địa chỉ IP",
"form" => $this->renderPartial("change-ip-search", [
"data" => $data,
"url" => Url::to(["change-ip-search"])
])
];
}
}
public function actionChangeIpSearch() {
Yii::$app->response->format = "json";
if (Yii::$app->request->post()) {
$data = Yii::$app->request->post();
if ($data["IpOld"] !== $data["IpNew"]) {
$res = common::requestToCardService("/ModifyIPAddress", [
"OldIPAddress" => $data["IpOld"],
"NewIPAddress" => $data["IpNew"],
"NetMask" => $data["SubnetMask"],
"GATEIPAddress" => $data["Gateway"],
"MAC" => $data["MAC"]
]);
if ($res == 0) {
return ["status" => true];
}
}
return ["status" => true];
}
}
}