Bổ sung các tính năng điều khiển engine
This commit is contained in:
@@ -882,4 +882,20 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCheckTimeEngine() {
|
||||
Yii::$app->response->format = "json";
|
||||
$config_engine = ["start_at" => "00:00", "end_at" => "23:59"];
|
||||
$engine_time_config = \app\models\SyncUrl::findOne(['key_config' => 'engine_time_config']);
|
||||
if ($engine_time_config)
|
||||
$config_engine = json_decode($engine_time_config->data, true);
|
||||
|
||||
$start_at = date_format(date_create_from_format('H:i:s d/m/Y', $config_engine['start_at'] . ":00 " . date("d/m/Y")), 'U');
|
||||
$end_at = date_format(date_create_from_format('H:i:s d/m/Y', $config_engine['end_at'] . ":59 " . date("d/m/Y")), 'U');
|
||||
$now = time();
|
||||
if ($now < $start_at || $now > $end_at)
|
||||
return ["status" => false];
|
||||
|
||||
return ["status" => true];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user