Compare commits
No commits in common. "cloud" and "Cloud" have entirely different histories.
|
@ -63,9 +63,6 @@ class ApiController extends Controller {
|
|||
}
|
||||
|
||||
public function actionTest() {
|
||||
$sync = \app\models\SyncUrl::find()->one();
|
||||
var_dump(parse_url($sync->data));
|
||||
exit();
|
||||
Yii::info("Hello");
|
||||
// echo base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/imgs/test.jpg"));
|
||||
// \app\models\WaitingReq::deleteAll();
|
||||
|
@ -83,22 +80,15 @@ class ApiController extends Controller {
|
|||
|
||||
public function actionSync() {
|
||||
Yii::$app->response->format = "json";
|
||||
$sync = \app\models\SyncUrl::find()->one();
|
||||
if ($sync) {
|
||||
$parseUrl = parse_url($sync->data);
|
||||
$host = $parseUrl['host'];
|
||||
$port = isset($parseUrl['port']) ? $parseUrl['port'] : 80;
|
||||
if ($this->is_connected($host, $port)) {
|
||||
if ($this->is_connected()) {
|
||||
$sync = \app\models\SyncUrl::find()->one();
|
||||
if ($sync) {
|
||||
$logs = \app\models\WaitingReq::find()->all();
|
||||
foreach ($logs as $key => $value) {
|
||||
$contentJSON = json_decode($value->content);
|
||||
|
||||
$imgPath = $contentJSON->image;
|
||||
$imgBase64 = file_exists($imgPath) ? base64_encode(file_get_contents($imgPath)) : "";
|
||||
if ($imgBase64 == "") {
|
||||
$value->delete();
|
||||
continue;
|
||||
}
|
||||
$imgBase64 = base64_encode(file_get_contents($imgPath));
|
||||
$contentJSON->image = $imgBase64;
|
||||
|
||||
$newValue = json_encode($contentJSON);
|
||||
|
@ -123,8 +113,8 @@ class ApiController extends Controller {
|
|||
return ["status" => true];
|
||||
}
|
||||
|
||||
function is_connected($host, $port) {
|
||||
$connected = @fsockopen($host, $port);
|
||||
function is_connected($ip = "google.com") {
|
||||
$connected = @fsockopen($ip, 80);
|
||||
//website, port (try 80 or 443)
|
||||
if ($connected) {
|
||||
$is_conn = true; //action when connected
|
||||
|
|
|
@ -17,8 +17,8 @@ class ConfigTree extends Widget {
|
|||
|
||||
public function run() {
|
||||
|
||||
$public_root = ['engine', 'recognition', 'open_door', 'screen', 'lang', 'camera'];
|
||||
$public_cfg = ['engine|cam_id', 'engine|server_authen', 'recognition|server_recog', 'open_door|enable', 'open_door|port_name', 'screen|banner', 'lang', 'camera|rgb', 'camera|ir', 'camera|rgb|url', 'camera|ir|url'];
|
||||
$public_root = ['engine', 'recognition', 'open_door', 'screen', 'lang'];
|
||||
$public_cfg = ['engine|cam_id', 'engine|server_authen', 'recognition|server_recog', 'open_door|enable', 'open_door|port_name', 'screen|banner', 'lang'];
|
||||
|
||||
return $this->render("config-tree", [
|
||||
"configLists" => $this->configLists,
|
||||
|
|
Loading…
Reference in New Issue
Block a user