fix một số bug nhỏ
This commit is contained in:
@@ -247,26 +247,26 @@ class DeviceController extends Controller {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$OldIpAddress = $model->ip_address;
|
||||
if ($OldIpAddress !== $data["Ip"]) {
|
||||
$check = Device::findOne(['ip_address' => $data['Ip']]);
|
||||
if ($check)
|
||||
return ["status" => false, "type" => "ip"];
|
||||
// if ($OldIpAddress !== $data["Ip"]) {
|
||||
$check = Device::findOne(['ip_address' => $data['Ip']]);
|
||||
if ($check && $check->id != $id)
|
||||
return ["status" => false, "type" => "ip"];
|
||||
|
||||
$res = common::requestToCardService("/ModifyIPAddress", [
|
||||
"OldIPAddress" => $OldIpAddress,
|
||||
"NewIPAddress" => $data["Ip"],
|
||||
"NetMask" => $data["SubnetMask"],
|
||||
"GATEIPAddress" => $data["Gateway"],
|
||||
"MAC" => $model->mac_address
|
||||
]);
|
||||
if ($res == 0) {
|
||||
$model->ip_address = $data["Ip"];
|
||||
$model->subnet_mask = $data["SubnetMask"];
|
||||
$model->gateway = $data["Gateway"];
|
||||
$model->save();
|
||||
return ["status" => true];
|
||||
}
|
||||
$res = common::requestToCardService("/ModifyIPAddress", [
|
||||
"OldIPAddress" => $OldIpAddress,
|
||||
"NewIPAddress" => $data["Ip"],
|
||||
"NetMask" => $data["SubnetMask"],
|
||||
"GATEIPAddress" => $data["Gateway"],
|
||||
"MAC" => $model->mac_address
|
||||
]);
|
||||
if ($res == 0) {
|
||||
$model->ip_address = $data["Ip"];
|
||||
$model->subnet_mask = $data["SubnetMask"];
|
||||
$model->gateway = $data["Gateway"];
|
||||
$model->save();
|
||||
return ["status" => true];
|
||||
}
|
||||
// }
|
||||
return ["status" => true];
|
||||
} else {
|
||||
return [
|
||||
@@ -282,9 +282,10 @@ class DeviceController extends Controller {
|
||||
public function actionSearch() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$data = Yii::$app->request->post();
|
||||
$NetMask = "255.255.255.255";
|
||||
if (Yii::$app->request->post("SubnetMask") != "") {
|
||||
$NetMask = Yii::$app->request->post("SubnetMask");
|
||||
if ($data["SubnetMask"] != "" && $data["Checked"] !== "0") {
|
||||
$NetMask = $data["SubnetMask"];
|
||||
}
|
||||
$datas = json_decode(common::requestToCardService("/SearchDevice", ["NetMask" => $NetMask]), true);
|
||||
return [
|
||||
@@ -445,6 +446,11 @@ class DeviceController extends Controller {
|
||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||
"AuthorizeDoorId" => $v->code
|
||||
];
|
||||
$UserAuthorizeInfosDelete[] = [
|
||||
"Pin" => "",
|
||||
"AuthorizeTimezoneId" => "",
|
||||
"AuthorizeDoorId" => ""
|
||||
];
|
||||
}
|
||||
if ($value["door_access_old"] != null) {
|
||||
if (in_array($v->id, $doorsOld) && !in_array($v->id, $doors)) {
|
||||
|
||||
Reference in New Issue
Block a user