update điều chỉnh thời gian mở cửa

This commit is contained in:
2020-10-30 11:45:12 +07:00
parent 28f23530d0
commit 41598c6225
5 changed files with 73 additions and 40 deletions

View File

@@ -579,11 +579,21 @@ class DeviceController extends Controller {
}
}
public function actionEditDoorName($id) {
public function actionEditDoor($id) {
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
$model = Door::findOne($id);
if ($model) {
$model->name = Yii::$app->request->post("name");
$model->name = $post["name"];
if ($model->duration !== $post["duration"]) {
$device = $this->findModel($model->device_id);
common::requestToCardService("/SetDeviceData/DoorDriverTime", [
"DeviceIP" => $device->ip_address,
"DoorID" => $model->code,
"DoorDriverTime" => $post["duration"]
]);
$model->duration = $post["duration"];
}
$model->modified_at = time();
$model->save();
}