update solution to resset auto sync flag
This commit is contained in:
parent
c22ce35c48
commit
aba8a19d75
|
@ -490,6 +490,7 @@ class ApiController extends Controller {
|
|||
}
|
||||
|
||||
public function actionReGenFeature() {
|
||||
\app\models\SyncUrl::deleteAll(['key_config' => 'log_process_status']);
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
if (!$updating) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
|
@ -519,15 +520,18 @@ class ApiController extends Controller {
|
|||
$logProcessStatus = \app\models\SyncUrl::findOne(['key_config' => 'log_process_status']);
|
||||
if (!$logProcessStatus) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create(['key_config' => 'log_process_status', 'data' => "true"]);
|
||||
$model->create(['key_config' => 'log_process_status', 'data' => json_encode(["status" => true, "time" => time()])]);
|
||||
$logProcessStatus = \app\models\SyncUrl::findOne(['key_config' => 'log_process_status']);
|
||||
} else {
|
||||
if ($logProcessStatus->data == "true") {
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "CHECK LOGS PROCESSING\n", FILE_APPEND);
|
||||
return ["data" => "check logs processing"];
|
||||
$processStatus = json_decode($logProcessStatus->data, true);
|
||||
if ($processStatus['status']) {
|
||||
if (time() - $processStatus['time'] < 60 * 3) {
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "CHECK LOGS PROCESSING\n", FILE_APPEND);
|
||||
return ["data" => "check logs processing"];
|
||||
}
|
||||
} else {
|
||||
$logProcessStatus->data = "true";
|
||||
$logProcessStatus->data = json_encode(["status" => true, "time" => time()]);
|
||||
$logProcessStatus->save();
|
||||
}
|
||||
}
|
||||
|
@ -599,7 +603,7 @@ class ApiController extends Controller {
|
|||
];
|
||||
}
|
||||
}
|
||||
if (count($infomation) > 0)
|
||||
if (count($infomation) > 0 || count($fault_information) > 0)
|
||||
file_get_contents($ip . "/api/model/set_log_model", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
|
@ -612,7 +616,7 @@ class ApiController extends Controller {
|
|||
]));
|
||||
@file_get_contents("http://localhost:2305/update-feature?total=" . ListManagement::find()->count());
|
||||
}
|
||||
$logProcessStatus->data = "false";
|
||||
$logProcessStatus->data = json_encode(["status" => false, "time" => time()]);
|
||||
$logProcessStatus->save();
|
||||
return ["data" => "check logs"];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user