thay đổi địa chỉ IP cho thiết bị
This commit is contained in:
parent
278f2387c0
commit
4a33ee9a7d
|
@ -239,14 +239,24 @@ class DeviceController extends Controller {
|
|||
$data = Yii::$app->request->post();
|
||||
$OldIpAddress = $model->ip_address;
|
||||
if ($OldIpAddress !== $data["Ip"]) {
|
||||
return json_decode(common::requestToCardService("/ModifyIPAddress", [
|
||||
$check = Device::findOne(['ip_address' => $data['Ip']]);
|
||||
if ($check)
|
||||
return ["status" => false, "type" => "ip"];
|
||||
|
||||
$res = common::requestToCardService("/ModifyIPAddress", [
|
||||
"OldIPAddress" => $OldIpAddress,
|
||||
"NewIPAddress" => $data["Ip"],
|
||||
"NetMask" => $data["SubnetMask"],
|
||||
"MAC" => ""
|
||||
]), true);
|
||||
"MAC" => $model->mac_address
|
||||
]);
|
||||
if ($res == 0) {
|
||||
$model->ip_address = $data["Ip"];
|
||||
$model->subnet_mask = $data["SubnetMask"];
|
||||
$model->save();
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return ["status" => true];
|
||||
} else {
|
||||
return [
|
||||
"title" => Html::tag("i", "", ["class" => "fa fa-pencil"]) . " Thay đổi địa chỉ IP",
|
||||
|
|
|
@ -223,10 +223,8 @@ function changeIP(e) {
|
|||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
console.log(data);
|
||||
return;
|
||||
if (data.status) {
|
||||
notification.success("Đã lưu thông tin", 1000);
|
||||
notification.success("Đổi IP thiết bị thành công", 1000);
|
||||
$.pjax.reload({container: '#device-list'});
|
||||
$("#device-list").on('pjax:success', function () {
|
||||
common.checkboxInit("device");
|
||||
|
|
Loading…
Reference in New Issue
Block a user