thay doi co che reset thiet bi
This commit is contained in:
parent
ef59255c52
commit
45be07f772
|
@ -301,6 +301,7 @@ class ConfigController extends Controller {
|
||||||
|
|
||||||
public function actionReset() {
|
public function actionReset() {
|
||||||
if (Yii::$app->request->post()) {
|
if (Yii::$app->request->post()) {
|
||||||
|
if (Yii::$app->request->post("resetDevice") === "true") {
|
||||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
'header' => "Content-Type: application/json",
|
'header' => "Content-Type: application/json",
|
||||||
|
@ -330,7 +331,8 @@ class ConfigController extends Controller {
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
]));
|
]));
|
||||||
if (Yii::$app->request->post("deleteDB") === "yes") {
|
}
|
||||||
|
if (Yii::$app->request->post("deleteDB") === "true") {
|
||||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
||||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
||||||
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<div class="text-center">
|
<div class="text-left">
|
||||||
<h4>BẠN CÓ MUỐN XÓA DỮ LIỆU LƯU TRỮ TRONG THIẾT BỊ KHÔNG?</h4>
|
<input type="checkbox" name="DeleteDatabase" checked="" style="width: inherit;"> Xóa dữ liệu lưu trữ trong thiết bị
|
||||||
<br>
|
<br>
|
||||||
<button class="btn btn-danger" onclick="common.reset(this, 'yes');" data-href="{yii\helpers\Url::to(['/config/reset'])}">
|
<input type="checkbox" name="ResetDevice" checked="" style="width: inherit;"> Reset cấu hình thiết bị
|
||||||
Có
|
</div>
|
||||||
</button>
|
<div class="text-center">
|
||||||
<button class="btn btn-default" onclick="common.reset(this, 'no');" data-href="{yii\helpers\Url::to(['/config/reset'])}">
|
<button class="btn btn-danger" onclick="common.reset(this);" data-href="{yii\helpers\Url::to(['/config/reset'])}">
|
||||||
Không
|
Đồng ý
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Hủy bỏ</button>
|
||||||
</div>
|
</div>
|
|
@ -302,14 +302,25 @@ common.resetForm = function (e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
common.reset = function (e, deleteDB) {
|
common.reset = function (e) {
|
||||||
if (confirm("Bạn có chắc chắn muốn reset thiết bị về cấu hình mặc định không?")) {
|
var deleteDB = false;
|
||||||
|
var resetDevice = false;
|
||||||
|
if ($("input[name='DeleteDatabase']").is(':checked'))
|
||||||
|
deleteDB = true;
|
||||||
|
if ($("input[name='ResetDevice']").is(':checked'))
|
||||||
|
resetDevice = true;
|
||||||
|
if (!deleteDB && !resetDevice) {
|
||||||
|
alert("Hãy lựa chọn thao tác!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (confirm("Bạn có chắc chắn muốn reset thiết bị không?")) {
|
||||||
common.modalBlock(true);
|
common.modalBlock(true);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $(e).attr("data-href"),
|
url: $(e).attr("data-href"),
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
deleteDB: deleteDB
|
deleteDB: deleteDB,
|
||||||
|
resetDevice: resetDevice
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
window.location = data;
|
window.location = data;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user