update delete database option

This commit is contained in:
2020-12-22 16:41:58 +07:00
parent fc0f2ccc0f
commit d0f17afc39
4 changed files with 42 additions and 4 deletions

View File

@@ -300,7 +300,7 @@ class ConfigController extends Controller {
}
public function actionReset() {
if (Yii::$app->request->isAjax) {
if (Yii::$app->request->post()) {
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
@@ -330,7 +330,17 @@ class ConfigController extends Controller {
])
]
]));
if (Yii::$app->request->post("deleteDB") === "yes") {
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
}
return Url::to(['/config']);
} else {
Yii::$app->response->format = "json";
return [
"title" => "Reset thiết bị",
"form" => $this->renderPartial("reset")
];
}
}