This commit is contained in:
dongpd 2020-03-27 15:55:56 +07:00
parent ead3361d32
commit a4510fce21
13 changed files with 108 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
/runtime
/web/assets
/web/data
/nbproject/private/

View File

@ -35,4 +35,14 @@ class ApiController extends Controller {
}
}
public function actionSyncUrl() {
if (Yii::$app->request->post()) {
$post = Yii::$app->request->bodyParams;
$model = new \app\models\FaceLogs();
$model->create($post);
Yii::$app->response->format = "json";
return ["stt" => true];
}
}
}

View File

@ -16,6 +16,9 @@ class DashboardController extends Controller {
public function init() {
parent::init();
if (Yii::$app->user->isGuest) {
return $this->redirect(['/site/login']);
}
}
/**

BIN
db/app.db

Binary file not shown.

View File

@ -35,7 +35,8 @@ class FaceLogs extends \yii\db\ActiveRecord {
*/
public function rules() {
return [
[['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'frametime', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'string'],
[['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'string'],
[['frametime'], 'integer']
];
}
@ -66,8 +67,8 @@ class FaceLogs extends \yii\db\ActiveRecord {
'confidence' => $data['confidence'],
'enable_door' => $data['enable_door'],
'encoded_person_image' => $data['encoded_person_image'],
'frametime' => $data['frametime'],
'face_id' => $data['face_id'],
'frametime' => date_format(date_create_from_format('Y-m-d H:i:s', $data['frametime']), 'U'),
'face_id' => $data['id'],
'person_id' => $data['person_id'],
'image' => $data['image'],
'status' => $data['status'],

56
models/SyncUrl.php Normal file
View File

@ -0,0 +1,56 @@
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "sync_url".
*
* @property int $id
* @property string $data
*/
class SyncUrl extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'sync_url';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['data'], 'required'],
[['data'], 'string'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => 'ID',
'data' => 'Data',
];
}
public function create($data) {
$r = $this->load([
'data' => $data['url'],
], '');
if ($r) {
try {
$this->save();
return $this->id;
} catch (\Exception $ex) {
return false;
}
}
}
}

View File

View File

@ -0,0 +1,8 @@
copy.src.files=false
copy.src.on.open=false
copy.src.target=
remote.connection=BI-9f36c2
remote.directory=/anpr
remote.upload=ON_SAVE
run.as=LOCAL
url=http://localhost/

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>

View File

@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

9
nbproject/project.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>BIFace</name>
</data>
</configuration>
</project>

View File

@ -1,8 +1,8 @@
<?php
// comment out the following two lines when deployed to production
//defined('YII_DEBUG') or define('YII_DEBUG', true);
//defined('YII_ENV') or define('YII_ENV', 'dev');
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';

1
web/test.txt Normal file

File diff suppressed because one or more lines are too long