Update sửa đổi địa chỉ IP ở phần Thêm thiết bị
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user