update
This commit is contained in:
parent
ead3361d32
commit
a4510fce21
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
/runtime
|
||||
/web/assets
|
||||
/web/data
|
||||
/nbproject/private/
|
||||
/web/data
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ class DashboardController extends Controller {
|
|||
|
||||
public function init() {
|
||||
parent::init();
|
||||
if (Yii::$app->user->isGuest) {
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
56
models/SyncUrl.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
0
nbproject/private/config.properties
Normal file
0
nbproject/private/config.properties
Normal file
8
nbproject/private/private.properties
Normal file
8
nbproject/private/private.properties
Normal 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/
|
7
nbproject/private/private.xml
Normal file
7
nbproject/private/private.xml
Normal 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>
|
7
nbproject/project.properties
Normal file
7
nbproject/project.properties
Normal 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
9
nbproject/project.xml
Normal 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>
|
|
@ -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
1
web/test.txt
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user