From 5cefdb80318d932e98a9cfeb1112e794f0eb0839 Mon Sep 17 00:00:00 2001 From: dongpd Date: Tue, 19 Jan 2021 14:58:18 +0700 Subject: [PATCH] fix bug updating flag --- controllers/ApiController.php | 14 +++++++++++--- views/list-management/index.tpl | 8 +++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 60b5f81a..be3b14fb 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -420,11 +420,19 @@ class ApiController extends Controller { } public function actionReGenFeature() { - if (Yii::$app->request->isAjax) { - $updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']); + $updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']); + if (!$updating) { + $model = new \app\models\SyncUrl(); + $model->create([ + 'key_config' => "updating", + 'data' => "false" + ]); + } else { $updating->data = "false"; - return $updating->save(); + $updating->save(); } + Yii::$app->response->format = "json"; + return ["data" => "reset updating flag"]; } } diff --git a/views/list-management/index.tpl b/views/list-management/index.tpl index 96cf810b..5dc00695 100644 --- a/views/list-management/index.tpl +++ b/views/list-management/index.tpl @@ -207,11 +207,9 @@ Đặc trưng 2 - - - - + {if $updating->data==="true"} + + {/if} {* {$statistics.512}/{$statistics.img}*}